LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search 1D Array behaves strange when operating on an array of VI references

I am working on some code in LabVIEW 8.6. The code was originally written in LabVIEW 7.1.1.
In 7.1.1, I created an array of VI references (all of them referring to the same VI) and later on used "Search 1D Array" to find the VI Ref. This does not work any longer in LabVIEW 8.6: (Search 1D Array usually says: index of element = 0 instead of reporting the correct index.)
As a workaround, in LabVIEW 8.6 I "type cast" the VI references to strings and then apply "Search 1D Array".
Can anyone put some light on me why this happens?
Find attached some LabVIEW 7.1.1 code that illustrates what I did once and some LabVIEW 8.6 code of what I do now.

Thanks in advance, Guenter

0 Kudos
Message 1 of 5
(2,920 Views)

In LabVIEW 7.x, the comparison nodes (including Search 1D Array) would not be able to recognize different references to the same object as being equal, even though they should have (example). This was fixed in 8.0 and I'm guessing that this applies to VI references as well. You can see this clearly by comparing the reference to the array. You will see that all elements are equal to it.

 

This may actually be a bug, since when I open a VI server reference to a VI, I think I want it to be unique even if both reference point to the same VI, at least if the VI is reentrant (in your example it isn't, but if you change it, it still behaves in the same way). That said, I didn't put much thought into it and it's possible that this the correct behavior. I would suggest you add a link in the bug thread with a mention of this specific caveat.


___________________
Try to take over the world!
Message 2 of 5
(2,893 Views)

Thanks for the link to the example, Yair. This makes clear, what might have happened to the Search 1D Array function in LabVIEW 8.0.

BTW: My application uses reentrant VIs. My small example comes by intention with non-reentrant VIs just to confirm that this is not the cause of the issue.

Guenter

0 Kudos
Message 3 of 5
(2,875 Views)

With standard VIs, it probably shouldn't make a difference, as all VIs point to the same instance and this behavior would be correct.

I believe reentrant VIs are the one exception, as you really are refering to unique instances and therefore the comparsion should fail (I think).


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(2,866 Views)

"I believe reentrant VIs are the one exception, as you really are refering to unique instances and therefore the comparsion should fail" --> I fully agree that reentrant VIs might (or: would be an excellent candidate to) be handled in a way, that a comparison between ViRefs works.

In between I have checked that this is no longer the case in LabVIEW since 8.0.

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