06-06-2013 02:30 PM
This one kind of cheesed me off this morning.
When I create a constant/control from a terminal on a primitive I have come to expect the value to be the default value. Those tricky folks found a way to get me again.
Drop a Wait on Occurrence onto the BD
Right-Click on 'Create Control' or 'Create Constant' from the suggestively named 'ms timeout (-1)' terminal
The value/default is not -1, but rather 0.
Slightly different behavior between -1 and 0.
LV8.2-LV12 (at least)
06-07-2013 08:55 AM
Hi Darin.K,
Thanks for letting us know. I have reported it to our R&D department.
Regards,
Carmen C.
06-07-2013 09:36 AM
Similarly I have an issue with how the Delete From Array function. If I wire a 1D array of string to the input, and nothing else my output has the 1D array (with that index deleted), and then the Deleted Portion as a scalar string.
If I create a constant from the Length terminal, the value is 0 and the functionality of the primative changes so that now Deleted Portion output is an Array of String.
I don't think this is a bug, but it bothers me when NI can detect when a terminal has something connected to it, and behaves differently then when something isn't connected. This is not functionality that I expect to see in LabVIEW because I rarly see it.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-07-2013 01:02 PM
@Hooovahh wrote:
Similarly I have an issue with how the Delete From Array function. If I wire a 1D array of string to the input, and nothing else my output has the 1D array (with that index deleted), and then the Deleted Portion as a scalar string.
If I create a constant from the Length terminal, the value is 0 and the functionality of the primative changes so that now Deleted Portion output is an Array of String.
Personally, I greatly appreciate this usability enhancement. It would annoy me if I had to put an index array after every delete from array when I delete only a single element.
06-07-2013 01:09 PM - edited 06-07-2013 01:09 PM
@nathand wrote:
@Hooovahh wrote:
Similarly I have an issue with how the Delete From Array function. If I wire a 1D array of string to the input, and nothing else my output has the 1D array (with that index deleted), and then the Deleted Portion as a scalar string.
If I create a constant from the Length terminal, the value is 0 and the functionality of the primative changes so that now Deleted Portion output is an Array of String.
Personally, I greatly appreciate this usability enhancement. It would annoy me if I had to put an index array after every delete from array when I delete only a single element.
I like the feature, I don't like the implementation. Why can't a value of -1 be the default and that corresponds to a single scalar item being removed? Instead of 0 be the default corresponding to delete nothing.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-07-2013 01:13 PM
@Hooovahh wrote:
I like the feature, I don't like the implementation. Why can't a value of -1 be the default and that corresponds to a single scalar item being removed? Instead of 0 be the default corresponding to delete nothing.
Because the value on the wire wire can vary, and it would be weird if a -1 on a non-constant wire behaved differently than the same value as a constant.
06-07-2013 02:27 PM
@nathand wrote:
@Hooovahh wrote:
I like the feature, I don't like the implementation. Why can't a value of -1 be the default and that corresponds to a single scalar item being removed? Instead of 0 be the default corresponding to delete nothing.
Because the value on the wire wire can vary, and it would be weird if a -1 on a non-constant wire behaved differently than the same value as a constant.
Lets ignore the Length terminal (because that changes outputs from array to scalar which can't happen at runtime) What bout the Index terminal? If this is unwired you have it deleting from the end of the array, if you create a constant it will delete from the beginning of the array. What is wrong with having -1 mean the end of the array, and have that be the default value on the terminal if a constant is made?
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-07-2013 03:34 PM
@Hooovahh wrote:
Lets ignore the Length terminal (because that changes outputs from array to scalar which can't happen at runtime) What bout the Index terminal? If this is unwired you have it deleting from the end of the array, if you create a constant it will delete from the beginning of the array. What is wrong with having -1 mean the end of the array, and have that be the default value on the terminal if a constant is made?
Veering way off-topic from the subject line at this point... my guess is there's a compiler optimization that can be made here. Deleting elements from the end of an array should be easy - just set the length shorter. If the compiler knows that's all that's necessary, it can generate a lot less code. Deleting an element from the beginning is more complicated. You could rework it the way you suggest but you'd lose the option for this optimization.
11-04-2013 06:08 PM