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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
sushantk19
Creator
Creator

Implementing LIKE logic in Tmap

Hi,

 

I have to implement the below logic in Tmap:

 

If sku starts with ‘DE-TB%’ then ‘TB’

Elseif sku starts with ‘DE-SB%’ then ‘SB’

 

I tried something like below, but its not working

 

row4.SKU.contains("DE-TB%")?"TB":row4.SKU.contains("DE-SB%")?"SB":row4.SKU.contains("DE-SP%")?"SP":row4.SKU.contains("DE-LB%")?"LB":row4.SKU.contains("DE-WB%")?"WB":row4.SKU.contains("DE-DB%")?"DB":row4.SKU.contains("DE-CM%")?"CM":row4.SKU.contains("DE-PS%")?"PS":row4.SKU.contains("DE-PB%")?"PB":row4.SKU.contains("M1-TA%")?"TA":row4.SKU.contains("M1-PD%")?"PD":row4.SKU.contains("M1-PL%")?"PL":row4.SKU.substring(5,6)

 

if it doesnt match, then it should give the substring as from 5th position - 6 chars. How do i implement this?

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

With Java your don't need the %.

Try this one:

row4.SKU.startsWith("DE-TB") ? "TB" :
    row4.SKU.startsWith("DE-SB") ? "SB" :
        and so on...

 

View solution in original post

6 Replies
TRF
Champion II
Champion II

At least replace "contains()" by "startsWith()"
sushantk19
Creator
Creator
Author

Startswith is not working. Any other way we can do that?basically I want to use LIKE clause % in my query

TRF
Champion II
Champion II


@sushantk19 wrote:

Startswith is not working.


What doesn't work?

Do you any error?

Any compilation error?

Just an unexpected resulted?

What else?

sushantk19
Creator
Creator
Author

yes, the output is not as expected. No errors as such.

 

As per the above mentioned logic, it is not able to read the input values such as "DE-TB%". It skips  this condition and directly executes the else part.

TRF
Champion II
Champion II

With Java your don't need the %.

Try this one:

row4.SKU.startsWith("DE-TB") ? "TB" :
    row4.SKU.startsWith("DE-SB") ? "SB" :
        and so on...

 

sushantk19
Creator
Creator
Author

worked perfectly fine!! thank so much!

issue was I was using % symbol like row4.SKU.startsWith("DE-SB%")