LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write .Csv report

Solved!
Go to solution

Hello Guys, i have a issue

 

i'm creating a report file on .csv using the "write delimited spreadsheet" it works good but i want to create multiple reports with diferente name

 

Example 

Test report 1 

test report 2

 

saved on the same folder

 

but right now i can save the information on the same file but with the new information

 

if someone can help me with this, i'll appreciate it 

 

 

0 Kudos
Message 1 of 4
(248 Views)

You can use Check if File or Folder Exists VI to decide if you want to increase the index of the file name.

You can also generate the file name using date and time. This will prevent any possible duplication. Creating File Names Programmatically Using LabVIEW

-------------------------------------------------------
Control Lead | Intelline Inc
Message 2 of 4
(231 Views)
Solution
Accepted by topic author Ignacio564

@Ignacio564 wrote:

Hello Guys, i have a issue

 

i'm creating a report file on .csv using the "write delimited spreadsheet" it works good but i want to create multiple reports with diferente name

 

Example 

Test report 1 

test report 2


 

In 'File IO' -> 'Advanced File Functions' there is a VI which helps you with this: 'Create File with Incrementing Suffix.vi'.

See: https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/utility/file-llb/create-file-with-i... 

Message 3 of 4
(201 Views)

First, remove the Sequence structure (you will almost never need it until you start writing LabVIEW code to run on an FPGA), and connect your two Write Delimited Spreadsheet functions with the Error Line (Error Line In on the lower left corner, Error Line Out on the lower right corner).  Keep the Error Line (and other wires) as straight and running left-to-right as you can.

 

Second, to create files with different names, specify different names each time you write the file.  One way to do this is to create the File Name using an incrementing integer (like the index of a For or While loop), passing it as the numeric input to a Format Into String function (found on the String Palette) having a Format String (a String constant you put there) containing the string "D:\datafile %d.csv" without the quotation marks, and which you pass through a "String to Path" function (found on the Files palette, possibly in Advanced functions).  The basic idea is if you want a different name for your File, you need to create the different name, yourself (with LabVIEW's help, such as the auto-incrementing feature that they also provide and that others have suggested).

 

Bob Schor

0 Kudos
Message 4 of 4
(191 Views)