Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Seperate and count the delimited values using front end expression

Hi Team,

Is it possible to get below given output from the input data using front end expression.

Query.JPG

13 Replies
a_mullick
Creator III
Creator III

Hi,

I am not sure it is, as you need some sort of 'explode()' function.

Much easier (and more flexible) to do at script load...

Thanks,

Azam

sushil353
Master II
Master II

Hi,

Try this:

SubStringCount(Concat(Dept_List),',')

HTH

Sushil

a_mullick
Creator III
Creator III

I thought that at first too, but I think it will fail as the example given needs a distinct count of departments.

Cheers,

Azam

sushil353
Master II
Master II

PFA

It is working as expected

sunny_talwar

I just tested Sushil‌'s expression and it seems to be working well:

Capture.PNG

tresesco
MVP
MVP

Sushil's expression actually counts the number of commas (',') which is incorrect(because in that distinction is not being considered). Try adding more rows with repeated department - you will see the wrong output.

I guess it's going to be a tricky one (if at all possible) in the front-end.

a_mullick
Creator III
Creator III

Ok, but I think this may be more good fortune - I'm not sure it will generalise to more complex cases, the concat() function results in an undefined dept 'BA' in the intermediate results and it is only correct for EMP2, because 'D' is repeated, if EMP2 were A,B,C,D,E, it would return the wrong result (4 insted of 5)...but yes it works for this exact example.

Thanks,

Azam

avinashelite

try to do it in the script level that would be the best to achieve it, front expression will not be sure on this kind of case

Not applicable
Author

Hi Azam,

I want to do this in expression level. Not like the method used in attached file

Thanks,

Anoop