Jump to content

Lookup or add Variant attribute using IPE example


Recommended Posts

Posted

In the attached image found in the LabVIEW examples, you can see the code on the right. It shows how to add the attribute if it's not found. My question is why is the code on the outside of the IPE and not in the False case, on the inside?

 

2017-04-04_14-21-38 (1).png

Posted

I'm blind. Right.

I guess I'm trying to figure out the advantage of this programing method vs just using the "set variant attribute" primitive. I just want to add or update an attribute value. Not necessarily read it or access it for any reason. The primitive adds the attribute if it's missing anyway.

Posted

There's no advantage in the lookup case. That was just to show syntax. The advantage in the increment case is the same as with the other IPE border nodes. It provides a cleaner syntax and, if the child variant is large, it might improve performance by avoiding a copy.

Posted

I saw some mild performance benefit from using the IPE for variant look ups instead of the primitives, but I remember it being a bit of a pain to test and use at times.  I think something about creating an attribute if it didn't exist.  Maybe it was just the way I was trying to use them.

Edit: found my speed tests on the dark side for writing and reading attributes, it seems writing is going to be faster with the primitive, but a read that does nothing but return the value, is slower with an IPE than the primitive.  Of course I'm sure NI intended on this feature being used where you perform a read, manipulate the data, and write it back in the same structure, which will probably result in even better performance.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.