Difference b/w exectution method AND fetch method in "REPORT"?

hello everyone.,

i am working on reports…i m using “execution method” in “Report Design>> Section Goup:Body” method .

but now i want to produce output using fetch method…?

where should i use fetch method and how?

kindly explain with an example…

hi pratham,

Can you confirm me one thing, you are asking about “execution” method or “execute section” method.

if it is execute section method, it is used to dispaly the entire body basing on a condition. if condition you have written in that method satisfies that body will be execute and prints in the report, else body will be disable.

not exactly body you can restrict and print the controls with in the body by specifying appopriate condition in execute section method.

hope you got it…

Hi Pratham,

You can override the fetch method in the report, and under the fetch method you can declare the tables buffer and write your logic, filteration etc. and based upon that you can send the data to design part i.e, output.

Something like this :

public boolean fetch()
    boolean retCode = false;
    BankAccountTable bankAccountTableRec;
    QueryRun qrun;
    // Use the queryRun object that is associated with the
    // report; element refers to the report.
    qrun = new QueryRun(element);

    // Verify that the report dialog works.
    if (! qrun.prompt())
        return retCode;

    // Loop through each record from the data source query of the report.
    while (qrun.next())
        // Get the BankAccountTable fields from the query record.
        bankAccountTableRec = qrun.get(TableNum(BankAccountTable));

        // Exclude ODDBANK from the visible report.
        if (bankAccountTableRec.AccountID != "ODDBANK")
                // Include the current record in the report.
    retCode = true;

    // retCode = super(); // Do not call super() when you override the fetch method.
    return retCode;

You can override the fetch method to filter the data that is displayed in a report. This override does not reduce the number of records that are returned by the query of the report. Instead it prevents some records from being sent to the final report. Each record is examined by the branching logic you add to the fetch method. Branching determines which records to give to the send method. Those records appear in the final report.

public boolean fetch()


// here you can use Query, QuerBuildDataSouce and QuerBuildRange to fetch the data from multiple tables.

// else, if it is not a complex report you can write simple SQL statements also to fetch the final data to send the report

// finally you have to send the final data to print in the report





you can use that table buffer which you are sending to report. event you can write dispaly methods also to fetch the data from other tables by specifying the condition with the table buffer directly if relations exists.

sir its ExecuteSection()…

sit thanks a lot

amazing explanations… :slight_smile:

sir could you please gimme explanation of flow of data from the opening of dialog box,filling of dialog field to data o/p etc in reports… ?

sit thanks a lot :slight_smile:

sir could you please gimme explanation of flow of data from the opening of dialog box,filling of dialog field to data o/p etc in reports… ?

public void executeSection()

what will this code do?

hi pratham,

Dialogs are basically used to give the filter values in the reports. the valus which you are entering into the dialog box fields will works as ranges.

you have to use dialog, getFrom DIalog methods. to enter the values and to get the entered values from the dialog respectively.

in fetch method whille writing the conditional statements you can use the dialog fields variables to pass as ranges.

for example in the class declaration, declare the variable like as shown below

public class ReportRun extends ObjectRun


CustTable custTable;

CustTrans custTrans;

Name AccNum;

real totalAmount;

TransDate FromDate;

CustGroupId CustomerGroup;

DialogField dialogfromdate;

DialogField dialogCustomerGroup;

int a;

AmountCur e,f,g,h,i;

str j,k,l,m,n;

Days d;







and to built the dialog, see the following example dialog method

public Object dialog(Object _dialog)


DialogRunBase dialog;


dialog = super(_dialog);


dialogfromdate = dialog.addFieldValue(typeid(TransDate),FromDate,“As On Date”);

dialogCustomerGroup = dialog.addFieldValue(typeid(CustGroupId),CustomerGroup,“Customer Group”);

return dialog;


to get the entered values put the logic in getFromDialog methos as shown below

Public boolean getFromDialog()



FromDate = dialogfromdate.value();


return true;


finally you have to use those variable in fetch as ranges as shown below

if(FromDate != datenull() && CustomerGroup !=’’)


while select CustTrans_1 join custTable where CustTrans_1.AccountNum == custTable.AccountNum

&& custTable.CustGroup == CustomerGroup

&& CustTrans_1.TransDate <=FromDate && CustTrans_1.Invoice !=’’





hope you got a clear idea…

That perticuler section will have a datasouce table. if the report find the RecId for that table, that section group will be execute and prints in the report else that section group will be hide and super will execute.

amazing… :smiley:


amazing… :smiley:


sir what is the meaning of " else section will hide super will execute"?

kindly explain…

if report not finds the Recid of that perticuler table, condition will be skipped and super will be execute…

if condition skips, that section group will not print in the final report.

here super() means all the logics and controls in the report, if you block the super() also,few rest of the controls may not be shown in your final report.