Create and download a CSV file

Hi to all,

I am trying to create a CSV file from a UI_Form present in the UI.
I have tryed and modify a lot of example find in the web and in the forum, but no one works like I think.
I'd like that there should be a "Download" button in the ui and when I have pressed the Send botton of the ui_form (so I have confirmed what I have written) then in any moment I can press the Download button and Create and Download a CSV file with inside the data that I have put in the ui_form.

The goal should be this :

  • Write some parameters in the ui_form (for example ten parameter) and press Send
  • Press the button "Download" that allows to create a CSV file with the ui_form parameter

Here there is another things that I don't understand...In all the example that I have seen, you need to specify the path for downlad the CSV file.
But I think that, well, Node-Red works on a browser like Chrome, Edge etc.. where from the installation of the latter there is already a specified path to download a file from the internet, that is for most of us the Download folder.
So, is there a method for take automatically the download path from the browser? I think that this should be very handy also for move a Flow from a PC to another.. you need only to copy and paste the flow and then it takes automatically from the browser that is in use the Download path.

Thanks to all!

Why do you want to make the user to have to press two buttons to actually send the data? Don't you realize that will lead to data never being added to the file? People will neglect to press the second button (human nature). I can see pressing the "Send" button and having a pop-up asking if they really want to add the data to the file, but not having two seperate buttons actions.

Or maybe I'm confused and you want the 'Send' button to actually write to the file on the server running NR and the 'Download' button to fetch the file from the NR server and store it on device running the dashboard.

Hi @zenofmud ,

Thanks for the reply.

No well the final project is another.
With the ui_form I put some data that with a already developed node will be modified and sent in OPCUA to a PLC.
The data that I put in the ui_form will create a way; for example this could be a compiled ui_form :

Start
Station 1
Station 2
....
End

So when I press the Send button I work with my flow and I send data to a PLC (that will move something).
At the end, I want that the operator could Download (with the button Download), if he want, the way that he has written.
Whit the CSV files downloaded, the operator can check all the route that he has done.

Ok, so you have a form that will have some data (doesn't matter what) and you will use it to create a row of values.

  1. will this row of data be added to the end of the CSV file or overwrite it each time or will there be a new file for each submit?
  2. will the download button be on the same page as the submit button?
  3. If the browser gets refreshed, how will you identify the datafile to be downloaded?

If you think that each 'way' will be in a seperate file, then you will need to read the directory the file is in and present it to the user to select the one they want downloaded.

You might want to look at this flow in the Flow library: Download a file from node-red using standard nodes. It might give you an idea of how you can download the file.

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