cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

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