Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
chitemerere
Valued Contributor

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.

Tags (1)
1 Solution

Accepted Solutions
balrajahlawat
Esteemed Contributor

Re: Expression consolidation

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
balrajahlawat
Esteemed Contributor

Re: Expression consolidation

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

MVP & Luminary
MVP & Luminary

Re: Expression consolidation

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]

chitemerere
Valued Contributor

Re: Expression consolidation

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

Regards

chitemerere
Valued Contributor

Re: Expression consolidation

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

Regards.

amit_saini
Honored Contributor III

Re: Expression consolidation

Hi Chris,

This should work:

Thanks,

AS

chitemerere
Valued Contributor

Re: Expression consolidation

Amit may thanks i am trying this out

Re: Expression consolidation

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

chitemerere
Valued Contributor

Re: Expression consolidation

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
Honored Contributor III

Re: Expression consolidation

Try:

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

Thanks,

AS