instruction while in Talend

One Star

instruction while in Talend

hi guys,
i'm a newby and i'm a problem with the instruction while in tMap in Talend (java)
i've setted the variables:
a ------>new Integer(row1.x)*1000
b ------>new Integer(row1.y)*1000
c ------>new Date(new Long(Var.a)).getDay()
d -----> 0
then i've setted the column:
while (Var.a<Var.b)
{
Var.a=Var.a+86400000;
if (new Boolean(Var.c<6 && Var.c>0)) Var.d=Var.d+28800000;
}
where is the problem(s)?
One Star

Re: instruction while in Talend

i don't manage the instrution while, if, for, etc. there is a documentation where i can find the explanation of their use?... in java not in perl, thanks in advance.
Community Manager

Re: instruction while in Talend

Hi
In tMap, you can use the column expression like this: Var.a<Var.b?myValue1:myValue2
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: instruction while in Talend

Hi
In tMap, you can use the column expression like this: Var.a<Var.b?myValue1:myValue2
Best regards
shong

ok, in fact is the only expression that is right but if i want use it in a "while" or "for" expression for example:
while (Var.a<Var.b)
{
Var.a=Var.a+86400000;
if (Var.c!=0) Var.d=Var.d+28800000;
}
i must use "if" because the expression with ? it give error (misplaced construct) and also with "if" it give the same error... where i'm wrong?
p.s.: all Var are int
One Star

Re: instruction while in Talend

so, none has ever used the "while" or "for" expression (java) in Talend? what is the correct syntax?
Employee

Re: instruction while in Talend

Use a routine and code your while into, then call this routine from tMap.
One Star

Re: instruction while in Talend

Use a routine and code your while into, then call this routine from tMap.

a routine?
please where can i find information about how to use a routine?
Employee

Re: instruction while in Talend

You can download the documentation, and find near page 12, in topic Repository > Codes > Routines a short description of this functionality.
You will be able to create new (static) methods in a class and call it from tMap. Take example on System routines if you wish to use in tRowGenerator or other components which need to read parameters from routines.
I created a feature issue 3114 to document more precisely this subject.
You can also see this post http://talendforge.org/forum/viewtopic.php?id=2159.
One Star

Re: instruction while in Talend

Use a routine and code your while into, then call this routine from tMap.

thanks, it works
Four Stars

Re: instruction while in Talend

are there someone who find a solution to use while instruction in tmap talend ????

 


 

Moderator

Re: instruction while in Talend

Hello Rabeb,

Here are online documentations about TalendHelpCenter:tMap scenarios

and https://community.talend.com/t5/Design-and-Development/tMap-expression-syntax/ta-p/21575

What's your job requirement about while in tMap? Does the If / else statement work for you?

Best regards

Sabrina

 

.

 

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: instruction while in Talend

thanks for your reply ! yes if/else  works well i need the structure of while instruction how can i use it with tMap ?? and thank's 

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

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