I have a short JSL script that I'm looking to add to a larger automated workflow. The intent is to iterate over the values in a column (layer_type) and if it finds any value other than SSOD the code should return 1. If all values in the columns are 'SSOD' then it should return 0. This is being used in a if/else split in a workflow to throw an error. In general if you have recommendations of a better way to code this up I'm all ears.
Given the existing code - I've pulled it out of the workflow to debug. The code works as intended when I run it in a JSL window with the correct data table selected. However because I'm inserting it into a workflow for users I want to be explicit about the data table name as I've found that to be more robust, however when I add the first line of code it no longer works as intended - it still runs but always returns '1' regardless of the column values.
The below JSL yields the expected results when run in a script window referencing the table (attached). Note the table as attached will return '0'. Modify a value in a single row in the 'layer_type' column to anything else and it should return 1.

Summarize( meas = by( :layer_type ) );
result = 0;
For( i = 1, i <= N Items( meas ), i++,
If( meas[i] != "SSOD",
result = 1;
Break();
)
);
result;
However, when I modify only the beginning of the JSL to explicitly reference the table it no longer works - when I change a single value in the 'layer_type' column to anything other than SSOD it continues to return '0'. In fact I've tested this both ways by commenting out the Data Table( "layer_type_forum_help" ) <<
code and it seems it always returns what was previously returned when the block started with the 'Summarize' command
Data Table( "layer_type_forum_help" ) << Summarize( meas = by( :layer_type ) );
result = 0;
For( i = 1, i <= N Items( meas ), i++,
If( meas[i] != "SSOD",
result = 1;
Break();
)
);
result;
Thanks you pre-emptively for your help!