LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Text Issue

Solved!
Go to solution

Hello, I've attached all necessary pictures and VIs/Ctrls.

The issue: I'm trying to verify my Read/Write Text (which is writing errors in an XML format as well as a corresponding time stamp) right after I have written the error to the XML file.  What the code is doing is making sure the error is not an error I am allowing, then goes on to write the error to the XML.  There's a case structure that then handles a first time write.  The idea is to read the data back from the XML, then insert the new error into the array, and then write it back to the xml doc after flattening.  I understand the long term issues of this "solution."  So right now, please don't comment on that.  What's bugging me is that when I try to re-open and read the document, I can't seem to view ever element of the array even though the read/write function (which is doing essentially the exact same thing) can do it just fine.  I've circled the items.  The code is in 2011.  Be sure to insert text into the name for the document.  Run it a couple of times and I think you'll see what I'm driving at.  Anyone got an explanation for this?

 

Value Issue 1.JPG

Value Issue 2.JPG

0 Kudos
Message 1 of 7
(3,746 Views)

Where is this error coming from?

 

It is unusual in that it is a postive number which is usually reserved for warnings rather than errors.  Also, that it has no description whatsoever.  An explanation for error 500 is that it is undefined, so it is not LabVIEW sourcing this error.

0 Kudos
Message 2 of 7
(3,732 Views)

The error itself is nothing more than an example just to trigger the error case.  Not an actual error.  The issue is the unflatten from text not producing the entire array in the circled portion.

0 Kudos
Message 3 of 7
(3,720 Views)

Also, I added a 1 second wait time thinking perhaps the issue has got something to do with closing and reopening of the same file too quickly.  I even tested at 10 seconds and got the same odd results.

0 Kudos
Message 4 of 7
(3,703 Views)
Solution
Accepted by topic author DailyDose

Replace your basic file open read and closes with the XML File Read and Write functions and I think it will work the way you expect.

 

You need to use the XML read and write file functions to serialize the data in a way that LabVIEW can reconstruct the array of clusters and timestamps.

 

http://zone.ni.com/reference/en-XX/help/371361H-01/glang/read_from_xml_file/

 

XML_error to file.png


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 5 of 7
(3,688 Views)

Close the file after the first read then reopen it with operation set to "replace" before writing the updated xml string.

 

Ben64

0 Kudos
Message 6 of 7
(3,655 Views)

@PhillipBrooks wrote:

Replace your basic file open read and closes with the XML File Read and Write functions and I think it will work the way you expect.

 

You need to use the XML read and write file functions to serialize the data in a way that LabVIEW can reconstruct the array of clusters and timestamps.


With a couple alterations to manage first run, your suggestion worked.  Thank you!

0 Kudos
Message 7 of 7
(3,636 Views)