Fundamental Capstone Exercise 2.3 Mismatched Type

https://learninghub.kx.com/forums/topic/fundamental-capstone-exercise-2-3-mismatched-type

Hi, 

I've been struck in this part for a while, even after checking my previous steps (loading messages table and setting up extractBrokerId function).  


This is my command line to update the broker_id in the messages table: 

messages: update broker_id: .fp.extractBrokerId each exch_message from messages;

However, it doesn't returned the broker_id column. 


There might be one of the two problems I'm suspecting, if I didn't miss something: 1) the input exch_message is not string. This is how I load my messages table to get both trade_id and exch_message into string corresponding to the expected table in the hint:

messages: ("cS"; enlist ",") 0: hsym `$csvPath

I've also tried using "CC" or "SS" or ''Js" in both upper and lowercases, but it only output the trade_id and left the exch_message column empty. In the cases where the returned messages table looked good, I oftentimes received the mismatched typed error when running the update line above.


2) The extractBrokerId function passed test 2.1. Its return didn't show the output value but the type: 

.fp.extractBrokerId:{[msg]

parts: "-" vs msg;

($[parts[0] = "CME";

last parts;

parts 1]$)long

}

// output: long, when manually test out the string message


I would appreciate any help to guide me through this issue. 

Hi @cathylll ,

I think you're right in that the issue you're having may be coming from the types in your messages table. 

For a string column, you should use *

e.g. 

messages:("**";enlist csv) 0:hsym `$csvPath

You can read more about loading data here:  11. I/O - Q for Mortals

Hope that helps,

Laura

Hi @laura,


Thank you for pointing it out! However, the broker_id remained empty after running the function over exch_message. I wonder if my extractBrokerId function works. It returned "long" as shown in the comment when I input the message manually.