I'm having what I'm sure is a simple issue with setting values in a column using the Choose function. Below is a test script along with a table showing desired output.
Names Default To Here( 1 );
startTime = 3742070400;
endTime = 3742074000;
dt = New Table( "Test",
Add Rows( 60 ),
New Column( "Timestamp", Format( "m/d/y h:m", 19 ), Set Display Width( 175 ) )
);
For Each Row( :Timestamp[] = Sequence( startTime, endTime, 60 ) );
aggOption = 1; // This will eventually be a pulldown menu with choices
New Column( "Agg Minute",
Numeric,
"Ordinal",
Format( "Best", 12 ),
Set Display Width( 116 )
);
// Script below is the problem. I tried For Each Row and Set Values and a combination
// of both but the column always is blank. See Interpolated Data table for what it
// should look like.
dt:"Agg Minute"n << For Each Row(
Choose( aggOption,
If(
Minute( :Timestamp ) < 15, 15,
Minute( :Timestamp ) < 30, 30,
Minute( :Timestamp ) < 45, 45,
0
),
If(
Minute( :Timestamp ) < 14, 0,
Minute( :Timestamp ) < 29, 15,
Minute( :Timestamp ) < 44, 30,
45
),
If(
0 < Minute( :Timestamp ) <= 15, 15,
15 < Minute( :Timestamp ) <= 30, 30,
30 < Minute( :Timestamp ) <= 45, 45,
0
)
)
);
Notice when you run the script the Agg Minute column is blank. I've tried Set Values and For Each Row and a combination of both but I can't seem to get it to work.
As always, any assistance is greatly appreciated.
Thanks.