Sir ,I want to copy 2 in my sql DB

So your query is using the message properties and msg.id1. But we have spent the whole of today getting to the point where msg.payload.Fob_Tag_ID contains the fob and msg.payload.Trade_ID contains the trade id.

Can you see how to change your code?

thank you and sorry for my silly mistake i removed that and getting the three output correctly.

but sir one query is ,if i am entering for case 3:
Fob id :000000000(wrong id)
Tag id : 2814(correct id)
then why it is updating me a case 2 Sql query????? this is not correct?please suggest

Again, how can I possibly suggest anything as I am not sat in front of your flow?

Can you explain what you mean in terms of all the work we have done?

In the scenario you are asking about, which of the three outputs of the Function node is the message passing? What does that message look like exactly?

At this point, you really should be in a position to debug these things yourself. We've have spent so much time stepping through the logic in your flow and building it up step by step.

Use Debug nodes to understand where messages are going in your flow. Figure it out.

Yes sir , like as i am entering 00000000(wrong id) and 2814 (right id) ,then in output of my 2 function node is coming .it should not come because user has entered first id wrong ,in this case no updation would be there (whether first id or second id wrong then no updation )

this is for when i am in case 3 and entering one wrong id and right id

Ah okay. That makes sense.

At the moment, your flow checks the Tag/Trade are valid values and only passes them to the Join node if they are valid.

The problem with that approach is exactly what you are seeing: if it is scenario 3 (tag & trade provided) but either one of them is invalid, then the Join node will pass on a message with only the valid value - so the Function node thinks it is case 1 or case 2.

There are a few ways you could fix it. One way would be, earlier in the flow, when you identify it is an invalid value, then set it to something like INVALID, but still pass it on to the Join node. That means you will be sure to get "complete" messages in all three cases. You would then add some additional logic in the Function node after the Join node to check to see if the value is valid or not.

Something like:

var hasTag = msg.payload.hasOwnProperty("Fob_Tag_ID") && msg.payload.Fob_Tag_ID !== "INVALID";
var hasTrade = msg.payload.hasOwnProperty("Trade_ID") && msg.payload.Trade_ID !== "INVALID";
1 Like

Sir all you said i got that but this line can u please elaborate please

like this i tried ..

please suggest


like this i have done acc to what you suggest ,litlle bit not getting the correct output,please suggest.

Once again, how can I help if you don't say what is wrong? You say you don't get the correct output, but you don't say what output you get. You have shared a screenshot of some Change nodes, but no information on how you have configured them.

At a glance, I can see you are using msg.payload1 in the Function code. Where has that come from?

Sir ,I want to add a refresh button in ui dashboard for this project ,by this button user can get the recent updated database .and further i want to get this updated data back to mqtt sub node with come string lets say "database successfully updated" on subscriber side .How can i implement this .
I am arising this query here because I dont want to explain my project from any new person ,so that he also dont get in trouble and he can understand my flow easily.

Hi @shipra

I am not building this application for you.

You have described what you'd like to happen. Break that down in to a series of steps, like we did before. Then think about how to solve each step in turn. You should be able to make some progress based on what you've learnt so far. But to repeat, I am not building this for you.

No sir i dont want to repeat too, what i want is in my DB browser software i have to click that refresh symbol each time and then i am able to see the updated value can i change this by any method via node red,
Secondly i am designing a ui for this where user get the option to click the button and he can see this message" DB refreshed successfully" and for testing purpose i can check that in my DB side too .

You realise that clicking the button in the database browser just tells the browser to go and read the database again and update its display.

@shipra, I have just realised that you have started discussing this on two threads.
Please do not discuss this further on this thread as it is nothing to do with the original question.
The other thread is How to refresh my sqlite 3 database through node red

ok Sorry Sir.

Sir ,one query is there,as of now we dont have fire sensor in our project we are taking a pub node(FIRE topic) and if i got a string at that pub node a fire events generated and all the rfid scanning process should get stopped and "ALL door open" string should be inserted in my db. Could you please tell how can do this .

No. I won't tell you how to do it.

You have all the information you need to put it together yourself.

Have a go and see where you get to.

If you get stuck and need to ask, then make sure you provide enough information about what you have done.

Ok Sir thanks for the motivation I will try and then if i get stuck I will ask .
thank You sir

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