• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » decimal format inside a TMAP and "if" usage on var

#1 2007-11-13 22:08:48

vinz
Member
Registered: 2007-10-29
Posts: 15

decimal format inside a TMAP and "if" usage on var

Tags: [format, if]

Inside a tmap I try to do some calculations using a var... Mathematical.INT(row1.Column31)*0.01 (as double) and I put the result on an Excel file.
Is it a way to pre-format the excel column as 12345.60 instead 123455.6 and 123.00 instead 123 ?

Also I try to use if statement on the same TMAP var row:
something like excel function:
if(row1.Column32="D";row1.Column31;"")

is it a way to do use "if" statement on tmap vars?
many thanks !

kind regards
vinz

Offline

#2 2007-11-14 03:50:37

shong
Talend team
Registered: 2007-08-29
Posts: 10297
Website

Re: decimal format inside a TMAP and "if" usage on var

Hi

you can use "if" statement like this: row1.Column32=="D"?row1.Column31:""
for tMap vars

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2007-11-14 14:34:49

vinz
Member
Registered: 2007-10-29
Posts: 15

Re: decimal format inside a TMAP and "if" usage on var

Many thanks shong !

However I still have an issue :

the output row1.Column32 on an excel cell is "D" (without ")
the StringHandling.LEN(row1.Column32) is 1
however the test row1.Column32=="D" is always false !?!
rem: The D value comes from a csv file ....,"D",....

kind regards
vinz

Offline

#4 2007-11-14 18:26:19

vinz
Member
Registered: 2007-10-29
Posts: 15

Re: decimal format inside a TMAP and "if" usage on var

I did a different test :

StringHandling.COUNT(row1.Column32,"D")>0?Mathematical.INT(row1.Column31)*0.01:0
    and it works in my case as a workaround, however I don't understand why the test :
row1.Column32=="D"?Mathematical.INT(row1.Column31)*0.01:0
    is not working...


kind regards,
vinz

Offline

#5 2007-11-16 19:29:06

mhirt
Talend team
Registered: 2006-09-19
Posts: 1633

Re: decimal format inside a TMAP and "if" usage on var

Assuming Column32 is a String, the == operator can't be used.

You can use row1.Column32.equals("D")?Mathematical.INT(row1.Column31)*0.01:0

Regards,

Offline

#6 2007-11-19 16:23:20

vinz
Member
Registered: 2007-10-29
Posts: 15

Re: decimal format inside a TMAP and "if" usage on var

Thanks a lot!

kind regards
vinz

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » decimal format inside a TMAP and "if" usage on var

Board footer

Powered by FluxBB