LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write to spreadsheet only if filename is different

Solved!
Go to solution

Dear all,

 

I am trying to write some codes but to no avail. Basically, i have a filename coming in at every time interval (say 2 sec). I have build a small array as an example.

 

The filenames in the array are repetitive and i do not want to write the data to the spreadsheet  if the filename is the same.

 

Bascially, i need to write the header and array only for 1st c:\1.txt file and subequent c:\1.txt data (3 more) i only want to write the array only (no header) and append it to spreadsheet.

 

That is to say for c:\1.txt file, it will consist of 1 header and 4 sets  of array.

 

Then the process repeats again till a newfilename (c:\2.txt) is encountered.

 

c:\2.txt will also consist of 1 header and 4 sets of data.

 

Can anyone help out on this?

 

 

 

 

 

Download All
0 Kudos
Message 1 of 6
(2,862 Views)
Add a shift register and check to see if it changed. See attached.
Tim
GHSP
0 Kudos
Message 2 of 6
(2,853 Views)

The shift register will only work if the last filename matches.  If you want to make sure it was not used before, you need to compare with all previous filenames that were used.

See code snippet below:

 

 

Message Edited by Ray.R on 04-15-2010 08:27 AM
0 Kudos
Message 3 of 6
(2,838 Views)

Dea

 

Dear all,

 

I have manage to get the results i want using shift register. I have manage to save the files properly. But i got one problem, during the last iteration loop, it prompts me with a window to save the file to a location.

 

Hopw can i get away of this prompting. Please help! Thank you!

0 Kudos
Message 4 of 6
(2,805 Views)

Dear all,

 

I have manage to get the results i want using shift register. I have manage to save the files properly. But i got one problem, during the last iteration loop, it prompts me with a window to save the file to a location.

 

Hopw can i get away of this prompting. Please help! Thank you!

 

Attach are the codes.

Download All
0 Kudos
Message 5 of 6
(2,802 Views)
Solution
Accepted by Joven
Your loop is allowing you to read past the end of the file names in your array. This passes an empty file name to the Write to Spreadsheet VI which causes it to prompt for the filename. You need to test for this condition.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 6
(2,782 Views)