03-22-2019 04:43 AM - edited 03-22-2019 04:43 AM
Hi everyone,
I've searched the community for a similar problem but I didn't find anything useful so far.
I defined a custom Attribute for each LabVIEW IO control contained in serialArray[0:4] and I'd like to use it at run-time in order to use only the resource with the attribute set as true and possibly modify the other ones.
The problem is that during the execution those Attributes do not exist.
As a matter of fact the expression FileGlobals.serialArray[0].HasAttributes returns False.
Right now I can only access the attributes when I access the FileGlobals default.
I've attached some pictures for more details.
Thanks to anyone willing to help me getting to the solution!
Regards,
Dimitris
Solved! Go to Solution.
03-24-2019 07:51 AM - edited 03-24-2019 08:15 AM
You should create a simple example that illustrates your problem and post the code.
I cannot reproduce your problem. If I create an attribute in a FileGlobals, the property .HasAttribute returns true.
FileGlobals can only be accessed from the sequences within the same sequence file.
If you create the attribute at run time, it will not be present the next time you run.
03-25-2019 07:48 AM
Hi Marc,
here's a demo sequence.
In Locals.visaResources[0..4] the first four elements have the attribute set as False whereas the fifth has it set on True.
Thanks for helping me!
Regards,
Dimitris
03-25-2019 07:43 PM
When you iterate over the VisaResources array, you must look at the attributes of the array elements themselves. When using a For Each loop with a CurrentElement as the iteration variable, the value of the VisaResources element is transferred to CurrentElement but not its attributes. Assigning values to a different variable transfer the values but not the attributes. If you want to look at the attributes, you must look at the element themselves. If you use a For loop instead of a For Each loop and that for each iteration of the For loop, you look at the attributes of the element using an indexing variable, the attribute is present.
If you want to transfer a value when assigning the array element to a value, you should add another component to your container that would contain the property that you want to transfer.