instruction while in Talend

Highlighted
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)?
Highlighted
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.
Highlighted
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
Highlighted
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
Highlighted
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?
Highlighted
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?
Highlighted
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.
Highlighted
One Star

Re: instruction while in Talend

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

thanks, it works
Highlighted
Four Stars

Re: instruction while in Talend

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

 


 

Highlighted
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.
Highlighted
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 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog