Jump to content

How does one make a VI server reference weakly typed?


Recommended Posts

The output of a tree control reference defaults to a strictly typed refnum. (The reference was created by right-clicking the tree control in the front panel->create->reference.) Is there a way to convert this output to weakly typed?

For most refnums that appear in the front panel there is an option to switch between strict and weak types by deselecting "Include data type." But this method does not seem to be available for the VI server reference. How does one specify a weakly typed output from a tree control reference?

Link to comment

The output of a tree control reference defaults to a strictly typed refnum. (The reference was created by right-clicking the tree control in the front panel->create->reference.) Is there a way to convert this output to weakly typed?

For most refnums that appear in the front panel there is an option to switch between strict and weak types by deselecting "Include data type." But this method does not seem to be available for the VI server reference. How does one specify a weakly typed output from a tree control reference?

Why do you need a weaker reference? LabVIEW will automatically upclass references when necessary (so if you build the tree reference into an array of references of other types, it will make an array of the most specific common parent). If you want to do this explicity, use "To More Generic Class."

Also, I think you might be confusing two types of references. The reference you have right now refers to the tree on your front panel. If you right-click on that reference and choose "Create constant" then you'll have a reference for which you can specify the class. That constant is simply a type specifier, so it can be as specific or generic as you want.

Link to comment

Why do you need a weaker reference? LabVIEW will automatically upclass references when necessary (so if you build the tree reference into an array of references of other types, it will make an array of the most specific common parent). If you want to do this explicity, use "To More Generic Class."

Also, I think you might be confusing two types of references. The reference you have right now refers to the tree on your front panel. If you right-click on that reference and choose "Create constant" then you'll have a reference for which you can specify the class. That constant is simply a type specifier, so it can be as specific or generic as you want.

Thank you for the helpful explanation. When the strictly typed reference was connected to a weakly typed sub VI, a red dot appeared at the connection. I interpreted this to be a class conflict, but perhaps the dot is there just to indicate that inputs will be "upclassed" as necessary, according to your explanation.

Link to comment

Thank you for the helpful explanation. When the strictly typed reference was connected to a weakly typed sub VI, a red dot appeared at the connection. I interpreted this to be a class conflict, but perhaps the dot is there just to indicate that inputs will be "upclassed" as necessary, according to your explanation.

That's a coercion dot. It's the same dot you see when you connect an integer wire to a double terminal. Just indicates that type is being converted automatically. It is sometimes important to be aware of them --- some can create performance problems or loss of precision or indicate a place where your type definition has been lost. But most of the time they're just informational. The coding conventions of LAVA require that you have an explicit cast for all type conversions and no coercion dots, but such a high bar standard is unnecessary in most day-to-day programming. If you're going to be producing a final product it's a fairly good practice.
Link to comment

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.