LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Assemble property names in "Property Node" from string (or similar)

Hi all,

 

is there a possibility to create a "Property Node" but select the property name dynamically?

 

As a starting point consider I have a string array of property names (e.g. "property1, property2, property3", which could have been read from a file) and would want to set values for all of those on a specifc object.

 

Background is the question on how to programatically set voltage ranges for different channels on a CompactRIO module.

 

Regards,
Patrick

0 Kudos
Message 1 of 14
(4,454 Views)

Hope your requirement is quite possible, you can take reference of all controls and cmpare the name with the file based on the match you can set values to those contols

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 14
(4,445 Views)

I don't think so.  There are multiple properties and they have different datatypes.  There would be no way to wire data to the property since it is unknown which property it is at compile time.

 

I'd assume that you probably only have a limited number of properties you'd be trying to set the value for.  I'd make a case structure that has one of each of those properties in it.  Then the property name you read from the file would drive the case structure, and the string value you read from the file could be converted to the property datatype and written to that specific property within the case structure.

0 Kudos
Message 3 of 14
(4,427 Views)

Thanks for you answers. If I understood the first one correctly they go into the same direction...

 

@RavensFan wrote:
I'd assume that you probably only have a limited number of properties you'd be trying to set the value for.

Well "limited" meaning 32 channels on one analog input module to start with (let alone other modules I might want to connect)...

It's obviously not impossible to create a case structure with 32 different cases, but it looks awfully wrong to me... I really hope there is a more elegant solution to this!

0 Kudos
Message 4 of 14
(4,419 Views)

It is very possible to create 32 cases in a case structure.  It would take some time to do it manually (I'd guess about an hour, maybe less.)  Remember you can create and wire up one case.  Then copy as often as you need just modifying the property chosen and the selector value for that case.  If you needed a whole log of cases, you could use VI scripting, but I don't think you need that here.

 

0 Kudos
Message 5 of 14
(4,401 Views)

What are you trying to accomplish?  (You described the "how" but if you describe the "what" we might be able to come up with something better.)

 

e.g., "I want to set the disabled property for a bunch of controls depending on what product number I am testing."

 

edit:

nvm You already did describe what you needed.  Perhaps I should just take some time off from posting since I've been doing this a lot lately.  😕

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 14
(4,397 Views)

Check out the link in the very first post where the "what" is described in detail... (OK, you found it)

 

To break it down I want to give the user the possibility to specify pairs of "channel number" and "voltage range" in a simple text file and set them accordingly for the input module.

0 Kudos
Message 7 of 14
(4,393 Views)

I just made this 3 case structure in less than 2 minutes.  I bet it would take about 15 minutes to do all 32 cases.

0 Kudos
Message 8 of 14
(4,388 Views)

You can use these methods to access the properties of any G Object:

props.png

Use the attached VI to find index values (property ID codes).

"If you weren't supposed to push it, it wouldn't be a button."
Message 9 of 14
(4,346 Views)

Hi Paul,

for the time being I resorted to the inelegant case structure workaround, but this finally seems to be what I had in mind initially, thank you!

However I tried to reproduce what you had in your screenshot, but an "Invoke Node" for class "Generic" (did I identify that correctly from you screenshot?) does not have any selectable methods. Therfore I can neither find the "Set Property" nor "Get Property" methods...

0 Kudos
Message 10 of 14
(4,322 Views)