Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

only Statement


Hi all,

I have the below statement that is returning - and i cant figure out why?

the variable does contain the correct figure and if i change the vairable to another that does the same thing but with a different value it works.

as a final error check i have changed only for count and it results in a 1 therefore this should work?

only( {1< [/rec/parameter/curval] = {$(MOSADD_M6_J3_Anticlockwise)}, [/#text] = {'MIDASOutstations'},  [/rec/parameter] = {'mosAddress'} >}[/rec])

thanks for any help

1 Solution

Accepted Solutions
Not applicable

Maybe you can try change the Only to concat(XXXX, ',').

If the concat return NULL, this means there are no value found base on the condition.

If you see a "," in the value, which means there are more than one values.

View solution in original post

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

Only returns - (that is null) if there are more than 1 element that has the same value.

Check your data

jagan
Luminary Alumni
Luminary Alumni

Hi,

If there are more than one possible for this selections [/rec/parameter/curval] = {$(MOSADD_M6_J3_Anticlockwise)}, [/#text] = {'MIDASOutstations'},  [/rec/parameter] = {'mosAddress'} then you will get null.


If you want to display then try to use MaxString() or MinString() based on your requirement


MaxString( {1< [/rec/parameter/curval] = {$(MOSADD_M6_J3_Anticlockwise)}, [/#text] = {'MIDASOutstations'},  [/rec/parameter] = {'mosAddress'} >}[/rec])

OR

MinString( {1< [/rec/parameter/curval] = {$(MOSADD_M6_J3_Anticlockwise)}, [/#text] = {'MIDASOutstations'},  [/rec/parameter] = {'mosAddress'} >}[/rec])


Regards,

jagan.


samuel_brierley
Creator
Creator
Author

Hi,

thanks for the replies, there is no doubt there is only one value as when i change only for count it returns a 1

Peter_Cammaert
Partner - Champion III
Partner - Champion III

In your case, Only() returns NULL ( - ) if after applying the set condition, [/rec] still has multiple different values.

To see what is happening, replace Only() with Concat() which will force all different values to be concatenated into one string.

Just like Alessandro says, check your data.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

No, that is not true. Your Only() may return two values, NULL and something else, but count will only "'count" one.

Not applicable

Maybe you can try change the Only to concat(XXXX, ',').

If the concat return NULL, this means there are no value found base on the condition.

If you see a "," in the value, which means there are more than one values.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Do this selections manually

[/rec/parameter/curval] = {$(MOSADD_M6_J3_Anticlockwise)}, [/#text] = {'MIDASOutstations'},  [/rec/parameter] = {'mosAddress'}

and check the [/rec] field whether you have multiple possible values.

Regards,

Jagan.