cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

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