I am trying to convert a Boolean col in hdb to string and change its values to something else simultaneously. I used fncol with vector conditional but that changed the col type to char instead of array of chars. What is the best way to go about it?
fncol [hdbPath;tableName;colName;{?(x=0b;"Y";"N")}]
Lots of possible way to do it. You just need to ensure that each char is enlisted so it is type 10h
q){n:count x;?[x=0b;n#enlist"Y";n#enlist"N"]}001b
,"Y"
,"Y"
,"N"
Or:
q){enlist each ?[x=0b;"Y";"N"]}001b
,"Y"
,"Y"
,"N"
Dictionary lookup:
q){(01b!enlist each "YN") x}001b
,"Y"
,"Y"
,"N"
Use the fact that booleans index:
q){(enlist each "YN") x}001b
,"Y"
,"Y"
,"N"