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?
A database would be the easiest option, I would try mysql or sqlite.
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?
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?
That is something we can ask you, not something you can ask us.
If the date stored is less than the current date, the values related os this date (time and name) can be discarded
Yeah, its possible, just need to learn how to add the values.
You haven't said how many there are likely to be or whether the data has to be retained over restart.
Have a way to get the current date in my flow?
One way, using a change node:
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.
let now = Date.now()
to get the time.
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();