Advanced capstone project exercise 2.4

https://learninghub.kx.com/forums/topic/advanced-capstone-project-exercise-2-4

Hi there,

Im currently working on ex 2.4 for Advanced Capstone, however i was failed to get this exercise to pass

I got every exercised passed instead of this one 

quizItem success description error
------------------------------------------------------------------------------------------------------------------------------------------------------------------
exercise2.1 Pass "check if race day in process" ""
exercise2.1 Pass "have correct schema" ""
exercise2.2 Pass "check if lap table in process" ""
exercise2.2 Pass "only contains data for 2nd Jan 2020" ""
exercise2.2 Pass "contain all columns for 2nd Jan 2020" ""
exercise2.3 Pass "not allowed to use select keyword" ""
exercise2.3 Pass "return correct values for temp" ""
exercise2.3 Pass "return correct values for wind" ""
exercise2.3 Pass "return correct values for all" ""
exercise2.4 Fail "when given the wrong option return error \" is not a valid option for mysensor - valid options include `temp`tyre`wind`all\"" ""
exercise2.5 Pass "func should return same result as before" ""
exercise2.5 Pass "`p attribute exists" "" 


I couldnt find where is error causing, as i saw the result of error message is returning as expected. Please see the screenshot below for the .f1.checkSensor


my code for error trapping 
if[0b=mysensor in key this_dict; .Q.trp['string[mySensor]," is not a valid option for mysensor - valid options include `temp`tyre`wind`all"]]; 


To run:

.f1.checkSensor[raceDay;lapTable;`temperature] // should error


Result return:

"temperature is not a valid option for mysensor - valid options include `temp`tyre`wind`all"


Can you paste your code for this question here please? Looks good at a glance so could be something small that needs tweaking

{[raceTab;lapTab;mySensor]

// Get avg benchmark values from historical lap data // THESE

this_dict: `temp`tyre`wind`all!("temp*";"tyre*";"wind*";"[a-z]*");

if [0b=mySensor in key this_dict;.Q.trp['string [mySensor], " is not a valid option for mysensor - valid options include `temp `tyre `wind `all"]];

if[not mySensor in key[this_dict];'string[mySensor]," is not a valid option for mysensor - valid options include `temp`tyre`wind`all"];

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

chk:?[raceTab;();(enlist `sensorId)!enlist `sensorId;`avgValue`stdDevValue!((avg;`sensorValue);(dev;`sensorValue))] ;

chk:![lj[benchmark;chk];();0b;(enlist `diffValue)!enlist ($;"F";(.Q.f';5;(abs;(-;`benchmarkValue;`avgValue))))] ;

chk:![chk;();0b;`diffFlag`stdFlag!((?;(>;`diffValue;1);0b;1b);(?;(>;`stdDevValue;1.5);0b;1b))];

chk:?[chk;enlist(like;`sensorId;this_dict[mySensor]);0b;()];

chk

}

Replied in DM

it works now, thank you very much