Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert data type boolean to tinyint(1)

Hello,

 

My source is cassandra DB (data type is boolean) and target is Mysql(data type is tinyint(1)).

I used below Inline condition,but  i am getting only 0 value in "External" field, no single 1 value for "True" in target Mysql.
user.external.equals("true") ? 1 : 0 

 

I have a an string in source "external" with "True/False" as value and in target i have a tinyint type with bit(1) which hold only 1 OR 0.

so i want convert "True/False" to "1/0".



0683p000009Ma4C.png0683p000009MZbV.pngSource Cassandra data type for external field is boolean0683p000009Ma70.pngMysql data Type for external field is tinyint(1)

 

Best regards,

Labels (3)
6 Replies
TRF
Champion II
Champion II

As it is boolean, try this:
user.external ? 1 : 0
Anonymous
Not applicable
Author

Hi TRF,
Getting error.

 

0683p000009Ma6r.png

TRF
Champion II
Champion II

Is user.external daclared as a boolean field on Talend side? 

Anonymous
Not applicable
Author

Hi TRF,

Below is my mapping in tMap.Thanks.

 

0683p000009MZnX.pngMapping In tMap Schema editor

Anonymous
Not applicable
Author

Hi TRF,

 

Yes, declared as a boolean field on Talend for cassandra(source) side and integer for Mysql (Target)side.0683p000009Ma1S.pngCassandra source Data type is boolean,hence i declared boolean on Talend0683p000009MZxz.pngMysql (Target)data type is tinyint(1),but tinyint data type is not there, hence using (int | Integer) data type0683p000009MZos.pngtmap data type declar

TRF
Champion II
Champion II

I confirm it works.

Here is a tMap with the required expression as an example:

0683p000009Ma75.png