Simple UI Builder Class

This UI Builder class is simple class with less code and less effort. UI Builder Class is needed when you want to customize your dialog which pop ups when you open a Report. UI Builder Class helps you to add run time lookups and other controls on the dialog form.

Step1 : Your Class must extends SrsReportDataContractUIBuilder

class SimpleDemoUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogEmplId;
DialogField dialogName;
boolean enable;
SimpleDemoContract contract;

}// two fields emplId and Name will reflect in the lookup in dialog form at the time of report opening.

Step2 : Override the build method

public void build()
{
contract = this.dataContractObject();
dialogEmplId = this.addDialogField(methodStr(SimpleDemoContract, parmEmplId),contract);

}// this method used for adding the field  which is from contract class.

Step3 : Write this below code to get lookup

private void emplIdLookup(FormStringControl emplIdlookup)
{
Query query = new Query();
QueryBuildDataSource qbds_EmplTable;
SysTableLookup sysTableLookup;

// Create an instance of SysTableLookup with the current calling form control.
sysTableLookup = SysTableLookup::newParameters(tableNum(FilterDemo), emplIdlookup);
// Add fields to be shown in the lookup form.
sysTableLookup.addLookupfield(fieldNum(FilterDemo,EmplId));
sysTableLookup.addLookupfield(fieldNum(FilterDemo,Name));
qbds_EmplTable = query.addDataSource(tableNum(FilterDemo));
sysTableLookup.parmQuery(query);
// Perform the lookup
sysTableLookup.performFormLookup();
}

Step4 : Override this method

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

Step5 : Override this method

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

Step6 : Override this method

public void postBuild()
{
super();
dialogEmplId = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(SimpleDemoContract,parmEmplId));dialogEmplId.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(SimpleDemoUIBuilder,emplIdLookup), this);dialogEmplId.lookupButton(2);
}

the Contract Class code and DP class have already been added to the blog. please check it for further reference but one important part has to be added to the contract class i.e in class declaration, the following part has to be updated.

[DataContractAttribute,SysOperationContractProcessingAttribute(classstr(SimpleDemoUIBuilder))]

4 responses

  1. good going mashallah….carry on

    Like

  2. Thanks Hamed

    Like

  3. sysTableLookup = SysTableLookup::newParameters(tableNum(FilterDemo), emplIdlookup);
    Can you explain please?
    FilterDemo is Table for keep EmpId and Name

    Like

Leave a comment