Hi,
Is it good practice to declare a variable inside a column formula? Or does this create risk of errors? My formula works well, but I'm concerned that it might be unreliable.
rownum = Row();
If( :Measurement type == "STUDY_VARIABLE",
:Control means[Min(
Current Data Table() << get rows where( :Measurement type == "STUDY_CONTROL" & :Control group == :Control group[rownum] )
)],
:Control means
);
The setup is as follows:
- :Measurement type is a column which labels each row as either STUDY_CONTROL or STUDY_VARIABLE
- :Control group is a column which uses a label (just a letter) to associate rows which are STUDY_VARIABLES with the appropriate mean (:Control means) of the relevant STUDY_CONTROL rows
- :Control group[Row()] didn't work, so I specified the rownum variable up front
Is this an elegant solution or a dangerous hack?
As a second question, the editor warns me that it's dangerous to use Current Data Table() in a formula - is there a better alternative?
Many thanks for any assistance - this is my first question!
David