kdbq

Concat string with number in kdb+ q


I can append a string with number.

temp:30
text:"Current temperature is ",string temp
show text
type text

Result

"Current temperature is 30"
10h

However, if I append one more string, it becomes a list. (why?)

text:"Current temperature is ",string temp," degree celsius"
show text
type text

Result

C
u
r
r
e
n
t
 
t
e
m
p
e
r
a
t
u
r
e
 
i
s
..
0h

I can use sv with empty string as delimiter, is it the normal way to do it?

text:"" sv ("Current temperature is ";string temp;" degree celsius")

Solution

  • You should change it to

    text:"Current temperature is ",string [temp]," degree celsius"
    

    Your string function is working on: temp," degree celsius" but you just need to string[temp] to concat it.