cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced Capstone Exercise 1.3

Aryan01
New Contributor II

I am stuck at this exercise and I don't know what I did wrong. when I run testSection[`exercise1], it fails for 1.3 and says "check if all values are correct". When I run the test function, it gives the following error message:

2 of 2 tests failed

Failed Tests : 2
feature .f1.createLapTable
should Each Sensor Should Have Start Time From Lap Table
expect (AdvancedCapstone.Functions.test/.f1.createLapTable.quke:6)
Expect Error: type
should Each Sensor Should Have End Time From Lap Table
expect (AdvancedCapstone.Functions.test/.f1.createLapTable.quke:9)
Expect Error: type
 
Also, am I supposed to run the function on the scratchpad before using testsection? If so, then do I run it with the entire event and sensor tables?
 
For reference, here is my code:
Spoiler

.f1.createLapTable:{[eventTab;sensorTab]

    distinctSensors: distinct select sensorId from sensorTab;

    crosspdt:(select from eventTab) cross distinctSensors;

    windows:(crosspdt[`time];crosspdt[`endTime]);

    p:wj[windows;`date`sensorId`time;select from crosspdt;(select from sensorTab;(avg;`sensorValue))];

    delete date from p;

    }

Please help me with this query.
1 ACCEPTED SOLUTION

Laura
Community Manager Community Manager
Community Manager

Hi @Aryan01 

Your code is working, but your syntax has a mistake. You will need to double check your .f1.createLapTable function to ensure it is returning data.

I have updated your function below if you need help working out where the error is: 

Spoiler

.f1.createLapTable:{[eventTab;sensorTab]

distinctSensors: distinct select sensorId from sensorTab;

crosspdt:(select from eventTab) cross distinctSensors;

windows:(crosspdt[`time];crosspdt[`endTime]);

p:wj[windows;`date`sensorId`time;select from crosspdt;(select from sensorTab;(avg;`sensorValue))];

delete date from p

}

You can test your function with smaller subsets of the data, and in the next part of section 1 you are asked to use the function to a specific date from the tables. 

Hope this helps,

Laura

View solution in original post

3 REPLIES 3

Laura
Community Manager Community Manager
Community Manager

Hi @Aryan01 

Your code is working, but your syntax has a mistake. You will need to double check your .f1.createLapTable function to ensure it is returning data.

I have updated your function below if you need help working out where the error is: 

Spoiler

.f1.createLapTable:{[eventTab;sensorTab]

distinctSensors: distinct select sensorId from sensorTab;

crosspdt:(select from eventTab) cross distinctSensors;

windows:(crosspdt[`time];crosspdt[`endTime]);

p:wj[windows;`date`sensorId`time;select from crosspdt;(select from sensorTab;(avg;`sensorValue))];

delete date from p

}

You can test your function with smaller subsets of the data, and in the next part of section 1 you are asked to use the function to a specific date from the tables. 

Hope this helps,

Laura

Aryan01
New Contributor II

Oh it was such a silly little mistake! I am used to coding in C++ and hence have a habit of putting a semicolon after every line of code. I have been scratching my head on this for a while and as soon as I removed the accidental semicolon, it passed the test. Thanks!

Laura
Community Manager Community Manager
Community Manager

An easy mistake to make! 

Great to hear it passed, good luck with the rest of the course 😀

Laura