01-15-2015 08:39 AM
So, i had an ini-file with an empty parameter with the following code:
and got Error 19: "Read Key (Double).vi".
It says in the help that if the key doesn't exist the default is used, but if the parameter is missing (i.e. "parameter=")? I'd say it's a bug that the default isn't used (maybe accompanied with a warning). If it's not, the error text isn't exactly helpful as you can see, the text above is all info you get. It should atleast have the section and key included (i'd say that's a bug also).
The extended error text suggests a GPIB-error (sic).
Tested in 2010 and 2014.
/Y
01-15-2015 08:55 AM
Can you post the ini-file and the VI?
It seems to me that the error 19 indicates a type mismatch rather than a missing key.
Are you sure that there is no equally named key using some other value than numeric?
Norbert
01-15-2015 08:57 AM - edited 01-15-2015 09:24 AM
Setting the parameter to 1 makes it run without error. I'll change the vi some so i can post it.
Edit: added example files
/Y
01-15-2015 09:07 AM - edited 01-15-2015 09:08 AM
I opened the Read Key (Double).vi and the code reveals the source of error 19:
If the double input to the case structure is '0', both casts are zero as well which will pass the "Config type invalid" error to the error output.
I don't know why it is like this and if it is really on purpose, but obviously, Read Key (Double).vi doesn't accept a '0' as default value.
Norbert
EDIT: I do concur that this seems to be an issue of at least the documentation. Do you have a specific need for '0' being the default value?
01-15-2015 09:12 AM - edited 01-15-2015 09:13 AM
Setting the default to 1 still generates Error 19, but i do get a 1 out. 🙂
To me the solution is simple, if the string is empty (missing parameter), return the Default.
/Y
01-15-2015 09:20 AM
Arg, OK, i should think before posting...
The case structure i posted the screenshot takes the "found?" parameter from the parsing function. As it is the TRUE case, it is an indiciation that the key is found in your ini file. But it doesn't match a numeric value (offset past match is '0', as THIS is the comparison!)
So please review your ini-file as it has to contain the key you are trying to load as double value, but the key does NOT cast into a floating point number.
Norbert
01-15-2015 09:29 AM
@Norbert_B wrote:
Arg, OK, i should think before posting...
The case structure i posted the screenshot takes the "found?" parameter from the parsing function. As it is the TRUE case, it is an indiciation that the key is found in your ini file. But it doesn't match a numeric value (offset past match is '0', as THIS is the comparison!)
So please review your ini-file as it has to contain the key you are trying to load as double value, but the key does NOT cast into a floating point number.
Norbert
I know what the problem with the ini-file was, the parameter was empty. Scan from string can't scan a double from an empty string. That's the bug and the error text is lousy. 🙂
/Y
01-15-2015 09:32 AM
@Yamaeda wrote:
[...] the parameter was empty. Scan from string can't scan a double from an empty string. That's the bug and the error text is lousy. 🙂/Y
Ah, yes i understand your remark about empty string in your post before.
I think it is best if you would enter a idea exchange for modification of that Read Key (Double).vi. I think that there should be a difference between incompatible data type vs. "empty key" (you do think the same obviously).
thanks,
Norbert
01-17-2015 11:27 AM - edited 01-17-2015 11:30 AM
0 is a poor choise for a deaut value for scan from empty string. Wire a NaN to that scan from string as default! Your ini will thank you
01-17-2015 03:52 PM