Add multiple outputs to one line in a csv file

Hi there,

I am searching for a solution for the following problem:

I am doing a time tracking for my worktimes with Zone Enter and Zone Leave.

As you can see I am writing the weekday, the date and the time of entry in a join node. There I am waiting for the leave time, the lunch break time and the overall working time. When I have six values I am writing the csv file.

My problem is: When I am redeploying in Node-RED the whole flow fails because its not getting the six values.

My idea: Writing the first three values in the file, adding the second three values and then do a line break.

What do you think?

Is my idea possible or is the whole construct not good?

Thank you!

Greets
Daniel

CODE:

[{"id":"de5760de19276ada","type":"file","z":"aeb20ff2.63de98","name":"","filename":"/share/Test.csv","filenameType":"str","appendNewline":false,"createDir":false,"overwriteFile":"false","encoding":"none","x":1540,"y":280,"wires":[[]]}]

It seems that you are trying to use a simple file as a database. While this is not impossible, the processing is likely to get a little complex.

First thing to ask though is how big the dataset is? This has a direct impact on how you need to process it.

If it is small enough to fit into memory, I would likely recommend that you use a retained context variable rather than a file. The effect is similar - you would still have a file if you use Node-RED's built-in file-based context store but much of the detail around reading and writing of the file is taken care of for you. With everything in a retained context variable, you can simply treat it as a JavaScript variable which means that you can have record creation separate to record updates.

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