I have a table that has a column of type string with a max width of 4. I want to split that string up into four separate columns representing each character and then enumerate them so that queries against the table are faster. So for example,
t:(str:())
str
0 | "T "
1 | " FT"
2 | " C"
and I want
str | col1 | col2 | col3|
0 | "T " | T | | |
1 | " FT " | | F | T |
2 | " C" | | | C |
When I do something like
select col1: str[0], col2:str[1], col3:str[2] from t
output looks like
col1 | col2 | col3
0 | T | F |
1 | | T |
2 |
3 | | C
q)t:(str:(“T “;” FT”;" C"))
q)update col1: str[;0], col2:str[;1], col3:str[;2], col4:str[;3] from t
str col1 col2 col3 col4
--------------------------
"T " T
" FT" F T
" C" C
Actually I am having trouble casting this to a symbol. And I would like to enumerate these columns.
First of all, if I do
update col1: $str[;0], col2:
$str[;1], col3:$str[;2], col4:
$str[;3] from t
it ends up the entire columns for each row, can I just cast that column to a symbol?
I need to cast to a symbol because I want to enumerate it, I can’t quite figure out how to enumerate a column, I know that .Q.en enumerates the sym column but if I want to have another enum from these four columns combined how would I do that?