Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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??
Labels (4)
19 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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

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.
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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

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);
Anonymous
Not applicable
Author

I forgot, "numrow_tFileOutputPDF_2" variable is never use after.
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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