Normal "SelectWhere" usage appears to be as follows:
dt<<SelectWhere(:ExampleColumnName > 5);
And this works fine. What I have difficulty with is when I need more flexiblity in what the ":ExampleColumnName" is going to be.
For example, if I save a new column of Studentized Residuals in a Fit Model, it will create a column called something like "Studentized Resid Log(CFU/mL) By Condition". Let's say I want to select anything above 3 or below -3. Due to the column's name, I would need to use:
dt<<SelectWhere(:Name("Studentized Resid Log(CFU/mL) By Condition")<-3 | :Name("Studentized Resid Log(CFU/mL) By Condition")>3);
This is fine most of the time, but not always. Having to have the fully written out string within :Name() isn't really ideal -- for example, if the plan is to make a function usable for a variety of Fit Models that will each produce different Studentized Residual column names, it isn't efficient to write a unique "SelectWhere" for every possible model (especially if you can't always anticipate what model the user will choose).
What I would like to work is one/both of the following:
//Option 1
colName = ""Studentized Resid Log(CFU/mL) By Condition";
dt<<SelectWhere(:Name(colName)<-3 | ::Name(colName)>3);
//Option 2
colRef = Column(dt, colName);
dt<<SelectWhere( colRef <-3 | colRef >3 );
Option 1 returns a "Name argument must be quoted string" error when the SelectWhere function is run. Seems like :Name() requires a fully written out string, and a reference to one is unacceptable.
Option 2 returns no errors, but nothing will be selected. SelectWhere doesn't seem to treat column reference variables like explicitly typed out ":XXXX" references.
My current workaround is not great: after Fit Model creates new column, rename the very last column on the table to something simple and unique (like "StdResid") that can be directly used in the "normal usage" of SelectWhere (e.g., ":StdResid").
Am I missing something obvious here that would make my life easier?
Also, is there any way to get Option 1 and/or Option 2 to work?