Edge MC: Node-Red

I am using the Tulip Table Node to retrieve table records for use outside of Tulip and I am not using an application for this. The table contains > 18K records and grows daily. With the limitations of Tulip (100 records at a time), the process to retrieve the table records takes almost 2 minutes. How can I filter on created or updated >= current date? Is it possible to execute a saved query on the target table from Node-Red? What options might I be missing?

hello @shannon.stevenson, welcome to the Tulip community!! it would be great if you could introduce yourself at: Welcome to the Community, let's meet!!

and great to hear you’re using the Edge MC already. just to confirm, are you getting data through the Tables API?? if so, you can filter on specific columns, to only get the Records that match the date criteria you define to speed up the process.

you can add a Query Parameter to filter by a Datetime column in the Table:

as you can see above, the API call only returned the 3 Records that met the Filter criteria from the Table:

you can see more information from https://{{instance_name}}.tulip.co/apiDocs:

hope this helps, let me know if we misunderstood what you’d like to do!!

Possibly my question is not clear… Referencing your above answer, how can I add Filters.0.arg “date” as a variable = (current date) to the Tables Node?

Hi Shannon,

If you’d like to filter on the updated/created date, I would recommend adding an integer field with a timestamp field that you can then filter on with the greaterThan function. For example, if you create a field “Timestamp” with id “timestamp” and value set to an integer timestamp (for example, in ms), then in Node-RED you could leave the “Filters” field empty and set the filters instead through the message property filters as follows:

For example, you could have the following flow:

That injects a timestamp corresponding to the current day:

And then sets the filters as follows:

Which yields the following message going into the Tables node:
Screen Shot 2021-07-15 at 11.34.57 AM

(There are several variations to this depending on exactly what you want; for example, if you just want the last 24 hours of data, you can subtract 24 hours * 3600 seconds/hour * 1000 ms/second from the $now() timestamp.)

Is it possible to execute a saved query on the target table from Node-Red?

No, but you can read/list/update/delete table queries from Node-RED. If you’d like to query a table, this is done through a List Records query, as you’re already doing.

Let me know if this answers your questions!


1 Like