Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

String comparision

Hi All,

I have below scenario and need your inputs on how to solve this prob..

I have a variable with complex set analysis which will give the result as below. These are Comments_ID of a table Comment which are separated by ";".

vCommentsID= ( 173-Bogus_ID;1971-Bogus_ID;1972-Bogus_ID;1977-Bogus_ID;1978-Bogus_ID;1979-Bogus_ID)

Now, I need to compare above result set with the column Comments_ID from Comments and extract the remaining values like Comments_text, Comments_dt etc..

For this I used below expression where vcommentsID is the variable as descried above:

=if(SubStringCount('$(vCommentIds)',[comments_Id])>0,[comments_Id])

But the problem is, I'm getting all the desired result as well as few extra rows.

Ex: 173-Bogus_ID is resulting in 2 more ID's 73-Bogus_ID and 3-Bogus_ID from Comments table as these are also substring of the vCommentsId variable. But I don't want these 2 extra comment ID as they don't satisfy the criteria..

Can you please suggest if there is any other way to handle this situation?

Thanks a lot!!

1 Solution

Accepted Solutions
sunny_talwar

May be set this up like this:

vCommentsID = (|173-Bogus_ID|;|1971-Bogus_ID|;|1972-Bogus_ID|;|1977-Bogus_ID|;|1978-Bogus_ID|;|1979-Bogus_ID|)

and then this:

=if(SubStringCount('$(vCommentIds)', '|' & [comments_Id] & '|') > 0,[comments_Id])

View solution in original post

3 Replies
sunny_talwar

May be set this up like this:

vCommentsID = (|173-Bogus_ID|;|1971-Bogus_ID|;|1972-Bogus_ID|;|1977-Bogus_ID|;|1978-Bogus_ID|;|1979-Bogus_ID|)

and then this:

=if(SubStringCount('$(vCommentIds)', '|' & [comments_Id] & '|') > 0,[comments_Id])

Not applicable
Author

Thanks for your reply.. I will try to implement the same and see if it works..

Not applicable
Author

Thanks a lot sunny, it is working now.. Thanks again for ur time