cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
UserID16644
Level V

How to check if list value exist in folder?

Hi all,

I have files that needs to be checked if it is existing in a folder. If it does not exist, a prompt will show which file names are not in my list. Here's a snippet of my code:

//Sample Data
dt = Open( "$SAMPLE_DATA/Quality Control/Diameter.jmp" );
New Column ("Machine Op", Character,
    Formula
            ( "Machine_" || :MACHINE || " Op_" || :OPERATOR )      
        );
dt_list =associative array(column(dt, "Machine Op" ) <<get values) <<get keys;

//Files in folder
directory = "C:\Users\Desktop\Machine Operator Reference";
fileNames = Files In Directory( directory );



/* if dt_list does not exist in fileNames, prompt data table with missing file */

 

3 REPLIES 3
jthi
Super User

Re: How to check if list value exist in folder?

UserID16644
Level V

Re: How to check if list value exist in folder?

How can I transform this into an array?

fileNames = Files In Directory( directory );
txnelson
Super User

Re: How to check if list value exist in folder?

The variable fileNames, is a JMP List, which is similar to an array.  Elements within the list, can be referenced by subscript;

 

fileNames[3] returns the 3rd file name from the list.

 

If you are asking, how do you move this into an Associative Array

dt_list=associative array(filenames)
Jim

Recommended Articles