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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
JABELLA1634831127
Contributor III
Contributor III

How to replace all strings in a column with a string of specific length using tmap component

Say I want to replace all values in a column with a value of specific length in that column. 0695b00000KBvHuAAL.png

For this input column I only want my output to have "ABCDEFGHIJKL" for one column. How do I do this?

Labels (2)
12 Replies
gjeremy1617088143

Hi, in the tMap you made no link between the input and output column you want with a fixed value and in the output field you add the value you want. ex  "ABCDEFGHIJKL" and all the values of this column will be  "ABCDEFGHIJKL".

send me love and kudos

JABELLA1634831127
Contributor III
Contributor III
Author

Thanks but What if the value is not fixed since the job im making iterates through different files?

gjeremy1617088143

does the lengh is fixed and is the condition to find the value ?

JABELLA1634831127
Contributor III
Contributor III
Author

0695b00000KBj82AAD.png0695b00000KBj9PAAT.pngyes the length is fixed. Attached are the input and output table

JABELLA1634831127
Contributor III
Contributor III
Author

"ABCDEFGHIJKL" is a sample SEIN

gjeremy1617088143

are you able to read data with talend and if yes could you send the content of the talend input?

gjeremy1617088143

you can read the file a first time :

set a global var in a tjavarow :

if(input_row.(yourfield)!=null && StringHandling.LEN

(input_row.(yourfield))==(your lengh value)

globalMap.put("SEIN",input_row.(yourfield));

 

then your read it again and in the tmap output you can set the value with (String)globalMap.get("SEIN")

JABELLA1634831127
Contributor III
Contributor III
Author

Here it is and tmap table. Thanks!0695b00000KBwTSAA1.png0695b00000KBwTNAA1.png

gjeremy1617088143

so do the same you have in tmap but just put the SEIN column in output and add a filter condition on output ("SEIN").equals(row2.A)

and in SEIN column value row2.B.

then you add a tSetGlobalVar after the tmap with a main link (with key "SEIN" and value out.SEIN)

 

then you read again your file and you can use globalMap.get("SEIN") to set the value to all the values of the column