Two different SQLite3 Databases in one flow

Hello NodeRed Team,

I have two different sqlite3 databases in one flow. I want to select one value, each from those different databases, and compare. Unfortunately, when I change the path in one database, the other automatically gets changed as per the modified one.

How can I resolve this issue?

Instead of editing the config - add a 2nd config.


Thank you very much. Now that I could pass select queries, how I can compare both the outputs and create an output that I can write to a S7 data block? I am using JOIN but cannot find a solution for that.

what comes out of the join? (add a debug)

tip, use a function node & if statements to compare the 2 values

See also Writing Functions : Node-RED

The output of both the databases are attached in the snapshot. I am trying to join them manually to create an Array. Doesn't work. I think I am doing some mistake.

I dont see any output from your join (you didnt set the count).

A better solution...

  1. add a change node AFTER the TOP orange DB node & set msg.topic to "data1"
  2. add a change node AFTER the BOTTOM orange DB node & set msg.topic to "data2"
  3. Change the join node to create "key/val object" and enter 2 in the count

THEN operate the 2 querys and you should see something usable come out of the join node

Rather than using a Join node (which will work if you configure it correctly), connect them in series. Feed an inject node into the first db, then feed the result into a Change node which Moves msg.payload into a message property, msg.db1Results for example. Then feed that into the second db node . The output will then contain the second results in msg.payload and the original results should still be in msg.db1Results.

Thank so.

Sorry for asking you this basic question again. After joining data 1 and data 2, I got this. How can I put the values in the compare function?

Thank you. Will try this one. :slight_smile:

I am afraid you really need to do some learning.

If you read the link i posted...

you would see your error (clue - missing parenthesis)

Additionally, where do you think object.data1 comes from? Read this to learn how to use the debug panel to find the right path to any data item: Working with messages : Node-RED

Recommended Learning...

I also recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Then do some basic online JavaScript training.

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