Problem
Suppose you prompt a user to make a selection. When you retrieve the values from the user, typically they are stored in a list. Now you need to select the data that matches the values in the list.
Solution
The following example demonstrates how you can select rows in a data table that contain any value stored in a JSL list. Lists containing either numeric values or character strings can be used and are shown below. See the embedded comments for details.
/* Open a sample data table. */
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
/* Create a list of ages. */
myList = {9, 12, 15, 17, 18};
/* Select all rows which have an age that is in the list. */
dt << Select Where( Contains( myList, :age ) );
Wait( 2 ); // For demonstration purposes
/* Create a list of student names. */
myStudents = {"HENRY", "ROBERT", "BARBARA", "SALLY", "MARION"};
/* Select all rows which have any of the names in the list. */
dt << Select Where( Contains( myStudents, :name ) );