# Add multiple outputs to one line in a csv file

**URL:** <https://discourse.nodered.org/t/add-multiple-outputs-to-one-line-in-a-csv-file/76834>\
**Category:** General\
**Created:** [22 March 2023 17:32 UTC](https://discourse.nodered.org/t/add-multiple-outputs-to-one-line-in-a-csv-file/76834 "2023-03-22T17:32:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cairon](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@cairon](https://discourse.nodered.org/u/cairon)\
**Post date:** [22 March 2023 17:32 UTC](https://discourse.nodered.org/t/add-multiple-outputs-to-one-line-in-a-csv-file/76834/1 "2023-03-22T17:32:44Z")

</div>

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.

 ![Bildschirmfoto 2023-03-22 um 18.27.13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/2/028b36ce4d7d665327382b679cc66658555b1fe5.jpeg)

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:

```auto
[{"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":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 March 2023 15:21 UTC](https://discourse.nodered.org/t/add-multiple-outputs-to-one-line-in-a-csv-file/76834/2 "2023-03-23T15:21:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 May 2023 15:21 UTC](https://discourse.nodered.org/t/add-multiple-outputs-to-one-line-in-a-csv-file/76834/3 "2023-05-22T15:21:41Z")

</div>

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