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}