Wednesday, 24 February 2021

Ax2012 Multi Select Report Parameter

 In this post I share you step by step how to build multi-select lookup for SSRS report.

1: Create Contract class

[

DataContractAttribute,

SysOperationContractProcessingAttribute(classStr(SL_ WarehouseMultiLookUIBuilder))

]

class SL_WarehouseMultiLookContract

{

List                             warehouse;

}

we need to create the parm method in the contract class for this multi select warehouse.

2: Create parmWarehouse Method

[

DataMemberAttribute(“warehouse”),

SysOperationLabelAttribute(“warehouse:”),

AifCollectionTypeAttribute(“warehouse”,Types::String)

]

public List parmWarehouse(List _warehouse = warehouse)

{

warehouse  = _warehouse;

return warehouse;

}

3: Create UI Builder class

class SL_ WarehouseMultiLookUIBuilder extends SysOperationAutomaticUIBuilder

{

DialogField                                     dfWareHouse;

SysLookupMultiSelectGrid            msCtrlWarehouse;

}

we need to bind the control to this parm method of multi select warehouse lookup to the dialog box in the build method of the UI Builder Class.

4: Create build method

public void build()

{

Dialog localdialog;

localdialog = this.dialog();

datacontract = this.dataContractObject();

this.addDialogField(methodStr(SL_WarehouseMultiLookContract , parmWarehouse),datacontract);

}

5: Create lookup Warehouse

private void WareHouseLookup(FormStringControl _control)

{

msCtrlWarehouse = SysLookupMultiSelectGrid::construct(_control, _control);

msCtrlWarehouse.parmQuery(this.WareHouseQuery());

msCtrlWarehouse.run();

}

6: Create warehouse Query

private Query WareHouseQuery()

{

Query       query;

query = new query();

query.addDataSource(tableNum(InventLocation));

query.dataSourceTable(tableNum(InventLocation)).addSelectionField(fieldNum(InventLocation,     InventLocationId));

return query;

}

7: Create post build method

super();

dfWareHouse   = this.bindInfo().getDialogField(datacontract, methodStr(SL_WarehouseMultiLookContract , parmWarehouse));

dfWareHouse.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(SL_ WarehouseMultiLookUIBuilder ,WareHouseLookup), this);

if (dfWareHouse)

{

dfWareHouse.lookupButton(2);

}

8: Create post run method

public void postRun()

{

dialogLocal.dialogForm().formRun().controlMethodOverload(false);

this. WareHouseLookup();

}

after complete these step Refresh your Dataset and deploy report.

Below is the screen shot of the multi select lookup of how its looks like.

WH WH2

No comments:

Post a Comment

POSTMAN D365

  Postman is useful to test the behavior of different OData class from/to D365FO. In this post we will see the steps to setup Postman with D...