Multi select Lookup of company (Legal Entity) in SSRS Report AX 2012
Contract Class
Class Declaration
[DataContractAttribute,SysOperationContractProcessingAttribute(classStr(ShyamTestReportUIBuilder))]
public class ShyamTestReportContract implements SysOperationValidatable , SysOperationInitializable
{
List entity;
}
paramEntity() Method
[DataMemberAttribute('Entity'),
AifCollectionTypeAttribute('Entity', Types::String),
SysOperationLabelAttribute(literalstr("Entity")),
SysOperationHelpTextAttribute(literalstr("Entity"))]
public List parmEntity(List _entity = entity)
{
entity = _entity;
return entity;
}
Validate() for empty selection
public boolean validate()
{
boolean ret;
List lstEntities = new List(Types::String);
lstEntities=this.parmEntity();
if(!lstEntities.elements())
{
ret = checkFailed("@SYS330812");
}
return ret;
}
UIBuilder Class
public class ShyamTestReportUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogEntity;
}
Add new custom Method for lookup lookupEntity ()
public void lookupEntity (FormStringControl _formStringControl)
{
Query query = new Query();
TableId multiSelectTableNum = tableNum(DataArea);
container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(DataArea, id))];
query.addDataSource(tableNum(DataArea));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,id));
query.dataSourceTable(tableNum(DataArea)).addSelectionField(fieldNum(DataArea,Name));
SysLookupMultiSelectGrid::lookup(query, _formStringControl,_formStringControl,selectedFields);
}
Modify build() method as below
public void build()
{
ShyamTestReportContract shyamTestReportContract1;
super();
shyamTestReportContract1= this.dataContractObject() as ShyamTestReportContract;
dialogEntity= this.bindInfo().getDialogField(shyamTestReportContract1,methodStr(ShyamTestReportContract, parmEntity));
if (dialogEntity){dialogEntity.lookupButton(2);}
}
Modify postRun() as below
public void postRun()
{
dialogEntity.registerOverrideMethod(methodStr(FormStringControl, lookup),methodStr(ShyamTestReportUIBuilder,lookupEntity),this);
}
Reference
Comments
Post a Comment