-
Transform Specific Column Values
Hello,
Assume that I have a table like;
prices:([]sym:`u#`$();price:`float$())
..and updating this table through the standard .u.upd function with the incoming data like;
data:((`$”AAPL.B*”;`$”AAPL^#”);(122.74;123.17))
Furthermore; I have loaded a CSV file of different symbology types mappings like;
IssueType CQS CMS NSDQ --------------------------------------------------------------- "Preferred Class "A"*" "pA" "PRA" "-A" "Preferred Class "B"*" "pB" "PRB" "-B" "Class "A"*" "/A" ,"A" ".A" "Class "B"*" "/B" ,"B" ".B" ... ...
Now; what I want to achieve is to transform the incoming data during .u.upd by;
- Suffixing the sym columns of the data
- Converting the sym columns of the data from NSDQ format to CQS format
I achieved the first requirement with such a function;
suffixData:{ symColmun:0; suffix:”.X”; x[symColmun]:.Q.fu[{`$string[x],suffix}each; x[symColmun]]; }
But when it comes to the second requirement, I couldn’t make it work yet. The pseudo-code on my mind is;
- For each row in the data sym column:
- SSR by pattern matching each row in the conversion table’s NSDQ column
- ..and replacing the matching characters by the corresponding CQS column
I’m also open to any suggestions to achieve this in a more optimized way.
Thanks in advance!
Log in to reply.