lookups in report dialogs

can anyone plz…reply for this post whether it’s achievable one or not…

I would like to implement Customized lookup in Report Dialog box in Ax2009.

for example i have one field(dlgStudentid ) in report dialog.

I have written like this in the dialog method

public Object dialog(Object _dialog)

{

DialogRunbase dialog = _dialog;

;

dlgStudentid = dialog.addField(typeid(Studentid ))

return dialog;

}

In the above Studentid —edt which has relation with the field(StudentId)

in the main table StudentTable .

In the StudentTable we have duplicate records with StudentId as StudentId is not unique in this table.

So when we are running the report in the dialog prompt its showing duplicate records

i.e StudentId 401

401

402

402

Here we wish to display records uniquely.

like StudentId 401

402

Could you please suggest me how could I achieve this

Regards,

Krishna

Having a student ID which doesn’t identify a student doesn’t sound like a good idea. Why can’t use use a unique field?

If you can’t get the EDT relation properly, you’ll have to change the lookup (FormHelp property on EDT or lookup() method).

thanks for the reply.

i got the solution.

Regards,

Krishna.

Could you please explain the solution, so others with the same problem can find not only your question, but also an answer?

Hi Martin,

i used FormHelp property on the ExtendedDataType

I did like this…

  1. Created Edt with name AccountId

  2. in the FormHelp property of Edt(AccountId) i assigned AccountNumLookup

here AccountNumLookup – form i created for giving lookup

  1. Create the form (AccountNumLookup )

First create a basic form. Usually this form contains not much more than a grid. But you might add additional controls. Then set the following properties on the datasource, so that the form can not be used for editing:

AllowCheck: No
AllowCreate: No
AllowDelete: No
AllowEdit: No
AutoNotify: No
InsertAtEnd: No
InsertIfEmpty: No

Additionally set for the design the following properties to make it look like a proper lookup:

AlwaysOnTop: Yes
Frame: Border
HideToolbar: Yes
WindowType: Popup

a) Add datasource (SudentTable) to the form

b) add Studentid in the form grid as we need lookup from this field.

make Autodeclaration Property --Yes

c) In form init method

public void init()

{

super();

element.selectMode(Studenttable_studentId);

}

d) in the Datasource override executeQuery method and write the code as per the requirement…

in this scenario i wrote like this…

public void executeQuery()

{

this.query().dataSourceNo(1).addGroupByField(fieldnum(Studentatnle,Studentid));

super();

}

  1. finally assign this edt to the DialogField in the report dialog method.

dlgStudentid = dialog.addField(typeid(AccountId))

regards,

Krishna.

Thanks.

For others: the quotation at point 3 is from Axaptapedia: Lookup Form - you can find additional details there.