Sqlite query not working with mustache query

I am using a template node to execute a query in sqlite using the msg.topic.
My query is:

select * from rfidtaglist where id={{payload.id}};

On the debug i can see that in the query paylaod.id is replaced by an integer while it shoud be string.
If i execute the query:

select * from rfidtaglist where id='2';

I do get a value back. How to force string inside using mustache?

hmm .. you could pass it from a Change node and make it to a string with a Jsonata Expression

image

But do you really need to ?

Cant you simply surround the numeric value with single quotes in the Template node directly ?

select * from rfidtaglist where id='{{payload.id}}';

sqlite should consider it as string

Hummm. second option works fine.I'tried it before without success, maybe i was having a typo error. Many thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.