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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

data Type "boolean "

Hello,

 

How to convert data type String with "true" to data type boolean with "1".

 

Thank you 

 

Best regards

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hello,

 

my target is boolean and source is String.

when i use this method :

row2.licence_info_mutation_gratuite_confirmee == null ? null : (row2.licence_info_mutation_gratuite_confirmee.equals(true) ? true : false)  

 

i have this error:

User variable name 'tDBOutputBulkExec_1_tMBE_licence_info_mutation_gratuite_confirmee' is illegal

Thanks

View solution in original post

18 Replies
manodwhb
Champion II
Champion II

@hamza-sellami ,can you provide some example of source and target data?

below the way.

row1.data.equals("1") ? true : false

 

Anonymous
Not applicable
Author

i have a an string in couloumn1 source with "true" as value. and in target i have a boolean type  with bit(1).

so i want convert "true" to "1".

 

Best regards

manodwhb
Champion II
Champion II

@hamza-sellami ,check the below way .

0683p000009M7aQ.png

Anonymous
Not applicable
Author

i want 0 or 1 in Target 

like this but not working 

row2.licence_info_mutation_gratuite_confirmee .equals(true) ? "1" : "0" 
Anonymous
Not applicable
Author

and with your solution i have this message: 0683p000009M7aV.png

manodwhb
Champion II
Champion II

@hamza-sellami ,i believe your source data type is boolean,you no need to convert ,what is your target type? 

Anonymous
Not applicable
Author

@hamza-sellami 

 

Assuming your source is Boolean data and target is integer, could you please try below code snippet?

row2.licence_info_mutation_gratuite_confirmee ? 1 : 0

It will pick 1 if the boolean value is true else it will be 0.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

 

 

Anonymous
Not applicable
Author

Hello,

 

My target is boolean, and my source is string with 3 values (false, true or null).

 

Best regards

Anonymous
Not applicable
Author

Hi,

 

     What is your source data type? The error is showing that source data itself is having boolean data type.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved