09-10-2020 10:11 PM - edited 09-10-2020 10:12 PM
I am using LabVIEW 2020
When I use the In-place Map Get/Replace node to insert entries into a map (if they don't already exist), the data returned is the previously added value, and not the class's default value, unless the class constant is wired to the node as the default value. I do not expect this behaviour. I have attached a simple example.
Front Panel showing the Previous Values instead of Default Values
09-11-2020 05:16 AM - edited 09-11-2020 05:20 AM
Does it help if you wire the "default value" of the left IPE node?
It seems like the returned value is undefined if the default value isn't wired. Can't find a reference though.
Why wouldn't you wire the "default value" of the left IPE node?
09-11-2020 08:40 AM
Yes wiring the left node avoids the issue.
Why wouldn’t I wire it? Laziness. But in my defence, it doesn’t behave this way with simple data types and there is no explicit documentation of this behaviour.
I think it at least warrants some more detailed documentation, but honestly I think it is a bug (even if it is sloppy programming).
09-11-2020 08:49 AM - edited 09-11-2020 08:53 AM
@pauldavey wrote:
Yes wiring the left node avoids the issue.
Why wouldn’t I wire it? Laziness. But in my defence, it doesn’t behave this way with simple data types and there is no explicit documentation of this behaviour.
I think it at least warrants some more detailed documentation, but honestly I think it is a bug (even if it is sloppy programming).
IIRC, there is an idea that the default value should be required. It might have evaluated to a BUG already. Can't find it...
I could be mixing things up with The-key-input-of-the-IPE-s-Map-Get-Replace-Value-node-should-be or a thread somewhere else... EDIT: I put a comment there, maybe the can address the issues in one go.
I'm not sure what I prefer, having to wire it or getting undefined values. I don't have much map milage.