I do not know in advance the exact number of columns. But it is always separated by ; and there is always an = even when there is nothing. Also there are a combination of symbols, float,..
q)t,'((!/)"S=;"0:)@/:t`b a b aa ab ac ad ----------------------------------------------- 1 “aa=45;ab=c;ac=37;ad=56” “45” ,“c” “37” “56” 2 “aa=5;ab=cdd;ac=;ad=6” ,“5” “cdd” “” ,“6”
It is hard to easily produce a robust method to handle the final types with this case. You could look into the csvguess function. The actual breaking up of the data can be achieved by the data column as the key value pairs they are
q)delete b from t,'{(!) . "S=;" 0: x} each tba aa ab ac ad----------------------1 “45” ,“c” “37” "56"2 ,“5” “cdd” “” ,“6”`
Breaking that up
tb is indexing into the columnq)tb"aa=45;ab=c;ac=37;ad=56""aa=5;ab=cdd;ac=;ad=6"
Then we can use the 0: overload from key value pairs, casting the keys to symbols
q) "S=;" 0: "aa=45;ab=c;ac=37;ad=56"aa ab ac ad"45" ,"c" "37" "56"
After that, we can create a dictionary from that result, where the keys are the first vector and values are the last. That’s done by wrapping (!) and applying with dot product. This is because I’m lazy and don’t want to create variables in my lambda
Applying this routine to each row from the table, with each , which also will promote the dictionary into a table. This is because each will cause the output to be a list, and a list of dictionaries is a table. The final join to concatenate the columns is done with each-both