cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced capstone

ab
New Contributor II

Can someone please help me with the 2.4 question.

**2.4. Augment ```.f1.checkSensor``` to check if the `mysensor` parameter has received one of
the acceptable options and do:**

@MicealMcc @Michaela 

1 ACCEPTED SOLUTION

Michaela
Community Manager Community Manager
Community Manager

Hi @ab  this looks great - just possibly one missing ; in your line defining benchmark - see end of second parameter

You have:

        benchmark: ?[lapTab;
                enlist(like;`sensorId;dict[mysensor])
                enlist[`sensorId]!enlist(`sensorId);
                enlist[`benchmarkValue]!enlist(avg;`sensorValue)];

versus

        benchmark: ?[lapTab;
                enlist(like;`sensorId;dict[mysensor]);
                enlist[`sensorId]!enlist(`sensorId);
                enlist[`benchmarkValue]!enlist(avg;`sensorValue)];

 

View solution in original post

4 REPLIES 4

Michaela
Community Manager Community Manager
Community Manager

Hi @ab what problem / error are you seeing? I can better advise if you explain what you have tried or add a code snippet and some screenshots of any errors.

ab
New Contributor II

.f1.checkSensor:{[raceTab;lapTab;mysensor]dict:`temp`tyre`wind`all!("temp*";"tyre*";"wind*";"*e*");if[0b=mysensor in dict;.Q.trp[{ `$(mysensor)," is not a valid option for mysensor - valid options include `temp`tyre`wind`all" }]];benchmark: ?[lapTab;enlist(like;`sensorId;dict[mysensor])enlist[`sensorId]!enlist(`sensorId);enlist[`benchmarkValue]!enlist(avg;`sensorValue)];chk: ?[raceTab;enlist(like;`sensorId;dict[mysensor]);enlist[`sensorId]!enlist(`sensorId);`avgValue`stdDevValue!((avg;`sensorValue);(dev;`sensorValue))];chk: update diffValue:"F"$.Q.f'[5;abs[benchmarkValue-avgValue]] from benchmark lj chk;chk: update diffFlag:?[(diffValue>1);0b;1b], stdFlag:?[(stdDevValue>1.5);0b;1b] from chk;chk}

 

This is what I have done. Just added if and .Q.trp function to the 2.3 function.

Michaela
Community Manager Community Manager
Community Manager

Hi @ab  this looks great - just possibly one missing ; in your line defining benchmark - see end of second parameter

You have:

        benchmark: ?[lapTab;
                enlist(like;`sensorId;dict[mysensor])
                enlist[`sensorId]!enlist(`sensorId);
                enlist[`benchmarkValue]!enlist(avg;`sensorValue)];

versus

        benchmark: ?[lapTab;
                enlist(like;`sensorId;dict[mysensor]);
                enlist[`sensorId]!enlist(`sensorId);
                enlist[`benchmarkValue]!enlist(avg;`sensorValue)];

 

jontron123
New Contributor

Did your logic for input validation work? i.e temperature throws error? I am struggling with the logic