Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ganeshreddy
Creator III
Creator 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
m_woolf
Master II
Master II

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

ganeshreddy
Creator III
Creator III
Author

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

m_woolf
Master II
Master II

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

sunny_talwar

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

ganeshreddy
Creator III
Creator III
Author

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

m_woolf
Master II
Master II

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

Try it in a textbox.

krishna_2644
Specialist III
Specialist III

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
Creator III
Creator III
Author

Hi Krishna,

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

Thanks,

Ganesh

krishna_2644
Specialist III
Specialist III

Try this:

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


it gives you same result.

1.PNG