LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

An issue (bug?) with Config File VIs?!

Hello to all!

When using Config File VIs I encountered a very interesting
and killing (me) issue.
I spent an hour before I knew where's a bug.
(Maybe because I'm a novice to LabView).

From one side, the bug was mine: I used a "for loop" to write string values to keys in section and provided to the loop an array that could be empty sometimes. And I absolutely forgot that "for loop" executes at least one time anyway even if array is empty.

Ok, no problem, then the function "Write Key" should say "ERROR" and I would find my bug at once on the output of my "for loop".

BUT IT DOESN'T DO IT. It says "OK".

And only the next function "write key (string value in my case)"
fails saying "Error: Config Data Registry.vi [get data]: invalid object 0". I certainly think that something wrong with this "write key", but what means this message?!

Ok, I found who responds for this (the previous "write key" in for loop).
But the most interesting thing is that if you set after this bad "for loop" one more such "for loop" you don't get error on the output of the 2nd "for loop" too. It appears only after "write key" that goes after 2nd "for loop".

Well, forget it. Just look at attached files.

Something wrong in this "Write Key" function if error goes far beyond its real source of arrising.
Are you agreed? Or maybe I'm wrong?

Thanks to all for attention.
Any comments appreciated.
Rashid.

Using LV 8.0.1 Pro on WinXP.
Download All
0 Kudos
Message 1 of 7
(2,812 Views)
Hi Rashid,
unfortunately I cannot open your VIs, got only 7.1
But from your description I had some ideas. You wrote, if you pass an empty array to the for loop, it executes at least once. That's not right. The code inside the loop doesn't execute and the data passed from the for loop to following nodes is the default data for the data type. And the default data for error cluster is: status - false; code - 0; source - <empty>; so this is not recognized as an error. The best way to go with this is to wrap around the for- loop a case, passing an error when the string-array is empty.
Hoping this is the answer to your question,
Dave
Greets, Dave
Message 2 of 7
(2,791 Views)
Dave is right.
The For loop does not execute when an empty array is passed in. As a result, default values are passed on the output wires. This explains the "No error". Additionnaly, a nil refnum is passed to the second Write key vi... And this explains the invalid object error !
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
Message 3 of 7
(2,786 Views)

I have to second (third) the previous posters.

Suggestion:

When ever a value (like the file refernce) is wired through a For loop that could iterate "0" times, a shift register should be used instead of a tunnel.

By using the shift register, the config file ref will NOT be lost when the For loop does not iterate.

Additional note:

Similarly with the error cluster inside a For loop, a shift register for the Error Cluster will enusre that an error of any of the iterations will not be lost by subsequent iterations.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 7
(2,773 Views)
Thanks to all for your explanations.
I got the point.

Now I know a little more about "for loop" 🙂
Thanks again.

Best regards,
Rashid.

Message Edited by Rashid on 06-16-2006 12:00 PM

0 Kudos
Message 5 of 7
(2,746 Views)
Hi Ben, this was a good hint, last time I had problems with that zero iteration issue, I worked with LV 6.1 and kept in mind, that the shift register output was the last value stored in the Shift register output node, it reminded to the use of an uninitialized SR. If somebody still has 6.1 on the machine, it would be nice to test this. But the test with 7.1 showed you are right, the SR- input is reached through. Great!
Thanks, dave



Message Edited by daveTW on 06-16-2006 07:05 PM

Greets, Dave
Message 6 of 7
(2,745 Views)

Thanks to all!

I failed to point out that I originally learn about the "SR and 0-iteration For Loop" from none other than Rolf Kalbermatter in an Info-LabVIEW posting..

I feel better now.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 7
(2,735 Views)