How do I compare a variables values to a table column valueI have what should be a simple problem, but I don't know the right way to phrase it.
I have a few variables;
A1 = "44";
A2 = "47";
A3 = "50";
//numbers are in string format intentionally
And a data table, dt, where these variables are included among many others in one column, column "LOT". If I create a for loop, to find these variables in the table, and mark the rows when they are found, I am not able to find them..
For( i = 1, i <= 3, i++,
foundlot = "A" || Char( i );
Show( foundlot );
dt << Select Where( :LOT = foundlot ) << Colors = (5);
);
I realize the problem is that foundlot is a string "A1", "A2", "A3", ... and does not substitute the value of A1, A2 and A3 to allow a comparison of the value of A1 to the column value in the table.
What would I need to do to have it substitute the value, rather than compare the column value to the string "A1" which always is not a match?
Thank you for your help!
Data Blending and CleanupMass CustomizationRe: How do I compare a variables values to a table column valueThis worked really well. Thank you!
Re: How do I compare a variables values to a table column valueThank you! I will give this a try!Re: How do I compare a variables values to a table column valueI believe these two simple scripts below will handle what you want. The issue you are having, is having the need to indicate that A1, A2 and A3 are not variable values, but are the names of variables. Script 1 will do that for you. The second script is probably a better way to think of your issue. By using a JMP list, you can reference the variables value by using subscripts
names default to here(1);
dt=current data table();
A1 = "44";
A2 = "47";
A3 = "50";
For( i=1, i<=3, i++,
foundlot = "A" || char(i); Show (foundlot);
Eval(Parse(EvalInsert("\[dt << Select Where(:LOT == ^foundlot^, current selection("extend") ) ;]\")));
);
dt << colors( "red");
// or
names default to here(1);
dt=current data table();
aList = {"44", "47", "50" };
For( i=1, i<=3, i++,
dt << Select Where( :Lot == aList[i], current selection("extend"));
);
dt << colors( "red");