Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
How to convert data type String with "true" to data type boolean with "1".
Thank you
Best regards
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
@hamza-sellami ,can you provide some example of source and target data?
below the way.
row1.data.equals("1") ? true : false
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
@hamza-sellami ,check the below way .
i want 0 or 1 in Target
like this but not working
row2.licence_info_mutation_gratuite_confirmee .equals(true) ? "1" : "0"
and with your solution i have this message:
@hamza-sellami ,i believe your source data type is boolean,you no need to convert ,what is your target type?
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
Hello,
My target is boolean, and my source is string with 3 values (false, true or null).
Best regards
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