LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Set booleans in a global cluster with variant

Solved!
Go to solution

Hi,

I want to reset the boolean values in a global variable which contains one cluster. I use the variants but I have this error :

 

Property Node (arg 2) in GetErrorList_Global.vi

<APPEND>

Property Name: <b>Value</b>

 

See the read circle in the image below. 

 

FYI, the upper part of the VI is used to read the label value of each true value (which means each error label). 

 

error_labview.JPG

 

Thank you in advance for your help. 

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

It seems to me like you're trying to apply a boolean to a cluster. You'll need to filter/adress the boolean variable in the cluster.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2 of 7
(3,291 Views)

The error message doesn't say which property node threw the error, but presumably it was the last one, so to clarify the previous post - you're trying to write a boolean ARRAY into a cluster. Using the Array to Cluster primitve can help you there.

 

With that out of the way, there are many other things which are very problematic with your code. Here's a selection:

 

  • Why are you reading and writing the global by reference? Why not just drop the cluster on the diagram? You can use the Cluster to Array and Array to Cluster primitives to convert it.
  • It actually surprises me that converting a variant cluster to an array works, because the variant should hold some data about which type it has. Does it work correctly?
  • You can simplify finding whether there's an error by using the Or Array Elements primitive.

 

And with all that said, the most important one:

 

  • Are you aware of the dangers of using globals? If you have more than one place in which you write the value to the global, you are quite likely to run into a race condition at some point, which you may not even notice. There are several ways of working around such problems. You can start by reading this.

___________________
Try to take over the world!
Message 3 of 7
(3,275 Views)
Solution
Accepted by topic author remvu

What you might do is the following: Since you have the individual cluster items control and use it in the loop, set the boolean there. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 7
(3,265 Views)

Finally it works, I solved that exactly with the Yamadea's solution, unfortunately before your post, but thanks anyway !

error_labview_solution.JPG 

 

 

@tst 

I know it is not the best solution with my global variable, but I don't want to change all my program now, but for the next one I will test for sure the FGV.

 

 

  • Why are you reading and writing the global by reference? Why not just drop the cluster on the diagram? You can use the Cluster to Array and Array to Cluster primitives to convert it.
    because I needed to know the labels of the booleans and I didn't find a way to do it without reference.
  • It actually surprises me that converting a variant cluster to an array works, because the variant should hold some data about which type it has. Does it work correctly?
    Yes 🙂
  • You can simplify finding whether there's an error by using the Or Array Elements primitive.
    Ok but I realized that after your message and as I needed the reference for the label I tried this way.
 
 
Thank you guys ! 

 

0 Kudos
Message 5 of 7
(3,258 Views)

I also use labels alot and i dont think there's any other solution than ref for that.

 

The only thing i react to now is how you aquire the cluster ref; cant you just r-click the cluster and create ref or even the property node directly instead fo getting the panel ref and indexing and stuff?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(3,245 Views)

Hello,

I don't think it is possible since my cluster is a global variable, or I may be wrong, but I didn't find how to do that.

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