Saving informations

#1

I need to save some inputs of a user, its date, a name, start time and finish time. But don't know where to store. Is it a good idea to make a vector for each variable? This vector must grow each time that I put the information that I need. Or I need to create a table and add the variables in the rows?

0 Likes

#2

A database would be the easiest option, I would try mysql or sqlite.

0 Likes

#3

I created my entire project from an app of blue mix (IBM) and already have a DB there on blue mix, and already made the integration with the nodes. Can I use this DB?

0 Likes

#4

A couple of questions.
Is this set of data going to grow forever or can you say it will never be more entries than some number - maybe 10, or maybe 10 million.
Does it need to be remembered over reboot/node red restart etc?

0 Likes

#5

That is something we can ask you, not something you can ask us.

0 Likes

#6

If the date stored is less than the current date, the values related os this date (time and name) can be discarded

0 Likes

#7

Yeah, its possible, just need to learn how to add the values.

0 Likes

#8

You haven't said how many there are likely to be or whether the data has to be retained over restart.

0 Likes

#10

Have a way to get the current date in my flow?

0 Likes

#11

One way, using a change node:
Screenshot%20at%202018-08-29%2022-42-23

0 Likes

#12

Also an Inject node will give you the current time if set to Timestamp mode. You can set this to regularly inject so you can get a message containing the time every minute, or second, or whatever you need.
Obviously if you are in a function node you can use the javascript function
let now = Date.now()
to get the time.

0 Likes

#13

Worked using the db, and made a simple code to add from there. Thnx. Next step is verify the date. I will make a variable that save the time, and next execute the code below, if date_saved < new date, and delete all the information of the db related from the old date.

var date = new Date(msg.payload);

msg.payload = date.toString();

return msg;

0 Likes