Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Anonymous
Not applicable

Expression consolidation

Can the following two expressions be combined into one expression:

Regards.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

like this?

=if(len(trim([Doctor Number]))=0, '00000',

if(len(trim([Doctor Number])) >=6 and [Retail Pharmacy]='PSMAS', '00001', [Doctor Number])) as [Doctor Number]

11 Replies
Anonymous
Not applicable
Author

like this?

=if(len(trim([Doctor Number]))=0, '00000',

if(len(trim([Doctor Number])) >=6 and [Retail Pharmacy]='PSMAS', '00001', [Doctor Number])) as [Doctor Number]

Luminary Alumni

HI,

Try like this

=If(Len(Trim([Doctor Number]))=0, '00000',

If(Len(Trim([Doctor Number])) >=6 AND[Retail Pharmacy]='PSMAS', '00001', [Doctor Number])) AS [Doctor Number]

Anonymous
Not applicable
Author

Many thanks Bairaj, i will try it out and advise outcome

Regards

Anonymous
Not applicable
Author

Thanks Jagan, i am trying this out and will let you know outcome

Regards.

Master III

Hi Chris,

This should work:

Thanks,

AS

Anonymous
Not applicable
Author

Amit may thanks i am trying this out

MVP

Anonymous
Not applicable
Author

Hi Balraj

Many thanks that works.  i have problems with using the if(Len(Trim function on its own and want to incorporate it with the NULL function as follows:

if(len(trim([Doctor Number]) = 0 or If(IsNull([Doctor Number])), '00000',  if(len(trim([Doctor Number])) >= 7 and [Retail Pharmacy]='PSMAS', '00001', [Doctor Number])) as [Doctor Number]

There is something wrong with the above expression and i am failing to figure out the error.  Kindly assist

Master III

Try:

if(IsNull([Doctor Number]),'00000',if(len(trim([Doctor Number])) >= 7 and [Retail Pharmacy]='PSMAS', '00001', [Doctor Number])) as [Doctor Number]

Thanks,

AS

Community Browser