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

Tmap condition expression problem

Bonjour tout le monde, 

Je vous remercie infiniment si vous pouvez m'aider à résoudre ce problème, Je suis bloqué et je n'ai pas pu avancer. 

J'ai une colonne sexe dans mon fichier xls qui dispose d'une valeur soit "Homme" soit "Femme",
Tout simplement Je voudrais avoir le même fichier en sortie (Output) mais dans la colonne sexe au lieu de "Homme" et "Femme" je voudrais afficher "H" si je dispose de "Homme" et "F" si je dispose de "Femme".

J'ai utilisé Tmap et j'ai utilisé cette condition pour avoir le résultat voulu :
row7.Sexe.equals("Homme")?"H":"F"

Mais ça n'a pas marché , il m'a affiché cette erreur : Vous trouverez les captures d'écran ci-dessous

 Je vous remercie beaucoupppp.

Labels (2)
3 Replies
akumar2301
Specialist II
Specialist II

(row7.Sexe == null  || row7.Sexe.length() == 0 )? "" : row7.Sexe.equals("Homme")?"H":"F"

TRF
Champion II
Champion II

As shown by @uganesh answer, this is due to null value for at least 1 record (#89).

Applying the suggested solution you will be protected against null values.

You may also choose to exclude these records using a tFilterRow component or a filter expression in your tMap.

As this is a trivial case, the answer has been possible but for future, try to write your questions in english (I do the effort too) and join complete screen captures with error messages when possible.

Anonymous
Not applicable
Author

Hello,

Please stick to one topic:https://community.talend.com/t5/Design-and-Development/Tmap-condition/m-p/157915/highlight/false#M96...

In this way, we will pay individule attention to your issue.

Best regards

Sabrina