Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to describe else part in Only Function

Hi Team,

could you please share your ideas of below code:

=Only({<empfullname={'$(mfullname)'}>} [emp name])

in above code i want to display else part  --else part is 'No EMP name Found'

means  when comparing the empfullname to $(mfullname) .if both texts are matching then it will display [emp name]---

if both text are not matching then i want to show 'No EMP name Found'


please suggest me How can i implement this functionality in Only  function

1 Solution

Accepted Solutions
swuehl
MVP
MVP

=If( Len(Only({<empfullname={'$(mfullname)'}>} [emp name])),

Only({<empfullname={'$(mfullname)'}>} [emp name]),

'no EMP name Found')

View solution in original post

4 Replies
tamilarasu
Champion
Champion

You can try,

If( Not Isnull(Only({<empfullname={'$(mfullname)'}>} [emp name])),

Only({<empfullname={'$(mfullname)'}>} [emp name]),

'No EMP Name found')

swuehl
MVP
MVP

=If( Len(Only({<empfullname={'$(mfullname)'}>} [emp name])),

Only({<empfullname={'$(mfullname)'}>} [emp name]),

'no EMP name Found')

novolouy
Contributor III
Contributor III

Hi Bobby,

The ONLY function will return a NULL when there is no match in your example.

The function does not provide a parameter to show when no match is found, but you can handle the null in multiple ways.

A simple example would be to use an IF:

If(ISNULL(Only({<empfullname={'$(mfullname'}>} [emp name])),

     'No EMP name Found',

     Only({<empfullname={'$(mfullname'}>} [emp name])

)

I hopw this is what you were looking for.

Regards

Anonymous
Not applicable
Author

Hay,

Again

Thanks swuehl

Regards,

Bob