To make the column formula, you can use the if statement or the match statement; the match syntax is a little easier to read:
New Table( "example",
New Column( "DOW", character, Set Values( {"Mon", "Tue", "Wed", "Thu"} ) ),
New Column( "T-28", Set Values( [38, 35, 26, 28] ) ),
New Column( "T-21", Set Values( [45, 47, 43, 48] ) ),
New Column( "T-14", Set Values( [60, 65, 54, 65] ) ),
New Column( "T-13", Set Values( [63, 68, 62, 70] ) ),
New Column( "T-12", Set Values( [65, 78, 72, 72] ) ),
New Column( "T-11", Set Values( [70, 82, 72, 72] ) ),
New Column( "Conditional",
Formula(
Match( :DOW,
"Mon", :Name( "T-28" ),
"Tue", :Name( "T-21" ),
"Wed", :Name( "T-14" ),
"Thu", :Name( "T-13" ),
-9999 // else...use . for missing value
)
)
)
)
Because the column names contain hyphens (subtract) they need the name() wrapper.
With an if statement:
New Table( "example",
New Column( "DOW", character, Set Values( {"Mon", "Tue", "Wed", "Thu"} ) ),
New Column( "T-28", Set Values( [38, 35, 26, 28] ) ),
New Column( "T-21", Set Values( [45, 47, 43, 48] ) ),
New Column( "T-14", Set Values( [60, 65, 54, 65] ) ),
New Column( "T-13", Set Values( [63, 68, 62, 70] ) ),
New Column( "T-12", Set Values( [65, 78, 72, 72] ) ),
New Column( "T-11", Set Values( [70, 82, 72, 72] ) ),
New Column( "Conditional",
Formula(
if(
:DOW=="Mon", :Name( "T-28" ),
:DOW=="Tue", :Name( "T-21" ),
:DOW=="Wed", :Name( "T-14" ),
:DOW=="Thu", :Name( "T-13" ),
-9999 // else...use . for missing value
)
)
)
)
The else value handles unknown day names
JMP would really rather use . for a missing value instead of -9999; I used that for this demo so the effect would be clear.
You can also use the Formula Editor instead of JSL; click on the + beside the Conditional column in the data table's left hand panel (above) to see the formula editor (below):
The Formula Editor has a list of functions
If Secrets blog post
Craige