More Efficient Code for Assigning Tags to Multiple ColumnsI have the following JSL code for assigning tags to a group of columns...
t1 = "Contaminants";
dt5 << Define Tag( t1, Color("Light Red") );
Data Table(dt5):CH4.ppm. <<
Set Property( Tags, {"Contaminants"} ),;
Data Table( dt5 ):CO2.ppm. <<
Set Property( Tags, {"Contaminants"} );
Data Table( dt5 ):H2O.per. <<
Set Property( Tags, {"Contaminants"} );
Data Table( dt5 ):CO.ppm. <<
Set Property( Tags, {"Contaminants"} );
Data Table( dt5 ):O3.ppb. <<
Set Property( Tags, {"Contaminants"} );
Data Table( dt5 ):NO2.ppb. <<
Set Property( Tags, {"Contaminants"} );
Data Table( dt5 ):NO.ppb. <<
Set Property( Tags, {"Contaminants"} );
It works fine but I'm wondering if there is a way to make this more efficient by eliminating the duplicate Data Table/Set Property functions. Is there a way to define a list of columns in the original Data Table command? I have tried defining a list with curly braces, parentheses, both curly braces and parentheses, with colons, without colons, etc, etc and I can't seem to hit on the right syntax. The scripting index doesn't seem to help here.
Also, I would like to define the name of the tag as a variable (t1). This seems to work for the Define Tag function but I can't seem to get it to work for the multiple Set Property functions.
Does anyone have insight here as to what I'm missing?
Thanks much.
Automation and ScriptingRe: More Efficient Code for Assigning Tags to Multiple Columnst1 = "Contaminants";
dt5 << Define Tag(t1, Color("Light Red"));
<SPAN class="hljs-keyword">columns</SPAN> = {"CH4.ppm", "CO2.ppm", "H2O.per", "CO.ppm", "O3.ppb", "NO2.ppb", "NO.ppb"};
<SPAN class="hljs-keyword">For</SPAN> <SPAN class="hljs-keyword">Each</SPAN>(col, <SPAN class="hljs-keyword">columns</SPAN>,
Data <SPAN class="hljs-keyword">Table</SPAN>(dt5) << <SPAN class="hljs-keyword">Column</SPAN>(col) << <SPAN class="hljs-keyword">Set</SPAN> Property("Tags", {t1});
);Re: More Efficient Code for Assigning Tags to Multiple ColumnsYou can send the <
-edit
Was not paying attention earlier. There's no <
Names Default To Here( 1 );
t1 = "Contaminants";
dt5 << Define Tag( t1, Color( "Light Red" ) ); //Unknown message
cols = dt5 << Get Column Reference( {"CH4.ppm", "CO2.ppm", "H2O.per", "CO.ppm", "O3.ppb", "NO2.ppb", "NO.ppb"} );
cols << Set Property( "Tags", Eval List( {t1} ) );
Re: More Efficient Code for Assigning Tags to Multiple ColumnsOh, tags are a JMP 19 addition! Nice. Can't wait until my company lets us upgrade.