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

How to subtract string from a string, subfield-wise

Hello all,

I've got two strings:

Let A = 'A, B, C, D, E';

Let B = 'C, E';

I want to get the difference / missing substrings when comparing B with A, i.e. result = 'A, B, D'

B is always is subgroup of A, delimiter is ', ' in this example but could be set as wanted.

In real application, I build the strings dynamically in the frontend, the solution also needs to be one single expression (all expressions are within a chart object with dimensions and need to regard the dimensions, but first start with a simple example).

So, anyone has a nice solution to this already?

Thanks in advance,

Stefan

13 Replies
swuehl
MVP
MVP
Author

Jason,

I agree that doing such stuff in the script might be better - if the strings and substrings are preknown, in my settings they were not, as you already noticed.

I am a little fan of the valueloop() function, since it allows to create a loop in an aggregating expression, e.g. to rebuild the mathematical summing operation using an index (summation symbol ∑ ).

I believe that is not the way the developers at QT were thinking of, but nevermind.

Thanks for sharing your solution,

Stefan

Not applicable

It helped me with another situation. Thanks for posting your solution.

swuehl
MVP
MVP
Author

You're welcome.

Just out of curiosity, could you outline in which context the above solution helped you?

vikasmahajan

Hi Stefan,

Can you please attach Qlik Sense QVF example I need same logic to be implemented !

Thanks

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.