Select and insert in same function

Hi all,
I am struggling and not been able to find a solution for following problem:
I get a message (from mqtt - not sure how relevant is) which can be 0 or 1 , and I want to check if is already in the table before insert it. Basically if last inserted value is1 and message is 1 then do nothing, else insert it. I am able to do operations separately but I am not able to combine these operations in one single function....
Thank you in advance !

What 'table' are you talking about? Is it a database? a file? a ui_table?

A little more information would be helpful

I have table with 3 rows (mysql), (id, status, time). Periodically i receive a status message which can be 0 or 1. I don t want to fill in the table with 1 (one after another) if i have 100 times status 1, i just want to do the status insert only if status received is different from last inserted value.

Could you use an RBE node before the insert to filter out all duplicate status ? Depends if you want to update or insert. I think mysql does also support upsert syntax if needed.

Mysql has an if statement so you should be able to do it in one query

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