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: 
Anonymous
Not applicable

tMap Sting Manipulation errors

Hello, Getting my feet wet in TOS, so thanks for any help or pointers. I have successfully connected to several DB's and I am able to define jobs that will move data between DB's as expected. I am now trying to make more use of tMap functions such as StringHandler. Within the tMap editor I have a field called "row1.objek" I want to strip leading zeros off. In the DB's this field is defined as a VARCHAR(18) and in tMap they are defined as Strings in both the input and output. Also, It is not a fixed length padding so there could be 12 leading 0's or 10. The input source is MS SQL Server and the output target is MySQL. If I remove this expression it works fine and will load 46k+ recs into MySQL quickly.
In this case I have the following expression defined for that field.

StringHandling.LEFT(row1.objek, 1).equals("0") 



I have tried this exp on the input schema in tMap editor as well as the output schema. When defined at the input schema row1, the job will run but it will not trim the 0's. On the output schema going into MySQL it will fail at compile time with the following error. I am using the same JRE for everything.

At least job "MM_IMPORT" has a compile errors, please fix and export again.
Error Line: 1064
Detail Message: Type mismatch: cannot convert from boolean to String
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.


Apologies for mistaken terminology.
Regards,
Pat

Labels (2)
3 Replies
Rosanero4Ever
Contributor
Contributor

I think the error is due to the return type of equals() which is a boolean while you want store a string.
TRF
Champion II
Champion II

Hi,
This expression tells you if  row1.objek starts with 0 or not resulting in true or false (boolean).
If you want to remove leading 0, use replaceAll regex on right side of the tMap, such as
row1.objek.replaceAll("^0+", "")

which means "replace starting 0s by nothing".
It should work.
Regards,
TRF
Anonymous
Not applicable
Author

Thanks for the pointers. I will say I tried this a couple different ways, with and without the .equals as well as couple other string functions and each returns the same JVM error.
StringHandling.LEFT(row1.objek, 1).equals("0") 


But I managed to get it working using the TalendString exp as follows

TalendString.talendTrim(row1.OBJEK,'0',0)

My preference is to use regex pattern matching, but I wanted to get a better handle on the builtin exp/functions in Talend. 
Thanks again,
Pat