From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan from string error

    Hi,

    I have a problem with "Scan from string" when at its input is there an empty string. But not in every cases: if it is an empty string constant is ok, but when it's an output of "Index Array" bloc/function, is not. See the attachments bellow containing both cases. Is it a bug? Do I miss something?

    Tnx
    Silviu

 
Download All
0 Kudos
Message 1 of 10
(3,224 Views)
Silviu,

the issue is created by the way you are working with the string/enums.
In the screenshot which shows the error, you retrieve the strings of the enum, retrieve an empty string using -1 as index and then look in this empty string for an value defined in the enum.
The screenshot without any error, you pass an empty string directly in the search function.

Where is the exact difference?
I cannor tell you exactly, WHY LV makes a difference here, but if you don't read the strings from the enum using the property node, it will work.

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 10
(3,205 Views)
What version of LabVIEW are you using? Under 8.2 I get an error either way.
0 Kudos
Message 3 of 10
(3,177 Views)
" What version of LabVIEW are you using? Under 8.2 I get an error either way. "
So I should condider myself lucky? 🙂 I use version 8.5. So it's normal to get that error?!
0 Kudos
Message 4 of 10
(3,150 Views)
In my opinion, you should get the error in either case, not just in one, since the input to the Scan From String function is the same.
0 Kudos
Message 5 of 10
(3,121 Views)
Why? I do have a default value at the input of the bloc.

LabView Help: "If this function cannot scan the input value from format string, the function uses the default."

So?!
0 Kudos
Message 6 of 10
(3,099 Views)

The function is operating correctly.

For one thing it does output the default value, but since you don't have a wire coming out of it, you can't see that.

For another, it does throw the same error in both cases (I see this in 8.5.1).
You're almost definitely not seeing this error because you have automatic error handling turned off in the second case, either in the Options dialog or for the VI itself. If you add an error indicator, you should see it.

In any case, you should note that it does not say that the function will not throw an error if it cannot find the string, just that the output will have the default value (because it has to have some value).


___________________
Try to take over the world!
0 Kudos
Message 7 of 10
(3,077 Views)
Yes, I know that the block output the default value in both cases and yes, I know that "error out" output an error in both cases, too.
But in one case only that error window appears and this is my problem. The "error out" I could simply not connect and consequently ignore, but the appearance of that error window stops the normal flow of my vi.
0 Kudos
Message 8 of 10
(3,072 Views)
As I mentioned, that's called automatic error handling - if you don't wire an error terminal and an error occurs, LabVIEW throws an error dialog. You can disable this in the options dialog or in the properties for this specific VI (in the Execution page), but I personally think you shouldn't turn it off and just wire the error out. You can read more about it here.

___________________
Try to take over the world!
0 Kudos
Message 9 of 10
(3,067 Views)
Oh, you were talking about the error dialog, not the error cluster. That's definitely different.
0 Kudos
Message 10 of 10
(3,041 Views)