Reg. Dialog & Fetch Method

Hi,

Please Help me in solving following problem.

I have 2 Tables(DataSources) ,named “BankChequeTable” & “BankAccountTrans”.

These tables have following fields incommon : ChequeNum , AccountId , AmountCur , CurrencyCode ,TransDate , Voucher

My job is to build a Report & make a " dialog " in that report on the basis of " ChequeNum “. It must prompt the user to fillup the “ChequeNum” & on the basis of that " ChequeNum” , the system should fetch " ChequeNum , AmountCur , TransDate , Voucher "

I have tried 40-50 times but since I am new to Axapta, I am not able to do it successfully. I have written Dialog method and when wrote fetch method, then on entering the chequeNum to the dialog prompt , the syatem is fetching either all the datas or says " Report Is Empty ".

Please Guide Me…

hi,

Use this code

public boolean fetch()

{

boolean ret;

;

queryRun = new QueryRun(this);

queryRun.query().dataSourceTable(tablenum(BankChequeTable)).addRange(fieldnum( BankChequeTable,ChequeNum)).value(queryRange(dialogfield , dialogfield));

ret = super();

return ret;

}

Hi ,

Thanks For Your Valuable Suggestion , I used above code, but it is not working as the system is going to “Debugger” mode & a message is coming that

"QueryBuildDataSource object is not initialised ."

Please help me… I am elaborating my A - Z move on coding following ,kindly check & inform me for any modification or change in code…

***** CLASS DECLARATION *****

public class ReportRun extends ObjectRun

{

BankAccountTrans bankAccountTrans;

BankChequeTable bankChequeTable;

DialogField dialogChequeNum;

DialogField dialogTransDate;

BankChequeNum chequeNum;

AmountCur amountcur;

Voucher voucher;

}

DIALOG*

public Object dialog(Object _dialog)

{

DialogGroup dialogColumns;

DialogRunbase dialog = _dialog;

;

dialog.caption(“Check Information”);

dialogColumns = dialog.addGroup("@SYS8815");

dialogChequeNum = dialog.addFieldValue(typeid(BankChequeNum),chequeNum);

dialogColumns.columns(1);

return dialog;

}

GET FROM DIALOG

public boolean getFromDialog()

{

chequeNum = dialogChequeNum.value();

return true;

}

FETCH*

public boolean fetch()

{ QueryBuildDataSource qbds;

QueryBuildRange qbr;

QueryBuildRange qbrs;

boolean ret;

;

queryRun = new QueryRun(this);

queryRun.query().dataSourceTable(tablenum(BankChequeTable)).addRange(fieldnum( BankChequeTable,ChequeNum)).value(queryRange(dialogChequeNum , dialogTransDate));

ret = super();

return ret;

}

PLEASE CHECK THE ABOVE CODE & PLEASE SUGGEST FOR ANY CHANGE

Hi Axapta Dev,

May I Know for what purpose you are using two tables here… since all your required fields are in Bank account trans table you can just use that table right?? Correct me if you have any logic behind that. And may i know is that mandatory for you guys to use the dialog??

Hi,

just use this

public boolean fetch()

{

boolean ret;

;

queryRun = new QueryRun(this);

queryRun.query().dataSourceTable(tablenum(BankChequeTable)).addRange(fieldnum(BankChequeTable,ChequeNum)).value(queryRange(dialogChequeNum, dialogChequeNum));

ret = super();

return ret;

}

Hi,

Thanks For Your Valuable Suggestion… formerly I was having two tables , but since I was having problem in retrieving datas on the basis of one table from the another table, So…I changed my decision & retrieving the data from One datasource now.

I have been told to use “Dialog”.

Thanks Sir

Jyothi Ma’m,

I used ur above code & the system is still going to debudder mode , throwing the previous error as "QueryBuildDataSource object is not initialised ."

I think that QueryBuildDataSource is not used in my code and needs to be initialised or used in my code.Kindly Guide me…I am new to Axapta.

Thanks & Regards

Shivani

As you have only one datasource in report use dataSourceNo(int id) rather than datasourcetable(tableid).

Ambanna Yatnal