Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with set analysis expression

Hi,

Can someone please help me with this set anyalsis expression using is null.
When there is no value in vSearch then my set analysis should evaluate the expression from [Transaction ID], if there is a value in vSearch then it should evaluate from [Transaction ID]={$(vSearch)}. And should return [RAL State].

=only({<[Transaction ID]={$(vSearch)}>}
        [RAL State])
The above expression works fine but

=only({<[Transaction ID]={$(vSearch)}>
+
    <[Transaction ID]>}
     [RAL State])

this is not working and I'm having trouble in this part <[Transaction ID]={$(vSearch)}>.

Thanks in advance.

Regards,
Sachin

5 Replies
swuehl
MVP
MVP

What about defining a second variable vSet

=if(len(trim('$(vSearch)')),

     '{<[Transaction ID]={$(vSearch)}>}',

     ''

)


Then use vSet in your expression

=only($(vSet) [RAL State])

Basically, if vSearch is empty, replace vSet with an empty string, else use your original set expression.

Not applicable
Author

Hi,

It's not working.

Do you mean it should be

=only({<[Transaction ID]={$(vSet)}>

+

    <[Transaction ID]>}

     [RAL State])

swuehl
MVP
MVP

No, if I've understood you correctly, this should be enough in both cases:

=only($(vSet) [RAL State])


with vSet definition doing the magic.


Could you upload a small sample QVW and your expected results?

Not applicable
Author

Hi,

I appreciate your help. Just when vSet returns null() then it should be replaced with [Transaction ID]

swuehl
MVP
MVP

Not sure if I understand.

If you don't enter something in vSearch, you want the user selection in [Transaction ID] to be considered?

Isn't that just the standard behaviour?