I've looked around and found the documentation for components but what about the syntax
for the talend functions in the expression builder? I can't find anything that lists the functions and their
syntax to know what goes in each parameter. The help box describes it but doesn't actually show the syntax.
If I understand correctly it's basically java if you choose that as your project language right?
I was actually using the word "String1" in place of "row1.name". I should pay attention more than just copy and pasting.
The job is having issues but I need to look at it some more before I post about it to make sure I'm asking the right questions.
Does this make any sense?
1) Get file via FTP.
2) If that's ok read from file
3) use javarow to remove errant newline character
4) output that to new csv file
5) starting with new csv file
6) use tmap to split columns, calculate 2 new columns via a routine
7) push result to mysql table
Hey there,
I am unsure of what you want your design to do exactly but here is a little fix:
Once you get all your files from the ftp, you must first iterate through the files and then read them. Furthermore, I dont think you need to save to file and then read from file unless you need those files later on?
TFTPGet -onOK->TFileList -iterate->TFileInputDelimited-row(main)->TJavaRow-row(main)->tMap-OTSCallDetail(main)->tMySQLOutput-onOk-> tMySQLCommit
Hope it helps.
Basically I'm trying to go through the seven steps I listed. I'm new to the program so I don't know which components to use in certain sitations yet. There's only one ftp file in this job so I don't think I'd neet to iterate through anything. There's a newline character that has to be removed that tjavarow is taking care of. I wasn't sure what components could or could not be linked to each other so I just broke it out a little more literally.
I modified my job at Wiktor's suggestion and I'm still bombing in the map.
LOG:
Starting job OTSImport at 13:32 02/09/2009.
connecting to socket on port 4055
connected
connecting to socket on port 4575
connected
For input string: "Dur."
Exception in component tMap_1
java.lang.NullPointerException
at otstest.otsimport_0_1.OTSImport.tFileInputDelimited_1Process(OTSImport.java:3452)
at otstest.otsimport_0_1.OTSImport.tFTPGet_1Process(OTSImport.java:436)
at otstest.otsimport_0_1.OTSImport.runJobInTOS(OTSImport.java:4528)
at otstest.otsimport_0_1.OTSImport.main(OTSImport.java:4430)
disconnected
disconnected
Job OTSImport ended at 13:32 02/09/2009.
BillCalc function (my java skills are rudimentary so don't laugh too hard when you read it):
package routines;
public class BillCalc {
public static int minutes(Integer duration) {
int rem = 0;
int min = 0;
if ((duration > 0) & (duration < 60))
{return 1;
}
else {
rem = duration % 60;
min = ((duration - rem)/60);
min += (rem >= 30)?1:0;
return min;
}
}
public static double revenue(Integer billminutes, String rate, String calltype){
in a related story,
i get a null pointer exception any time i have a component mapped to the output of tmap.
There's something funny with my expressions or how I'm using tmap.
i get a null pointer exception any time i have a component mapped to the output of tmap.
You should check if there are some null value in some of columns, like row2.call, if so, you need handle the null value first, eg:
row2.call==null?value1
row2.call.equalsIgnoreCase("complete")?value2:value3)
Aslo, I see you add a semicolon ';' at the end of some of expression, need remove it.
Best regards
row2.call==null?value1
row2.call.equalsIgnoreCase("complete")?value2:value3)
when I use this statement it gives me an error about the word "null".
I tried using ISNULL() but it wants to create a method.
I tried using row2.call.equals(null) but it gives a compiler error saying 'null' can't be converted to boolean.
For fields that are empty in the csv file I suppose I need to insert a 0 to indicate false for the boolean value. Or I could
convert those fields to string and just string comparisons and put in true or false depending on the data.
"For input string: "Dur."
Exception in component tMap_1
java.lang.NullPointerException
at otstest.otsimport_0_1.OTSImport.tFileInputDelimited_1Process(OTSImport.java:3452)
at otstest.otsimport_0_1.OTSImport.tFTPGet_1Process(OTSImport.java:436)"
When you get this message, check the generated code of the job, line 3452, and you will know exactly which instruction to modify.
Then use the same syntax you've used for row2.call. Your syntax is right and should not give an error, however, you can try with (""+row2.call).equals("")?value1
row2.call.equalsIgnoreCase("complete")?value2:value3)