Opcua client sqlite not working

Hello,

I am currently working on creating a datalogger using OPCUA. For some reason, I'm unable to get the msg.payload into the sqlite, because it's saying that the payload is undefined. Could anyone help with this Issue?
*


*
Thank you for your time.

Welcome to the forum @nathan1

It is saying that you are trying to access column named undefined. Use a debug node to see what is coming out of the write query function so that you can check what you are actually sending to the database.

Hi @Colin,
This is what I'm seeing:


This is my first time using Node-Red, I'm still a newbie.
Thank you,
Nathan

Here's the writequery function:
image

msg.topic should be a string containing the query. Possibly something like
msg.topic = "INSERT INTO RANDOMNUM VALUES (" + x + ")"
Though I find it much easier to use this syntax for making complex strings

msg.topic = `INSERT INTO RANDOMNUM VALUES ( ${x} )`

Also make debug 3 output Complete Message so you can more easily see what is in the topic.
In addition I recommend adding another debug node showing what is going into the function to check that what you expect is there.

Hi Colin,
It seems that it's getting NULL into the writequery function. I'm not sure why since Debug3 is getting the correct message.

I moved it up to the first output and it seems to be giving an output now. However, the query is still empty.

Your function is not connected to the sqlite node.

Thank you it works now. I have another question with read multiple. Is there a way to put the payload values in 1 array?

Is this a question about opcua or sqlite? If it is an opcua question it might be better to start a new thread. I have never used opcua.

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