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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tmap join and treplace

I have two questions.
1- I connect to sql server and i have a table with two column where if a value is set to null, I join table with second column otherwise I join with first column.
ex. first column - second column
1 X null join with first column
2 XX null join with first column
3 null Y join with second column
4 XXX null join with first column
2- I want substitute the table cell that contain a value in another value but i want substitute entire cell and not only match.
ex. column substitute bye in 1 and all other in 2 ----> column
1 XXbye 1
2 other 2
3 YbyeX 1
4 null 2
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I solved with routine
ex. public static int refererConverter(String referer) {

if(referer == null)
return 1;
else if (referer.contains("facebook"))
return 2;
else return 3;
}

View solution in original post

14 Replies
Anonymous
Not applicable
Author

Can you pl show your existing job design?
Vaibhav
Anonymous
Not applicable
Author

Can you pl show your existing job design?
Vaibhav

These are the screenshots:
in treplace i want substitute all cell table value and not only match
in tmap join with uri_b2c when value is not null otherwise join with uri_b2b. In the output I write product_id
in treplace the column is referer and not product_id, sorry
0683p000009MEUB.png 0683p000009ME1R.png 0683p000009MEUG.png
Anonymous
Not applicable
Author

If you enable Advance mode in tReplace, you could do more complex processing... try that
Vaibhav
Anonymous
Not applicable
Author

If you enable Advance mode in tReplace, you could do more complex processing... try that
Vaibhav

I have already tried it, is to replace only the string that matches. I want substitute all table cell.
Ex.
www.facebook.com matches with facebook but result is www.1.com and not 1.
My goal is substitute all matches with facebook with 1.
Ex.
www.facebook.com -> 1
http://m.facebook.it -> 1
facebook.it/search:? -> 1
Anonymous
Not applicable
Author

hi cicas,
Answer for your second question :
There is no need to use treplace component to replace. i suggest you to do like follows:
remove component treplace_1 and tconvertType_1 from your job, instead of that two componet add tmap_2. something like this:
tgetproduct---(getting full string)-----> tmap_2---lookup (data type integer)---> tMap_1
in tmap_2 just write this statement in expression builder:
(row1.patternCheck.toLowerCase().indexOf("bye") >= 0)?1:2
then you will get as your requirement. "row1.patternCheck" is your row from table
"bye" present -----> 1
"bye" not present -----> 2
hope this will solve your second question.
Regards,
Akki
Anonymous
Not applicable
Author

just for your information "tgetproduct" what i mentioned in my flow is not a component, its a mysql component name which you have given in that snap shot.
Regards,
Akki
Anonymous
Not applicable
Author

hi cicas,
Answer for your second question :
There is no need to use treplace component to replace. i suggest you to do like follows:
remove component treplace_1 and tconvertType_1 from your job, instead of that two componet add tmap_2. something like this:
tgetproduct---(getting full string)-----> tmap_2---lookup (data type integer)---> tMap_1
in tmap_2 just write this statement in expression builder:
(row1.patternCheck.toLowerCase().indexOf("bye") >= 0)?1:2
then you will get as your requirement. "row1.patternCheck" is your row from table
"bye" present -----> 1
"bye" not present -----> 2
hope this will solve your second question.
Regards,
Akki

Thanks for answer but not works. After first row, it shows error NullPointerException.
The same for row1.referer.contains("bye")?1 0683p000009MPcz.pngrow1.referer.contains("hello")?2:3)
Anonymous
Not applicable
Author

hi cicas,
You have to handle null values as well.
row1.patternCheck.equals("")?2 0683p000009MPcz.png(row1.patternCheck.toLowerCase().indexOf("bye") >= 0)?1:2)
if null value put 2 directly or may be 3(Saparate for null). If value is there then check your conditions.
Regards,
Akki
Anonymous
Not applicable
Author

sorry... that become smile in my previous post.
row1.patternCheck.equals("")?2: (row1.patternCheck.toLowerCase().indexOf("bye") >= 0)?1:2)