• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

#1 2008-06-09 23:38:12

strpdsnk
Member
Registered: 2008-03-25
Posts: 328

[resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

I'm trying to read some summary information out of several files and then send all of that information as the message body of an email.

It seems, comparing the errors I got in the basic run (pics 1&2) and the first run (pics 3&4) with tArray to the errors in the second run (pics 5&6) with tArray and tArrayIn, that the second/final run is more on track.  But I'm not sure what to do about  this error:

Exception in component tArrayIn_1
java.lang.ClassCastException: notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$row2Struct cannot be cast to notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$OnSubjobOkStructarray_tArray_1
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tArrayIn_1Process(Summarize_SuccessErrorCounts.java:1800)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:1400)

Pictures
1. Basis of job.  tLogRow has the data I want to email in tSendMail2
2. Component info for Pic #1

Code:

row1.OUTPUT_FILENAME+" | "+row1.MAIN_REM_LINE+" | "+row1.CMD_LINE+" | "+row1.Nb_ERR+" | "+row1.Nb_SUC+"\n"

Starting job Summarize_SuccessErrorCounts at 17:19 09/06/2008.
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-list_compo-instrument|UPDINS list_compo instrument|0|4038
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-synonym-instrument|UPDINS synonym instrument|0|4038
20080605_210046_251_Other-Batch-instr_c.output.xml|Other-instr_chrono-instr_chrono|UPDINS instr_chrono |1|82
20080605_210046_251_Other-Batch-instr_c.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|1|82
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    row1 cannot be resolved
    row1 cannot be resolved
    row1 cannot be resolved
    row1 cannot be resolved
    row1 cannot be resolved

    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tSendMail_2Process(Summarize_SuccessErrorCounts.java:1129)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:962)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.runJobInTOS(Summarize_SuccessErrorCounts.java:1338)
20080605_210056_501_Other-Batch-instr_p.output.xml|Other-instr_price-instr_price|UPDINS instr_price |20|37
20080605_210056_501_Other-Batch-instr_p.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|20|37
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.main(Summarize_SuccessErrorCounts.java:1235)
Job Summarize_SuccessErrorCounts ended at 17:19 09/06/2008. [exit code=0]

3. Try 1: using tArray
4. Try 1: Component information

Code:

array_tArray1.OUTPUT_FILENAME+" | "+array_tArray1.MAIN_REM_LINE+" | "+array_tArray1.CMD_LINE+" | "+array_tArray1.Nb_ERR+" | "+array_tArray1.Nb_SUC+"\n"

Starting job Summarize_SuccessErrorCounts at 17:23 09/06/2008.
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-list_compo-instrument|UPDINS list_compo instrument|0|4038
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-synonym-instrument|UPDINS synonym instrument|0|4038
20080605_210046_251_Other-Batch-instr_c.output.xml|Other-instr_chrono-instr_chrono|UPDINS instr_chrono |1|82
20080605_210046_251_Other-Batch-instr_c.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|1|82
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    array_tArray1 cannot be resolved
    array_tArray1 cannot be resolved
    array_tArray1 cannot be resolved
    array_tArray1 cannot be resolved
    array_tArray1 cannot be resolved

    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tSendMail_2Process(Summarize_SuccessErrorCounts.java:1341)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:1174)
20080605_210056_501_Other-Batch-instr_p.output.xml|Other-instr_price-instr_price|UPDINS instr_price |20|37
20080605_210056_501_Other-Batch-instr_p.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|20|37
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.runJobInTOS(Summarize_SuccessErrorCounts.java:1551)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.main(Summarize_SuccessErrorCounts.java:1448)
Job Summarize_SuccessErrorCounts ended at 17:23 09/06/2008. [exit code=0]

5. Try 2: using tArray & tArrayIn
6. Try 2: Component information

Code:

row3.OUTPUT_FILENAME+" | "+row3.MAIN_REM_LINE+" | "+row3.CMD_LINE+" | "+row3.Nb_ERR+" | "+row3.Nb_SUC+"\n"

Starting job Summarize_SuccessErrorCounts at 17:29 09/06/2008.
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-list_compo-instrument|UPDINS list_compo instrument|0|4038
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-synonym-instrument|UPDINS synonym instrument|0|4038
20080605_210046_251_Other-Batch-instr_c.output.xml|Other-instr_chrono-instr_chrono|UPDINS instr_chrono |1|82
20080605_210046_251_Other-Batch-instr_c.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|1|82
20080605_210056_501_Other-Batch-instr_p.output.xml|Other-instr_price-instr_price|UPDINS instr_price |20|37
Exception in component tArrayIn_1
java.lang.ClassCastException: notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$row2Struct cannot be cast to notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$OnSubjobOkStructarray_tArray_1
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tArrayIn_1Process(Summarize_SuccessErrorCounts.java:1800)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:1400)
20080605_210056_501_Other-Batch-instr_p.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|20|37
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.runJobInTOS(Summarize_SuccessErrorCounts.java:2058)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.main(Summarize_SuccessErrorCounts.java:1955)
Job Summarize_SuccessErrorCounts ended at 17:29 09/06/2008. [exit code=1]


Uploaded Images

