Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

shong
2008-06-23 04:12:21

Hello

I should write this in the output colum of d4 in Tmap right?
If this code can be made in a loop please do let me know.

Yes, you can write the this code on the expression filed of d4 column on tMap.
I can't see your picture, please upload the screenshots from forum diectly.

Best regards

         shong

clionton
2008-06-22 10:52:27

http://hosting05.imagecross.com/image-hosting-13/3756tunitenotcoect.jpgImage Hosting

I had to do a work around as it did not help to write such a big expression. I have done it like above and tried to used the tunite but unfortunatly it did nto work so had to create another job and put these two outputs in job1 as inputs of job1 and added tunite and did the expression completed.

For the folks who are learning this tool ...

I have put in the row5.DIV4  as

(!(StringHandling.TRIM(row5.POS_RPO_1).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_1).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_1).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_1).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_1).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_2).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_2).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_2).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_2).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_2).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_3).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_3).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_3).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_3).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_3).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_4).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_4).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_4).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_4).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_4).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_5).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_5).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_5).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_5).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_5).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_6).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_6).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_6).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_6).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_6).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_7).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_7).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_7).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_7).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_7).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_8).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_8).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_8).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_8).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_8).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_9).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_9).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_9).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_9).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_9).equals("Y88")))&&
(!(StringHandling.TRIM(row5.POS_RPO_10).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_10).equals("WDA"))&&!(StringHandling.TRIM(row5.POS_RPO_10).equals("W49"))&&!(StringHandling.TRIM(row5.POS_RPO_10).equals("X88"))&&!(StringHandling.TRIM(row5.POS_RPO_10).equals("Y88")))? "4" : row5.DIV4

If this code can be made in a loop please do let me know. I would take this opportunity for thanking shong for his idea as to how to write the if condition smile

clionton
2008-06-20 21:47:52

Shong -- Thanks a ton!!!



d4 == if ( B="17"& U="U" & d1="1" & dt="t"& dz="z" & (pr1=! "WA" or "W4" or "X8"or "Y8") & (pr2=! "WA" or "W4" or "X8"or "Y8") & (pr3=!"WA" or "W4" or "X8"or "Y8") &  (pr4=! "WA" or "W4" or "X8"or "Y8") & (pr5=! "WA" or "W4" or "X8"or "Y8") & (pr6=! "WA" or "W4" or "X8"or "Y8") & (pr7=! "WA" or "W4" or "X8"or "Y8") & (pr8=! "WA" or "W4" or "X8"or "Y8") & (pr9=! "WA" or "W4" or "X8"or "Y8") & (pr10=! "WA" or "W4" or "X8"or "Y8")  then "4"


I should write this in the output colum of d4 in Tmap right?

shong
2008-06-20 07:43:22

Hello

if (B="17", U="U") and (d1="1", dt="t", dz="z")

Here, B="17" or U="U" ? B="17" and U="U" ?

In tMap, you can write the if statement like this:
row1.name.equals("shong")?value1:value2

Best regards

         shong

clionton
2008-06-20 05:05:16

part#$d1$dt$dz$d4$pr1$pr2$pr3$pr4$pr5$pr6$pr7$pr8$pr9$pr10$B$U

I have data in this format (125,000 rows flat file .txt)

(part#$d1$dt$dz$d4$pr1$pr2$pr3$pr4$pr5$pr6$pr7$pr8$pr9$pr10$B$U) <== Header

$ ==> delamiter
part# ==> some numbers
d1 ==> either "1" (string) or blank
dt ==> "t" (string) or blank
dz ==> "z" (stirng) or blank
pr1, pr2, pr3, pr4... pr10 ==> contains either blank or "WA" or "W4" or "X8"or "Y8"
B ==> "17" or blank
U ==> "U" or blank

Now how do write a expressions in talend

d4 == 4 [ if (B="17", U="U") and (d1="1", dt="t", dz="z") and pr1 .. pr10 != "WA" or "W4" or "X8"or "Y8"

***initally d4 is blank***

eg:

part#$d1$dt$dz$d4$pr1$pr2$pr3$pr4$pr5$pr6$pr7$pr8$pr9$pr10$B$U
4321$1$t$z$4$$$$$$$$$$$17$U


Thanks in advance smile

Board footer

Powered by FluxBB