Mapping - Adding conditions in tmap

One Star

Mapping - Adding conditions in tmap

Let us say Table1 (T1) has following columns
C1
C2
C3
C4
Table2 (T2) has following columns
C1
C2
C3
C4
I need to do a mapping and move C2, C3 and C4 from T2 to new table T3 only when T1.C1 == T2.C1 && T1.C2 == T2.C2 && T1.C3 == T2.C3
Please help
One Star

Re: Mapping - Adding conditions in tmap

Well more simply

create output table in tMap and ad a filter (+->) with your condition

else you can use a triple inner join

Best Regards

jeremie

Re: Mapping - Adding conditions in tmap

Hello,
I want to put some condition in my tMap.
I have a tiFileInuptDelimited->tMap ->tPostgresqlOutput (my database is Postgres).
All my column in my File are string and I want to put some condition in my tMap to put my data in my table with Integer, Char, Date, etc....
So for the Date, I have a regex expression in my condition and in the expression of my field I am using TalendDate.parseDate ("dd/MM/yyyy", row1.date). So it works when my data of my File is not empty because othwersie it doesn't work.
I tried to put another condition (String.valueOf(row1.date).equals("")) but i have still the same error message:
Caused by: java.text.ParseException: Unparseable date: ""
at java.text.DateFormat.parse(DateFormat.java:335)
at routines.TalendDate.parseDate(TalendDate.java:85)
... 3 more
I also have tried to put String.valueOf(row1;date)==null and i don't have an error but that doesn't go to the database.....
And i have the same rpoblem when i want to parse the String in an Integer....
with Integer.parseInt
thank you for your help
tomlaurenttalend
One Star

Re: Mapping - Adding conditions in tmap

Hello,
I want to put some condition in my tMap.
I have a tiFileInuptDelimited->tMap ->tPostgresqlOutput (my database is Postgres).
All my column in my File are string and I want to put some condition in my tMap to put my data in my table with Integer, Char, Date, etc....
So for the Date, I have a regex expression in my condition and in the expression of my field I am using TalendDate.parseDate ("dd/MM/yyyy", row1.date). So it works when my data of my File is not empty because othwersie it doesn't work.
I tried to put another condition (String.valueOf(row1.date).equals("")) but i have still the same error message:
Caused by: java.text.ParseException: Unparseable date: ""
at java.text.DateFormat.parse(DateFormat.java:335)
at routines.TalendDate.parseDate(TalendDate.java:85)
... 3 more
I also have tried to put String.valueOf(row1;date)==null and i don't have an error but that doesn't go to the database.....
And i have the same rpoblem when i want to parse the String in an Integer....
with Integer.parseInt
thank you for your help
tomlaurenttalend

if you have a new/different question, post it in its own topic (makes it easier 1. for people to realize you have a new question. 2. see that your question has not already been answered), like you did later yesterday: 4655
also, don't post the same question in multiple topics
One Star

Re: Mapping - Adding conditions in tmap

by using which transformations(all) is possible to put conditions for mapping?(i know tmap,other than else...)
One Star

Re: Mapping - Adding conditions in tmap

Hi,
I want to create a condition in the Talend TMap, here's what I do: when the value in the Code column of the table source = "W" in the attribute table CodeDisplay the destination, I would like to display "Woman" and if I find "M" I put "Man" here's what I have but it does not work:
row1.code.equals ("W")? "Woman": "Man"
I tried that too:
row1.code.equals ('W')? "Woman", "Man" / / simple coat with ''
Is what we can put together three alternatives for example:
if it is equal to 'W' to women, if it is equal to "M" to "Man", and if it is not W or M, to "Undefined"
Could you help me please?
Here is the error that appears:
Start a job SujetDuStage 08/09/2011 10:03.
java.lang.NoClassDefFoundError: talenddemosjava/sujetdustage_0_1/SujetDuStage
Caused by: java.lang.ClassNotFoundException: talenddemosjava.sujetdustage_0_1.SujetDuStage
at java.net.URLClassLoader $ 1.run (Unknown Source)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (Unknown Source)
at java.lang.ClassLoader.loadClass (Unknown Source)
at sun.misc.Launcher $ AppClassLoader.loadClass (Unknown Source)
at java.lang.ClassLoader.loadClass (Unknown Source)
Could not find the main class: talenddemosjava.sujetdustage_0_1.SujetDuStage. Program Will Exit.
Exception in thread "main"
Job SujetDuStage ended at 10:03 08/09/2011.
thank you
Community Manager

Re: Mapping - Adding conditions in tmap

Hi,

if it is equal to 'W' to women, if it is equal to "M" to "Man", and if it is not W or M, to "Undefined"
Could you help me please?

The expression as below should work:
row1.code.equals("W")?"Woman"Smiley Sadrow1.code.equals("M")?"Man":undefined")
Hi,
Start a job SujetDuStage 08/09/2011 10:03.
java.lang.NoClassDefFoundError: talenddemosjava/sujetdustage_0_1/SujetDuStage

thank you

This is another problem, the class file is missing, I think you could get the same problem on other jobs.
Which OS? Do you have blank space in the installation path?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch