0
votes

I am very new in birt reporting,Give me a proper solution for my problem.I am Generating a report(.pdf) using birt tool,in which user select the employee by check box and report for that employee is generated. now ,problem is that function getemployeeData() which fetch the employee data calling multiple times even if i select the one employee, I try hard but not get a proper solution. I am describing my problem using code below.

script function which calling multiple times

 count=0;
 objBIRTController = contractandInvoice.model.BIRTConnection();     
 month=params["monthId"].value;
 year=params["year"].value;
 empId=params["empId"].value;
 listMainData= objBIRTController.**getemployeeData**(month,year,empId);

Here getemployeeData() is calling multiple times.

In fecth where listMainData data is iterated.

   if(count < listMainData.size()){
   row["empName"] = listMainData.get(count).getEmpName();
   row["DOJ"] = listMainData.get(count).getDOJ();
   row["empCode"] = listMainData.get(count).getEmpCode();       
   count++;
   return true;

}

return false;

BirtConnection.java

public List<EmployeeDataVO> getemployeeData(String monthId1,
        String yearId1, String empId1) {

       In this method I am retriving list which contains the employee data.

     }
1
can you expand what you mean by "calling multiple times even if i select the one employee": how many times is it called per report execution? Is it always called with the expected employeeID? Does the report still render as expected despite of this issue? - Dominique
I mean to say if i select one employee getemployeeData that i have mention is called only one times,If i select two employee it is two times,Here even if i select only one employee getemployeeData function called multiple times,I meant to say getemployeeData goes in looping - ketan110

1 Answers

1
votes

Assuming the first script is the "open" method of the underlying scripted dataset, it is triggered as many times as this dataset is invoked during report execution. For example:

  • if a table using this dataset is nested in an outer table, "open" method will be invoked for each row of the outer table.

  • if we insert dataset fields into a grid by dragging one by one each field from the control panel onto the grid(which would be a very, very bad way to design reports), "open" method would be triggered for each data field.

For a better understanding: create a new blank report , copy your 3 report parameters and the dataset into it and add a new table just by dragging the whole dataset from the control panel onto the report body. Then run this new report and you will notice "getemployeeData" is invoked only once, because the dataset is bound to only one report element (the table).

Attach a .rptdesign sample if you need more explanations about this.