Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Expression consolidation

Can the following two expressions be combined into one expression:

Screen Shot 2016-02-04 at 07.40.20.png

Thanking you in advance

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]

View solution in original post

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]

jagan
Luminary Alumni
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.

amit_saini
Master III
Master III

Hi Chris,

This should work:

Thanks,

AS

Anonymous
Not applicable
Author

Amit may thanks i am trying this out

avinashelite

if you have got the correct answer please mark the correct answer and close this thread

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

amit_saini
Master III
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