KX Community

Find answers, ask questions, and connect with our KX Community around the world.

Home Forums KX Academy Advanced Capstone 1.3 test fail.

  • Advanced Capstone 1.3 test fail.

    Posted by kenan_davidsonyahoo-com on April 4, 2024 at 12:19 pm

    I don’t understand why my 1.3 test is failing. Please find a copy of my code and a picture of my test results attached.

    Thanks.

    .f1.createLapTable:{[eventInput;sensorInput]
    
    uniqueSensor: distinct select sensorId from sensorInput;
    
    rack:(select from eventInput) cross uniqueSensor;
    
    w:(rack[`time];rack[`endTime]);
    f:wj[w;`date`sensorId`time;rack;(select from sensor;(avg;`sensorValue))];
    f:select session, sensorId, lapId,time,endTime,sensorValue from f;
    f
    
    }
    kenan_davidsonyahoo-com replied 3 weeks, 1 day ago 2 Members · 3 Replies
  • 3 Replies
  • laura

    Administrator
    April 5, 2024 at 11:25 am

    Hi,

    Within your window join, you are selecting from sensor instead of the sensorInput parameter you’ve passed into the function. This could be what is creating incorrect values in your table.

    Hope this helps!

    Laura

  • kenan_davidsonyahoo-com

    Member
    April 5, 2024 at 11:26 pm

    I edited my wj to select the sensorInput but my code still fails the test.

    • kenan_davidsonyahoo-com

      Member
      April 7, 2024 at 1:23 am

      .f1.createLapTable:{[eventInput;sensorInput]

      uniqueSensor: distinct select sensorId from sensorInput;

      rack:(select from eventInput) cross uniqueSensor;

      w:(rack[time];rack[endTime]);

      f:wj[w;sensorIdtime;rack;(select from sensorInput;(avg;`sensorValue))];

      f:select date, session, sensorId, lapId,time,endTime,sensorValue from f;f

      }

      My lap count and schema.

Log in to reply.