Add Lookup Method for Dimension fields for UI Builder class in Axapta SSRS

To Add Lookup Method for Dimension fields like division ,branch etc using UI Builder class in Axapta SSRS Report you can refer below code.

  #define.DimensionName("Branch")  
   Query          query;  
   QueryBuildDataSource  qbds,qbds1;  
   SysTableLookup     sysTableLookup;  
   DimensionAttribute   dimAttr;  
   ;  
   dimAttr = DimensionAttribute::findByName(#DimensionName);  
   sysTableLookup = SysTableLookup::newParameters(tablenum(OMOperatingUnit),branchCodeLookup);  
   sysTableLookup.addLookupfield(fieldnum(OMOperatingUnit, OmoperatingunitNumber));  
   sysTableLookup.addLookupfield(fieldNum(OMOperatingUnit,Name));  
   query = new Query();  
   qbds = query.addDataSource(tableNum(OMOperatingUnit));  
   qbds.addRange(fieldNum(OMOperatingUnit, OMOperatingUnitType)).value(queryvalue(OMOperatingUnitType::OMBusinessUnit));  
   sysTableLookup.parmQuery(query);  
   sysTableLookup.parmUseLookupValue(False);  
   sysTableLookup.performFormLookup();  

Division dimension lookup method is as below.

 private void divisionCodeLookup(FormStringControl divisionCodeLookup)  
 {  
   #define.DimensionName("Division")  
   Query          query;  
   QueryBuildDataSource  qbds,qbds1;  
   SysTableLookup     sysTableLookup;  
   DimensionAttribute   dimAttr;  
   ;  
   dimAttr = DimensionAttribute::findByName(#DimensionName);  
   sysTableLookup = SysTableLookup::newParameters(tablenum(DimensionFinancialTag),divisionCodeLookup);  
   sysTableLookup.addLookupfield(fieldnum(DimensionFinancialTag, Value));  
   sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag,Description));  
   query = new Query();  
   qbds = query.addDataSource(tableNum(DimensionFinancialTag));  
   qbds1 = qbds.addDataSource(tableNum(DimensionAttributeDirCategory));  
   qbds1.addLink(fieldNum(DimensionFinancialTag,FinancialTagCategory),fieldnum(DimensionAttributeDirCategory,RecId));  
   qbds1.addRange(fieldNum(DimensionAttributeDirCategory, DimensionAttribute)).value(queryvalue(dimAttr.recid));  
   sysTableLookup.parmQuery(query);  
   sysTableLookup.parmUseLookupValue(False);  
   sysTableLookup.performFormLookup();  
 }  

You can call lookup method on post build method in UI Builder class.

  dialogregion.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(GOD_CustomerOutstandingUIBuilder,regionCodeLookup), this);  
   dialogbranch.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(GOD_CustomerOutstandingUIBuilder,branchCodeLookup), this);  

You need to call contract object in following method.

 public void getFromDialog()  
 {  
   contract = this.dataContractObject();  
   super();  
 }