KX Community

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

Home Forums KX Academy Fundamentals Capstone ex 2.2

  • Fundamentals Capstone ex 2.2

    Posted by terryp on December 27, 2023 at 12:00 am

    I literally do not know why it keeps sending me types mismatch error. Is there any reference link about what types mismatch error means. have been encountering types errors every time, but every time the issue came from different contexts which are a bit frustrating.

    terryp replied 2 months ago 2 Members · 1 Reply
  • 1 Reply
  • laura

    Administrator
    December 28, 2023 at 12:00 am

    Hi  when I try to run your function I get a error “brokerID” not a types mismatch. Here’s a few things I noticed:
    brokerID should be brokerId on the last line of function

    if is incorrect here:

    • if function checks is statement true: then executes all subsequent statements if true.
    • if the statement is false: do not evaluate the subsequent statements and continue to the next q expression.
    • It seems you are trying to do if-else here – have a look at conditional evaluation using $

    – question asks for result to be returned in type long – not string (need to cast here)

    – colon in wrong place on the last line

    I would recommend the Fundamentals courses to learn the basics on Execution Control – using if and if-else

     

    extractBrokerId:{[exMsg] parts: “-” vs exMsg; exch: parts 0; $[exch like “CME*”; brokerId:parts 2; brokerId: parts 1]; :”J”$brokerId}

Log in to reply.