Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

ganeshreddy
Contributor III

Expression help !!!

Hi All,

The following expression is not working.

if(CId_Count>1,concat(distinct ServiceType,',')&'Multiple',concat(distinct ServiceType,',')) as Service_String

can any one help.

Cheers,

Ganesh

11 Replies
mwoolf
Honored Contributor II

Re: Expression help !!!

Can you say more than "not working"? Is Service_String empty? Are you getting an error? Can you attach a sample qvw?

ganeshreddy
Contributor III

Re: Expression help !!!

Hi mike,

It says Invalid expression, when i am using the following expression it is working fine, but if i try to add if condition to add string called 'Multiple' it is not working.

     concat(distinct ServiceType,',') as Service_String (Working Fine)

   if(CId_Count>1,concat(distinct ServiceType,',')&'Multiple',concat(distinct ServiceType,',')) as Service_String    (NotWorking)


Cheers,

Ganesh

mwoolf
Honored Contributor II

Re: Expression help !!!

Do you have a field named CId_Count? Notice that the second letter is a capital I not an L

Re: Expression help !!!

mike woolf‌ How did you figure that out that it is not l but I? hahahaha looks the same to me

ganeshreddy
Contributor III

Re: Expression help !!!

Thanks for the replay Mike, It is not a problem with 'CId_Count' name is correct and i got that field in table. Can you tell me, here can i add string (Multiple) like that or is there any other ways to do that ?

Cheers,

Ganesh

mwoolf
Honored Contributor II

Re: Expression help !!!

I don't think there is a problem with: concat(distinct ServiceType,',')&'Multiple'

Try it in a textbox.

krishna_2644
Valued Contributor III

Re: Expression help !!!

Try this.

if(CId_Count>1,concat({1<ServiceType=P(ServiceType)>}distinct  ' ,Multiple, ' & ServiceType) ,concat(distinct ServiceType,',')) as Service_String.


This gives you result like below screenshot.


Capture.PNG

Krishna

ganeshreddy
Contributor III

Re: Expression help !!!

Hi Krishna,

we can not use set analysis in Script. have you got any other options to archive this.

Thanks,

Ganesh

krishna_2644
Valued Contributor III

Re: Expression help !!!

Try this:

if(CId_Count>1,ServiceType & ' ,Multiple', ServiceType & ',')  as Service_String.


it gives you same result.

1.PNG

Community Browser