How to calculate 2 msg.id coming from 2 pub different topics simulataneously

Sir,Good morning
I want to check 2 msg.id is simultaneously coming from 2 different pub topics and then i want to catch CR_SUCCESS from one Sub topic if both that msg.id is present in my database.

Hi @shipra

before you can compare the two values you'll need to get them into a single message.

There is a recipe for joining separate streams of messages together in the cookbook - https://cookbook.nodered.org/basic/join-streams

That recipe shows how to join separate messages together, but it does assume the value you want to combine is in msg.payload. So you may need to use a Change node to move the value of msg.id to msg.payload before passing to the Join node.

Sir, Actually i am taking 2 input from user
1:Person ID )FOB MQTT node
2:Trade ID )TRADE MQTT node
Scenario
I am taking both person id as well as trade id from that person,i want to check both inout from database simultaneously ,if both are present then only print CR_SUCCESS in MATCH(Sub node MQTT)
how to do this?

Things already done successfully in node red
FOB node done with DB
TRADE Node done with DB
Now stucking with case 3 i.e checking both FOB and TRADE together with DB

That sounds like a SQL thing rather than Node-RED.

Maybe something like:

SELECT * FROM mytable WHERE person_id <> "" AND trade_id <> "";

?

Ok ,Sir one query is there that Both MQTT pub Nodes is storing value in msg.payload so in sql how can i write person is<>"msg.payload" cand trade_id<>" msg.payload"
both msg.payload then takes 1 value only 

I think we may be missing a load of information.

You are "taking the values from the user" - how are you doing this? Is it a single form? Are you collecting both values from the form at the same time? Or are you using separate inputs?

Also, if you are taking values from the user, why send them to MQTT only to have to use them in Node-RED again?

For 3rd case that is ,for checking both FOB ID as well as TAD ID from DB,in my gateway code after taking both inputs from user ,i am publishing those values in their respective mqtt pub nodes .
So now i have to check for my 3rd Case ,if both ID's are present in DB then Print CR_SUCCESS in SUB node (MATCH NODE).

var w1=msg.payload
if(w1.length==8)
{
    var payload1=w1;
}
if(w1.length==4)
{
  var payload2=w1;
}

let newMsg1 = {};
newMsg1.topic =`SELECT * FROM NCS_DATABASE3 WHERE FOB_TAG_ID ='${payload1}' AND TRADE_ID='${payload2}'`;
return newMsg1;



 

i

please tell the procedure.