Error with tFileOutputPDF Component

One Star

Error with tFileOutputPDF Component

Hi,
I would like to generate a file PDF when an user has no obligatory ownership.
However, it is possible that this file sometimes is empty. When I try a trial game for this case I have this error :

Exception in component tFileOutputPDF_1
java.lang.ArithmeticException: / by zero
at importcrm.importusers_0_1.ImportUsers.tJDBCInput_4Process(ImportUsers.java:2413)
at importcrm.importusers_0_1.ImportUsers.tJava_1Process(ImportUsers.java:492)
at importcrm.importusers_0_1.ImportUsers.tSageCRMConnection_1Process(ImportUsers.java:430)
at importcrm.importusers_0_1.ImportUsers.runJobInTOS(ImportUsers.java:10536)
at importcrm.importusers_0_1.ImportUsers.main(ImportUsers.java:10439)

The job is a simple tMap which tried users with an address mail or not. Some users without adress mail are send from PDF file.
I how do not see resolving this problem??
Community Manager

Re: Error with tFileOutputPDF Component

Hello
java.lang.ArithmeticException: / by zero

Are you doing some calculation in your job? the error means denominator is zero.
Can you load some screenshots of your job?
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Error with tFileOutputPDF Component

So, there is no calculation in my job. I put some datas from Database 1 to Database 2.
However screenshots will explain better.
One Star

Re: Error with tFileOutputPDF Component

Someone knows :
tFileOutputPDF works even if no data are inserted in this file??
I ask this question because I try with a test with the same job but I exchange the table of the first database.
I observed that when there were no data to insert in the file, the error which explained previously appeared. Else, all works perfectly.
One Star

Re: Error with tFileOutputPDF Component

Hi,
could you please switch to the code view and post some code around the line where the Exception is raised (in your example line 2413).
Bye
Volker
One Star

Re: Error with tFileOutputPDF Component

indeed, there was an operation which I didn't see before.
Now, it's work thank you Volker Brehm and shong for your reply.
One Star

Re: Error with tFileOutputPDF Component

I'm sorry but my problem isn't resolve. So, in line 2413, effectively, there is an operation arithmetic :
int numrow_tFileOutputPDF_2 = (listdata_tFileOutputPDF_2.size() / SizeColumns2_tFileOutputPDF_2);
When there is none record listdata_tFileOutput is empty, listdata_tFileOutputPDF_2.size() = 0 ==> ERROR / by zero
and SizeColumns2_tFileOutputPDF_2 is number of columns.
I try to debug this line but then, when I want to run my job by the designer, the error come back.

An idea ?
CODE :
Part of code where the "listdata_tFileOutputPDF" are filled
if (rejectEN != null) {
/**
* start
*/

currentComponent = "tFileOutputPDF_2";
// get the column quantity
SizeColumns2_tFileOutputPDF_2 = 3;
String[] row_tFileOutputPDF_2 = new String;
// add each column name to the list
listhead_tFileOutputPDF_2.add("CodeEncaiseur");
// add each column name to the list
listhead_tFileOutputPDF_2.add("LibelleEncaisseur");
// add each column name to the list
listhead_tFileOutputPDF_2.add("Prenom");
// test the pattern of each data
row_tFileOutputPDF_2 = String.valueOf(rejectEN.CodeEncaiseur);
// Add the data to the dataList
listdata_tFileOutputPDF_2.add(row_tFileOutputPDF_2);
// test the pattern of each data
row_tFileOutputPDF_2 = String.valueOf(rejectEN.LibelleEncaisseur);
// Add the data to the dataList
listdata_tFileOutputPDF_2.add(row_tFileOutputPDF_2);
// test the pattern of each data
row_tFileOutputPDF_2 = String.valueOf(rejectEN.Prenom);
Part of code where the error is
String printHeader_tFileOutputPDF_2 = "true";
String printalternaterow_tFileOutputPDF_2 = "true";
int[] colLengths_tFileOutputPDF_2 = new int;// array
float[] abscolLengths_tFileOutputPDF_2 = new float;// array
int num_tFileOutputPDF_2 = 0;// indice
int totalsize_tFileOutputPDF_2 = 0;// sum of every max column size
---> int numrow_tFileOutputPDF_2 = (listdata_tFileOutputPDF_2.size() / SizeColumns2_tFileOutputPDF_2);
One Star

Re: Error with tFileOutputPDF Component

I forgot, "numrow_tFileOutputPDF_2" variable is never use after.
One Star

Re: Error with tFileOutputPDF Component

Hi,
yes looks like you are right. The variable is defined and set to 0 in the begin section of javajet and, if there is now row, never updated. So this will fail in the end block. So I think the component should be changed to create an empty page if there is no data or never create the file or ... ?
I suggest to contact cahsohtoa, the creator of this module. He is very active for the community. And I'm sure he will fix this problem.
Bye
Volker
Update: I sent him a message
One Star

Re: Error with tFileOutputPDF Component

Thank you for your help Volker Brehm.
So, did you send a mail to cahsohtoa ? And if yes, do you receive an answer?
One Star

Re: Error with tFileOutputPDF Component

Merci..
taux credit consommation
- Taux credit consommation, Un organisme de credit, ou banque de nouvelle generation, offre du credit
consommation
One Star

Re: Error with tFileOutputPDF Component

Yes,
he said he will take a look at this issue. But you are free to contact him directly. May be you could give him some additional information. Looks like you took a closer look at the code...
Bye
Volker
One Star

Re: Error with tFileOutputPDF Component

I downloaded tFileOutputPDF component today.
I want to create a pdf even if there's no data. I'm getting the same error mentioned on this post.
Any resolution is available?
Moderator

Re: Error with tFileOutputPDF Component

Hi viralfti,
Which custom component tFileOutputPDF are you using? The one written by ceppo1996?
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.
One Star

Re: Error with tFileOutputPDF Component

Hi Sabrina
Yes. I downloaded the component from Exchange
tFileOutputPDF 1.0 ceppo1996
Any resolutions or alternate solutions or components?
Thanks
Veer
Seventeen Stars

Re: Error with tFileOutputPDF Component

Yes there is an alternate solution. To create PDF files I suggest using JasperSoft Report Studio.
You create a very professional looking report and with the component tJasperReportExec you run your report within a Talend job.
http://www.jaspersoft.com (the community edition is right enough!)
and
the component:
http://www.talendforge.org/exchange/index.php?eid=549&product=tos&action=view&nav=1,1,1
One Star

Re: Error with tFileOutputPDF Component

jlolling,
I used Jasper reports as an alternate solution. I'm using XML file as DataSource.
I see the output when i preview in report studio.
When I load the report using Jasper ReportExec in Talend the report output of records is Null.
Any ideas? I can share the screenshot.
Thanks
Seventeen Stars

Re: Error with tFileOutputPDF Component

Yes a screenshot would be fine. You have to configure the select expression like in your datasource of iReport.
Alternatively you could use the newest release 1.9 of this component which can use the select expression from the report it self. This should be your preferred solution.
One Star

Re: Error with tFileOutputPDF Component

jlolling,
The new version did the trick. Thanks for the suggestion and support.
Thanks
Seventeen Stars

Re: Error with tFileOutputPDF Component

You should also give Jasper Studio a try. This is the future of report design for JasperSoft. iReport will be supported but will not developed in the same way as Jasper Studio.