cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
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