Offline

#2 2008-06-10 07:39:54

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

Re: [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

Hello
The tArray/tArrayIn/tSortIn are the virtual components. see [Forum, topic 2569] tJava tArray.

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    row1 cannot be resolved

You can't use 'row1.column' on another sub job with 'OnsubJobOK' link. About the code generate model, please read this page

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 2008-06-10 17:34:35

strpdsnk
Member
Registered: 2008-03-25
Posts: 328

Re: [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

yes, I realized that I was doing the wrong thing with the first two things I tried.  So I got to using tArray and tArrayIn, and I'm not sure whats wrong about it thats causing the error I'm getting:

Exception in component tArrayIn_1
java.lang.ClassCastException: notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$row2Struct cannot be cast to notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$OnSubjobOkStructarray_tArray_1
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tArrayIn_1Process(Summarize_SuccessErrorCounts.java:1800)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:1400)

Heres the full output I'm getting:

Starting job Summarize_SuccessErrorCounts at 17:29 09/06/2008.
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-list_compo-instrument|UPDINS list_compo instrument|0|4038
20080605_190056_924_Other-Batch-PortiaH.output.xml|Other-synonym-instrument|UPDINS synonym instrument|0|4038
20080605_210046_251_Other-Batch-instr_c.output.xml|Other-instr_chrono-instr_chrono|UPDINS instr_chrono |1|82
20080605_210046_251_Other-Batch-instr_c.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|1|82
20080605_210056_501_Other-Batch-instr_p.output.xml|Other-instr_price-instr_price|UPDINS instr_price |20|37
Exception in component tArrayIn_1
java.lang.ClassCastException: notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$row2Struct cannot be cast to notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts$OnSubjobOkStructarray_tArray_1
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tArrayIn_1Process(Summarize_SuccessErrorCounts.java:1800)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.tFileList_1Process(Summarize_SuccessErrorCounts.java:1400)
20080605_210056_501_Other-Batch-instr_p.output.xml|DMA Analytic Data Native Import File Ticker Synonym Creation|UPDINS synonym instrument|20|37
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.runJobInTOS(Summarize_SuccessErrorCounts.java:2058)
    at notifications.summarize_successerrorcounts_0_3.Summarize_SuccessErrorCounts.main(Summarize_SuccessErrorCounts.java:1955)
Job Summarize_SuccessErrorCounts ended at 17:29 09/06/2008. [exit code=1]

Code:

row3.OUTPUT_FILENAME+" | "+row3.MAIN_REM_LINE+" | "+row3.CMD_LINE+" | "+row3.Nb_ERR+" | "+row3.Nb_SUC+"\n"

Uploaded Images

Offline

#4 2008-06-10 21:59:03

strpdsnk
Member
Registered: 2008-03-25
Posts: 328

Re: [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

Also, while tArray and tArrayIn show up in my Palatte, under Technical, I'm not finding tSortIn under any of the headers/groupings...

Offline

#5 2008-06-11 21:21:33

strpdsnk
Member
Registered: 2008-03-25
Posts: 328

Re: [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

Ok, I got around this by writing the information to an output file, attaching that output file to a tSendMail and then using tFileDelete to delete the output file


Uploaded Images

Offline

#6 2008-09-26 20:02:38

strpdsnk
Member
Registered: 2008-03-25
Posts: 328

Re: [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

I've been told a way to do this sort of thing now:
1. Create a context variable, mine is emailString (Type should be String)
2. Replace tFileOutputExcel_1 (in pic in the last post), with a tJavaFlex to
   a. Concatenate the columns into one string
   b. Add that string to an array
3. Call context.emailString in the message of a tSendMail
4. Remove tFileDelete_1 (in pic in the last post)

So you would have:
1. tFileList
    a. Iterate Link ~> tFileInputXML
    b. Main Link ~> tMap
    c. Main Link ~> tJavaFlex
2. tSendMail
   
***tJavaFlex***

Side Tab: Advanced Settings
Import

Code:

import java.util.*;
import java.util.List;

Side Tab: Basic Settings
Start code

Code:

List<String> lReturn = new ArrayList<String>();

//prints out the name of the current file
    context.emailString += "CurrentFile:" + "\t" + ((String)globalMap.get("tFileList_1_CURRENT_FILE")) + "\n";

//to print out the header, tab delimited (tab delimiter = "\t")
    context.emailString += "Results" + "\n";

Main code

Code:

//adds the string for the current row
lReturn.add(row2.Results);

End code

Code:

//adds a line return after each row from the current file
for(int i=0; i < lReturn.size(); i++) {
    context.emailString += lReturn.get(i) + "\n";
}

//adds a blank line after all rows from current file, to separate your rows from different files
for(int j=lReturn.size(); j <= lReturn.size(); j++) {
    context.emailString += "\n";
}

***tSendMail***
Message

Code:

"File Server: " + context.Server + "\n"
+"File Directory: " + context.FileDirectory + "\n"
+"File Mask: " + context.FileMask + "\n"
+ "\n"
+context.emailString

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] store tLogRow output temporarily, then pass to tSendMail OnSubjobOk

Board footer

Powered by FluxBB