Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

1 Solution

Accepted Solutions
sunny_talwar

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
sunny_talwar

Looks right to me. It isn't working?

sunny_talwar

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]

Gysbert_Wassenaar

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
uroboros
Creator
Creator

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.

HirisH_V7
Master
Master

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!”
Anonymous
Not applicable
Author

The database screen shoot is as follows:

Screen Shot 2016-02-03 at 19.23.55.png

It is in upper case

Anonymous
Not applicable
Author

Many thanks please see thread above

Gysbert_Wassenaar

Any trailing spaces?


talk is cheap, supply exceeds demand
sunny_talwar

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