LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Incomplete output when using Concatenate Strings function

Solved!
Go to solution

Hi everyone. I have a program that reads data from a compact DAQ system (cDAQ-9181, NI 9223 BNC) and writes it to a text file. I'm using the Concatenate Strings function to also add a header with column labels and a date/time stamp at the beginning of the text file.

 

The issue I've been running into is that when I run the program, sometimes the header shows (img1), and sometimes it doesn't (img2). I'm using the Array to Spreadsheet function for the data (img3 - the two inputs that are cropped out of the image are the date and time strings).

 

Since it displays correctly (...well, when it does display at all), I figure the formatting isn't an issue, but I've no clue for why it doesn't always get written to the text file. I'm still pretty new to using LabVIEW, so any and all insight to what the problem is or how I can debug is appreciated.

 

Additionally, this is my first time posting here, so if any additional information is needed, just let me know. Thanks!

Download All
0 Kudos
Message 1 of 5
(2,594 Views)

Can you post the actual VI instead of an image of code?  We can't tell what wiring you're actually using.  Plus any other mistakes that might lead up to this.

 

For instance, the text input there appears to go to the top, which is the "Prompt" input and not the "text" input.  And there's a wire that we can't tell if it's wired behind the node or into and out of the node, etc.

0 Kudos
Message 2 of 5
(2,586 Views)

@Kyle97330 wrote:

Can you post the actual VI instead of an image of code?  We can't tell what wiring you're actually using.  Plus any other mistakes that might lead up to this.

 

For instance, the text input there appears to go to the top, which is the "Prompt" input and not the "text" input.  And there's a wire that we can't tell if it's wired behind the node or into and out of the node, etc.


Sure thing.

Also, for some context - I pretty much took the Finite Input.vi from the Help examples and added onto it the stuff to write to a text file.

0 Kudos
Message 3 of 5
(2,578 Views)
Solution
Accepted by topic author sagunsm

Hi sagunsm,

 

I hope you don't use the same file path for the WriteSpreadsheetFile function as you use for your own WriteTextFile function call: in this special case you would create a race condition.

 

Such race conditions can lead to problems like yours…

 

I'm not a friend of huge ConcatString functions. Most often you can solve that easier:

check.png

For the string constant:

  • make the display style indicator visible!
  • switch it to "\-Codes" to be able to input tabs, CR, and LF…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(2,567 Views)

Hi GerdW,

 

You're right. It turns out that I've been writing a text file with both the Write To Spreadsheet and Write to Text File functions at different points in the program -- can't believe I missed that! I've simply removed the Write To Spreadsheet block, and now the program works to my liking.

 

I like your suggestion for how to display the text header as well. I'll have to try it out. Thank you!

0 Kudos
Message 5 of 5
(2,549 Views)