problem in LookUp in SSRS Report

when i tried to attach a lookup up in SSRS Report…It fails to show… mycodes are attached below … help me.

private void SalesIdLookup(FormStringControl SalesIdLookup)
{
Query query = new Query();
QueryBuildDataSource qbds_CustTable;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;

if (SalesIdLookup != null)
{
// Create an instance of SysTableLookup with
// the current calling form control.

sysTableLookup = SysTableLookup::newParameters(tablenum(CustInvoiceJour), SalesIdLookup);
//sysTableLookup.addLookupMethod(
// Add fields to be shown in the lookup form.
qbds_CustTable = query.addDataSource(tableNum(CustInvoiceJour));
sysTableLookup.addLookupfield(fieldnum(CustInvoiceJour,SalesId), true);
sysTableLookup.addLookupfield(fieldnum(CustInvoiceJour,InvoiceDate),true);

sysTableLookup.parmUseLookupValue(true);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}
}

What is the problem? lookup don’t show values or show an error?

sysTableLookup.addLookupfield(fieldnum(CustInvoiceJour,SalesId), true); <—true is for the field that lookup gonna return to the control, set only one true.

You said “in SSRS report”, I assume you mean in an UI Builder class associated with the data contract class for your report, right?
First of all, use the debugger to check if your method gets called at all - maybe you didn’t register the method correctly.

XBB it shows only TextBox Not showing any lookup fields??

yes martin …was it any error??

You marked my reply as the verified answer, but is seems that the problem hasn’t been resolved. Please unmark it, so the thread is still displayed as something that needs an answer.

If your method isn’t called at all, it doesn’t matter what code is inside. You have to focus on how you say AX to call it. Can you us the implementation of the UI builder class?

I Called It From postRun() method…when i debug thats wont call… postrun method is attached below
public void postRun()
{
Dialog dialogLocal = this.dialog();
DialogField dialogField;

super();

// This method should be called in order to handle events on dialogs.
dialogLocal.dialogForm().formRun().controlMethodOverload(false);

// Override the methods of department field.
dialogField = this.bindInfo().getDialogField(this.dataContractObject(), methodstr(SRCustomLookUpContract, parmSalesId));
dialogField.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(SRCustomLookupsUIBuilder, SalesIdLookup), this);

}

What doesn’t call? Is postRun() called or not? If not, it again doesn’t matter what’s inside.

If it’s called, remove both lines with dialogLocal - it looks like a bug.

check it

axlearn.blogspot.com.es/…/2_12.html

yeah postBuild() also called …but it doesnot show lookup fields

a similar example

axlearn.blogspot.com.es/…/14-sobrescribir-los-metodos-de-los.html

public void build()
{
SRCustomLookUpContract rdpContract = this.dataContractObject();

dialogSalesId = this.addDialogField(methodstr(SRCustomLookUpContract,parmSalesId),rdpContract);
dialogSalesId.lookupButton(1);
}

Your build() method doesn’t call super()! It’s like disabling the whole thing!
Please remove your build() method completely so AX can run its logic.

hey thank u… lookup field came…but when i open it shows error…can u fix it pleaseeee…

Error:Queries with multiple top level data sources cannot be applied to Forms.It shows error like that martin

You’ll have to learn to give us more information. You got an error, but where? What’s the call stack?

when i click loopup button it shows error on below method…
private void SalesIdLookup(FormStringControl SalesIdLookup)
{
Query query = new Query();
QueryBuildDataSource qbds_CustTable;
SysTableLookup sysTableLookup;
QueryBuildRange qbr;

if (SalesIdLookup != null)
{
// Create an instance of SysTableLookup with
// the current calling form control.

sysTableLookup = SysTableLookup::newParameters(tablenum(CustInvoiceJour), SalesIdLookup);
//sysTableLookup.addLookupMethod(
// Add fields to be shown in the lookup form.
qbds_CustTable = query.addDataSource(tableNum(CustInvoiceJour));
sysTableLookup.addLookupfield(fieldnum(CustInvoiceJour,SalesId), true);
sysTableLookup.addLookupfield(fieldnum(CustInvoiceJour,InvoiceDate),true);

sysTableLookup.parmUseLookupValue(true);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}
}

You didn’t actually answer my question - please make sure you include the call stack next time, or at least explain which exact line throws the error. Providing enough information is in your own interest - it increases you chance to a get a solution.

Anyway, I see a bug in your code - you’re trying to return two different fields. Change addLookupfield(fieldnum(CustInvoiceJour,InvoiceDate),true) to addLookupField(fieldnum(CustInvoiceJour, InvoiceDate)) (assuming that your intention is to return sales ID).

By the way, don’t forget that several orders may be covered by a single invoice and one order may be covered by several invoices, therefore sales ID isn’t a reliable identification of an invoice.

thank u…i got look up .
[tag:martin]