how to give range on ax report

hello guys

Iam trying to give Invoiice Accountrange but it does not work on report.Am I missing something?

class declaration;

VendInvoiceAccount VendAccount;

qbr = sysquery::findOrCreateRange(qbd,(fieldNum(VendInvoiceJour, InvoiceDate)));

qbr.value(sysQuery::range(Fromdate,ToDate));

qbr2= SysQuery::findOrCreateRange(qbd,(fieldNum(VendInvoiceJour,InvoiceAccount)));
qbr2.value(SysQuery::value(VendAccount));

while(qr.next())
{
VendInvoiceJour = qr.get(tablenum(vendInvoiceJour));

select localTaxTrans
where localTaxTrans.TransDate == vendInvoiceJour.InvoiceDate &&
localTaxTrans.Voucher == vendInvoiceJour.LedgerVoucher;
}

Is this an SSRS report? Do you have a contract class?
VendAccount - where you are assigning a value to this variable?
Try debugging.

No its Ax report ,Should I assing after qr.next(); with select query?

Do you mean a MorphX report? They’re deprecated, you shouldn’t be using them at all in AX 2012. They exist there only you to upgrade your reports to SSRS.
Anyway, as Kranthi, your code doesn’t show any assignment to VendAccount variable, which looks like a bug.

am trying to give range from report’s datasource.vendaccount is not a dialog field.i am adding from datasource to show in dialog page.when i debug,sysquery:value.comes empty.createorrange line comes with value but the sysquery:value line comes empty.how can i give range fatasource’s field to bring selected value

I am not clear. If it is not a dialog field, why are you adding the range and values ? What is the use of below code?

qbr2= SysQuery::findOrCreateRange(qbd,(fieldNum(VendInvoiceJour,InvoiceAccount)));
qbr2.value(SysQuery::value(VendAccount));

they want me to bring all vendInvoices on reports,so I am trying to give InvoiceAccount filter to bring it.but Its not a dialog filed but I can add from datasource’s to show on dialog page.

Can you add a screen shot of your dialog and explain what you need in detail?

oh thanks Kranti I figure out it when I debug it. thank you so much for your helps