Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I came across a construction in QV on the Internet:
if exists(field, 'value') then
...
endif
I applied it. There are no errors. But I don't see that it works at all. Could you give me a minimalistic working example. I know that exists is usually used when loading a table, but this is a different case.
Thanks. It works. But you know what else works? Exists instead of FieldIndex. It's really funny.
Fruits:
Load * inline [
Fruit
Apple
Banana
Grape];
if Exists('Fruit','Banana')
trace Banana exists;
endif
if Exists('Fruit', 'Orange') then
trace Orange exists;
endif
if not Exists('Fruit', 'Orange') then
trace Orange does not exists;
endif
I believe exists() only works in load statements. Try FieldIndex instead.
Fruits:
Load * inline [
Fruit
Apple
Banana
Grape];
if FieldIndex('Fruit','Banana')
trace Banana exists;
endif
if FieldIndex('Fruit', 'Orange') then
trace Orange exists;
endif
if not FieldIndex('Fruit', 'Orange') then
trace Orange does not exists;
endif
Thanks. It works. But you know what else works? Exists instead of FieldIndex. It's really funny.
Fruits:
Load * inline [
Fruit
Apple
Banana
Grape];
if Exists('Fruit','Banana')
trace Banana exists;
endif
if Exists('Fruit', 'Orange') then
trace Orange exists;
endif
if not Exists('Fruit', 'Orange') then
trace Orange does not exists;
endif
That is funny.🤯
I will try your syntax. I've assumed the first parameter to be a field reference and not a string, but I notice you use stringsforr all parameters.
Me: Exists(Fruit,'Banana')
You: Exists('Fruit','Banana')
If this is true, then it will my learning of the day. Thanks!
Yeah, I decided to try it and it worked. You know, I think it's going to be a revelation for QlikTech in their entire history as well.