Jump to content

Data Range Coercion


Recommended Posts

Posted

I'm either going crazy, or have forgotten something basic, or this is a bug. :question: :blink:

I have been away from LabVIEW for some time, working with Visual Basic, so either of the 1st two options is possible.

I have tried this example with 3 different LV versions with the same result so I find it hard to believe it's a bug. But ...

There is an integer input control with a Data Range of 1-10 and "Out of range action" set to "Coerce".

I am unable, from the front panel to set it to anything except values between 1 and 10, as expected.

But I also expect any calling parameter to be coerced. That isn't happening. Negative, 0, and values >10 are passed right through without coercion.

The simple vi and calling vi is attached (ver 8.0.1).

Download File:post-133-1164846160.viDownload File:post-133-1164846242.vi

Thanks for any insight,

Jon Sweeney

Posted
I'm either going crazy, or have forgotten something basic, or this is a bug. :question: :blink:

I have been away from LabVIEW for some time, working with Visual Basic, so either of the 1st two options is possible.

I have tried this example with 3 different LV versions with the same result so I find it hard to believe it's a bug. But ...

There is an integer input control with a Data Range of 1-10 and "Out of range action" set to "Coerce".

I am unable, from the front panel to set it to anything except values between 1 and 10, as expected.

But I also expect any calling parameter to be coerced. That isn't happening. Negative, 0, and values >10 are passed right through without coercion.

The simple vi and calling vi is attached (ver 8.0.1).

Download File:post-133-1164846160.viDownload File:post-133-1164846242.vi

Thanks for any insight,

Jon Sweeney

You're not yet crazy, you didn't forgot and it is not a bug: the behavior has been changed.

The behavior of data range coercion has been changed in LabVIEW (???). Before, the data was coerced on call but that was potential for bugs very difficult to track down and source of numerous service calls to NI. Indeed there is no visual clue on the diagram indicating that the data was coerced on input.

The datarange coercion has been removed for VI calls and you must now coerce the input data using the coerce node on the diagram. There is a message when you convert old VIs to recent LabVIEW versions that tells you that the behavior has changed when data range coercion is used. The data range coercion only occurs for user input.

Posted
You're not yet crazy, you didn't forgot and it is not a bug: the behavior has been changed.

The behavior of data range coercion has been changed in LabVIEW (???). Before, the data was coerced on call but that was potential for bugs very difficult to track down and source of numerous service calls to NI. Indeed there is no visual clue on the diagram indicating that the data was coerced on input.

The datarange coercion has been removed for VI calls and you must now coerce the input data using the coerce node on the diagram. There is a message when you convert old VIs to recent LabVIEW versions that tells you that the behavior has changed when data range coercion is used. The data range coercion only occurs for user input.

Wow, I missed that one. I've used the "In Range and Coerce" for other things but never knew it was necessary for input controls that had the DataRange/Coerce set. Must admit though that it makes the diagram more self documenting.

"???" must be before 6.0.1 so I've been in the dark a long time!

Thanks so much for the response.

Jon Sweeney

Posted
LabVIEW (???)

I believe it was LV 7.0 but I can't find it anywhere in the upgrade notes

Must admit though that it makes the diagram more self documenting.

That's why they made the change. Essentially, part of your code was hidden on a property page, and couldn't be seen by the casual / new user.

Posted
I believe it was LV 7.0 but I can't find it anywhere in the upgrade notes

Yeah - and if you upgrade older code that uses this feature, you'll get a warning that it's not supported anymore.

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.