Hi all
In my HDB process, I selected some record and store in a in memory table and then trying to insert a new row at the end. It complaint “cast” error about that
But if I do the samething at RealTime DB, it work fine, will anyone know how to fix that?
Thanks.
Hi Carfield,
When you select data from an HDB containing symbol type columns, the symbol columns will still be enumerated ie. the column will have type >= 20h
q)/ trades is test data from a typical trades table in an HDB
q)f:1 sublist select from trades where date=2017.01.02
q)f
date sym time src price size
2017.01.02 ABB 2017.01.02D08:00:06.931000000 O 30.45 693
q)type exec sym from f
20h
q)/ `sym$syms is the format for an enumerated list
q)exec sym from f
sym$,
ABB
In order to add to the table defined above, you have to un-enumerate the column. You can do this like:
q)/ extract a symbol list and update sym to this un-enumerated list
q)update sym:(exec sym from select value sym from f) from `f
q)type exec sym from f
11h
q)f upsert (2017.01.02;FFF;.z.p;
O;30.46;700)
date sym time src price size
2017.01.02 ABB 2017.01.02D08:00:06.931000000 O 30.45 693
2017.01.02 FFF 2017.03.08D10:32:51.863067000 O 30.46 700
q)
You can also do it like this:
q)@[`f;exec c from (meta f) where t=“s”;value]
`f
q)type exec sym from f
11h
Hope this helps,
Aidan
Thanks a lot Aidan, it help