05-12-2021 10:52 AM
Also remember that an empty variant can still have variant attributes that can differ.
05-12-2021 10:59 AM - edited 05-12-2021 11:04 AM
@GerdW wrote:
Hi PNB,
@PNB wrote:
If the variant e.g. contains 64byte integer values, this comparison will also result in true, although data are contained within the variant.
Can you please provide an example VI to demonstrate that observation?
The only instance I could see of this method not working is if your incoming variant is "empty", but has variant attributes.
In that case you'd probably need to use "Get Type Information" to tell if the variant itself is empty.
02-03-2023 10:43 AM - edited 02-03-2023 11:12 AM
@PNB wrote:
Is there a universal method to detect empty variants...?
Yes, the Empty String/Path? Function on the Comparison Functions Palette "is also designed to work with variants, pictures, and DSC tags." -- https://www.ni.com/docs/en-US/bundle/labview/page/glang/empty_string_path.html
To make this easier to find Kudo the idea to put it on the Variant Palette -- https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Empty-Variant-Function-To-Variant-Palette/idi-p/42818...
02-06-2023 03:29 AM
@d.w.b wrote:
@PNB wrote:
Is there a universal method to detect empty variants...?
Yes, the Empty String/Path? Function on the Comparison Functions Palette "is also designed to work with variants, pictures, and DSC tags." -- https://www.ni.com/docs/en-US/bundle/labview/page/glang/empty_string_path.html
Nice, didn't know that. It's tricky though:
So Empty String/Path is false if the empty string/Path is converted to a variant first...
02-06-2023 12:52 PM
wiebe@CARYA wrote:
Nice, didn't know that. It's tricky though:
So Empty String/Path is false if the empty string/Path is converted to a variant first...
That seems logical to me. The variant isn't empty, it contains a string. That string just happens to be a null, but the variant does contain that null. But I could see the confusion if people aren't aware that it works this way.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
02-07-2023 03:27 AM
@Hooovahh wrote:
wiebe@CARYA wrote:
Nice, didn't know that. It's tricky though:
So Empty String/Path is false if the empty string/Path is converted to a variant first...
That seems logical to me. The variant isn't empty, it contains a string. That string just happens to be a null, but the variant does contain that null. But I could see the confusion if people aren't aware that it works this way.
I think it's something I'll double check every time I'm going to use it. Maybe someday I'll remember.
But, a lot better then getting the type and checking if it's null.