Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
alexdataiq
Partner - Creator III
Partner - Creator III

Use CONCAT with "other" string functions.

Hi everybody, I'm facing some issues here:

Is it possible to use the Match function with the result of a Concat or Index function over a field? Doesn't seem to be working for me, Match always return 0. Maybe I'm missing something here?

I've a attached a very simple example.

Regards.

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Match('X1', $(=Chr (39) & Concat(Sheet, Chr(39) & ',' & Chr(39)) & Chr(39)))

or this:

=SubStringCount(Chr (39) & Concat(Sheet, Chr(39) & ',' & Chr(39)) & Chr(39), 'X1')

View solution in original post

6 Replies
sunny_talwar

Try this:

=Match('X1', $(=Chr (39) & Concat(Sheet, Chr(39) & ',' & Chr(39)) & Chr(39)))

or this:

=SubStringCount(Chr (39) & Concat(Sheet, Chr(39) & ',' & Chr(39)) & Chr(39), 'X1')

swuehl
MVP
MVP

Or maybe just

=Max(Match(Sheet,'X1'))

though it's not using Concat()..

alexdataiq
Partner - Creator III
Partner - Creator III
Author

Awesome! You're the man Sunny!

If I don't use the dollar expansion what string am I inputting in the second parameter of Match? Chr(39) gets recognized (colored in blue) in the editor so I assumed it was evaluating the string.

Regards

alexdataiq
Partner - Creator III
Partner - Creator III
Author

Yeah, that would also work out. Now that I see it, it's so obvious!

Regards

swuehl
MVP
MVP

If I don't use the dollar expansion what string am I inputting in the second parameter of Match? Chr(39) gets recognized (colored in blue) in the editor so I assumed it was evaluating the string.

I think the expression editor syntax checker is misleading here. It doesn't seem to evaluate the expression at all.

I believe the Match() function expects just literal strings, comma separated as arguments to match the first argument (which could be an expression or field) against.

Besides this, if you like the SubstringCount() function, you don't need the fancy formatting here:

=SubStringCount( Concat(Sheet), 'X1')

or maybe using a delimiter if you have also values like X and 1 in your Sheet field:

=SubStringCount( Concat(Sheet,'|'), 'X1')

or if you want to use Index():

=Index( Concat(Sheet), 'X1')

this might return values > 1 if 'X1' has been found, but Qlik will consider all values >0 as TRUE in a conditional expression (I assume that's where you need this expression)

Regards,

Stefan

alexdataiq
Partner - Creator III
Partner - Creator III
Author

Thank you very much Stefan. I'm sure this will come in handy in the future!

Regards