Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
bobby_chowdary
New Contributor III

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
MVP
MVP

Re: How to describe else part in Only Function

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

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

'no EMP name Found')

4 Replies

Re: How to describe else part in Only Function

You can try,

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

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

'No EMP Name found')

MVP
MVP

Re: How to describe else part in Only Function

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

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

'no EMP name Found')

novolouy
New Contributor II

Re: How to describe else part in Only Function

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

bobby_chowdary
New Contributor III

Re: How to describe else part in Only Function

Hay,

Again

Thanks swuehl

Regards,

Bob