One dialog value depend for next dialog lookup

Dear Fnds,

I have customized customer releated report , in that i have done two dialog fields,1.cust group and 2.custa account

in first we are choosing AP-DD means second dialog has to lookup only that custgroup but not happening this that , So some one help me. for your reference i have given the my codings also , where i did mistake plz help me.

public class ReportRun extends Runbase

{

DialogField TestDialogFields,emplIdField,dialogByDate,dialogToDate,dialoginvoice,myPackingSlipIdField,myLineOfPackingSlipIdField;//,dialogstate,dialogAccountNUm;

fromDate byDate;

fromdate toDate;

packingslipid myPackingSlipId;

tempinv tempinv;

DialogField dialogcustGroup,dialogcustaccount ;

CustTable obj_CustTable,obj_dev_CustTable ;

custaccount CID;

//CustInvoiceId id;

DialogField dialogCreateServiceOrders;

NoYesId createServiceOrders;

CustAccount custAccount,v;

custgroupid custidg;

//ueryRun queryRun;

#define.CurrentVersion(1)

#define.version(1)

#localmacro.CurrentList

createServiceOrders

#endmacro

//variable

int sno,pge;

real unitprc,linamt,invamt,linedis;

itemid invitem;

inventbatchid getInventBatchId;

inventqty qty;

CustInvoiceId invid,oldinvid;//,id;

invoicedate invoicedt;

SalesEndDiscPct TotDisper;

SalesSumLineDiscAmount disc;

SalesSumLineDiscAmountMST disprc;

transdate lrdt;

lrno lrno;

Transporter trp;

VehicleNo vno;

//Tabele

CustInvoiceJour custinvoicejour,jour;

CustInvoiceTrans custinvoicetrans,trans;

InventReportDimHistory inventreportdimhistory,dimhis;

Inventdim inventdim;

real cqty,invqty;

salesId salesId;

//MarkupQty oqty;

boolean isSummaryUpdated;

str lineHeaderPrinted[];

int lineHeaderPrintedCount;

container inventDimSetup;

InventDimCtrl_Rep_Sales inventDimReport;

str inventDimString;

boolean paymentSchedule;

boolean printDocuHeader;

boolean printInventDim;

PaymentStub giroType;

PrintCopyOriginal printCopyOriginal;

ReportSection giroSection;

FirstLast totalsFirstLastPage;

boolean taxPrintTaxFreeBalance;

boolean showFooter;

boolean showFooterPayment;

boolean showFooterEuro;

boolean showFooterPrepaid;

boolean showFooterPrepaidEuro;

boolean showFooterGiro;

boolean showFooterLocalCurAmt;

CustFormletterParameters custFormletterParameters;

CustFormletterDocument custFormletterDocument;

CustParameters custParameters;

CompanyInfo companyInfo;

Map sectionEnabledMap;

PaymMoneyTransferSlip_BE moneyTransferSlip_BE;

PaymMoneyTransferSlip_CH moneyTransferSlip;

ReportStringControl paymentReference;

//Italian feature

boolean goodsDiscount;

DiscPct LineDiscount;

ReportTextControl reportTextControl;

PaymMoneyTransferSlip_FI moneyTransferSlip_FI;

container taxCodesUsed;

TaxTexts_FI taxText;

MarkupTrans markupTrans;

MarkupTmpTrans_FI tmpMarkupTrans;

TaxCode taxCode;

TaxGroup TaxGroup;

boolean custCreditInvoicing;

CustVendCorrectedInvoiceId correctedInvoiceId;

CustVendCorrectiveReason correctiveReason_header;

CustVendCorrectiveReason correctiveReason_lines;

AmountMST originalInvoiceAmount;

AmountMST originalInvoiceVATAmount;

boolean cashDiscOnInvoice;

DiscPct cashDiscPercent;

CashDiscAmount cashDiscAmount;

CashDiscAmount cashDiscAmountTax;

Amount amount;

Amount GrossInvAmount;

boolean isTaxInvoice;

ItemType taxInvoiceItemType;

AmountCur totalSalesBalance;

AmountCur totalDiscount;

AmountCur totalMiscCharges;

AmountCur totalSalesTax;

AmountCur totalRoundOff;

LedgerJournalTrans ledgerJournalTrans;

TaxUnrealizedPayment taxUnrealizedPayment;

//

RefRecId invoiceCount;

SalesLine salesLineRegNumbers;

int a;

str lic;

//

//Tables

InventTrans inventTransLoc,inventTransCheck;

Address address,partyAddress;

InventSite inventSite;

// InventLocation inventLocation;

DirPartyTable dirPartyTable,custPartyTable;

//InventDim InventDim;

//EDT’s

ItemId getItemId;

//InventBatchId getInventBatchId;

TransDate getBatchExpiryDate;

Qty salesInvoiceQty;

Amount salesPrice,SalesNetAmount;

Description itemDescription,cropDescription;

Qty packingUnitQty;

ItemId gloItemId;

//Integer sNo;

#Define.endDisc(‘CustInvoiceJour_EndDisc’)

#Define.sumMarkUp(‘CustInvoiceJour_SumMarkUp’)

#Define.sumTax(‘CustInvoiceJour_SumTax’)

#Define.invoiceRoundOff(‘CustInvoiceJour_InvoiceRoundOff’)

#Define.invoiceAmount(‘CustInvoiceJour_InvoiceAmount’)

#Define.currencyCode(‘CustInvoiceJour_CurrencyCode’)

}

public void dialogPostRun(DialogRunbase _dialog)

{

// super(_dialog);

_dialog.formRun().controlMethodOverload(true);

_dialog.formRun().controlMethodOverloadObject(this);

}

public Object dialog(Object _dialog)

{

DialogRunbase dialog = _dialog;

DialogGroup toFromGroup;

Args _args;

str accountnum,custGroup;

custtable custtable;

custGroupid id;

;

dialogcustGroup = dialog.addField(typeid(CustGroupId),CustGroup,“CustGroup”);

dialogcustGroup.value();

dialogcustaccount=dialog.addFieldValue(typeid(custaccount),custaccount,id);

dialogcustaccount.value();

return dialog;

}

public void Fld4_1_Lookup()

{

SysTableLookup sysTableLookup;

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

Query _query;

FormStringControl _control;

;

sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable),dialogcustaccount.control());

sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum));

sysTableLookup.addLookupfield(fieldnum(CustTable, CustGroup));

_query = new Query();

queryBuildDataSource = query.addDataSource(tablenum(CustTable));

queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, CustGroup));

queryBuildRange.value(dialogcustaccount.value());

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

Thanks

palani