I got advice largely from Looping through an Associative Array's elements on how to iterate through associative arrays. My understanding is that the iterator iterates over the keys, not the values, but that you can easily access the values gives that you have the array.
My code is below.
Names Default To Here(1);
dt1 = Open("file path" );
dt2 = Open("file path 2");
Summarize(dt1, IDs = by(:ID)); //this finds all the unique IDs in the data file, which we will need
//First, populate the temporary data structure--associative array--from the dt1 data file which we will then copy over to the dt2 data file.
For (i=1, i<=N Items(IDs), i++,
ID = IDs[i];
temp_array = Associative Array ({"Val1","Val2","Val3"},{{},{},{}});
For ( temp = temp_array << First, Is Empty(temp_array[temp]), temp = temp_array << Next(temp),//looping through temp_array's keys is clunky but done this way in JMP
query_date = dt1 << Select Where (:"ID" == ID);
Write(query_date);
//etc not there yet because the above not working
);
);
The variable of interest at this point in my journey is query_date, which I need to proceed. Problem is, as it is written, the inner loop doesn't run even once for some reason. The while condition in the loop should evaluate to True until I want the loop to terminate, so I have it set to
Is Empty(temp_array[temp])
because temp_array[temp] is the first value in the associative array, where temp is the first key, "Val1", and the value is {}. I guess an important question is: Does {} evaluate to True or False in Is Empty()? I can't even google this because {} are special characters which google doesn't process. So you can see why I'm confused.
I have the rest of my script coded out already, and I am fairly confident it will work with minor errors at this point, so if I can get past this hurdle that would help a lot. The pseudocode is very clear in my mind and, as a new JMP JSL user, things are becoming clearer, which I am grateful for. Thank you all for your help!
Mike