Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Read about Qlik’s Response to COVID-19 Read the Letter, Join the Group.
Highlighted
Valued Contributor

Expression

What could be wrong with the following expression:

If(Len(Trim([Med Aid])) = 0, 'UNKNOWN', If([Med Aid] = 'PRIVATE', 'OUT-OF-POCKET',[Med Aid])) as [Payment Type]



Regards.


Chris

Tags (1)
1 Solution

Accepted Solutions
Highlighted

Re: Expression

Or even this:

If(Len(Trim([Med Aid])) = 0, 'UNKNOWN', If(WildMatch([Med Aid], '*PRIVATE*'), 'OUT-OF-POCKET',[Med Aid])) as [Payment Type]

View solution in original post

23 Replies
Highlighted

Re: Expression

Looks right to me. It isn't working?

Highlighted

Re: Expression

May be, just may be PRIVATE isn't upper case in your data? You can force it to be Upper and see if it resolves

If(Len(Trim([Med Aid])) = 0, 'UNKNOWN', If(Upper([Med Aid]) = 'PRIVATE', 'OUT-OF-POCKET',[Med Aid])) as [Payment Type]

Highlighted
MVP & Luminary
MVP & Luminary

Re: Expression

The field name could be misspelled or have the wrong case. Same for the value 'PRIVATE'. Perhaps you need to check for if(UPPER([Med Aid]) = 'PRIVATE'


talk is cheap, supply exceeds demand
Highlighted
Contributor

Re: Expression

perhaps can be the upper case, you'll may use the function wildmatch, or in fact, upper, like Sunny and Gysbert recommended to you.

For performance, You should convert [Med Aid] with autonumber, and compare number is more efficient.

Highlighted
Honored Contributor

Re: Expression

Hi,

Try Like this,

If(Len(Trim([Med Aid])) = 0, 'UNKNOWN', If(Trim([Med Aid]) = 'PRIVATE', 'OUT-OF-POCKET',[Med Aid])) as [Payment Type]



Check whether your Fields mentioned are exact ones or not as Suggested by Sunny.



HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Highlighted
Valued Contributor

Re: Expression

The database screen shoot is as follows:

Screen Shot 2016-02-03 at 19.23.55.png

It is in upper case

Highlighted
Valued Contributor

Re: Expression

Many thanks please see thread above

Highlighted
MVP & Luminary
MVP & Luminary

Re: Expression

Any trailing spaces?


talk is cheap, supply exceeds demand
Highlighted

Re: Expression

Have you looked at Hirish V‌ suggestion? Trim([Med Aid]) before checking it for PRIVATE?