You are on page 1of 2

Simple UI Builder Class

Posted on December 18, 2012 by Raziq


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 o
pen a Report. UI Builder Class helps you to add run time lookups and other contr
ols 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),con
tract);
}// 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), emplIdlooku
p);
// 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(),methodSt
r(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 co
ntract class i.e in class declaration, the following part has to be updated.
[DataContractAttribute,SysOperationContractProcessingAttribute(classstr(SimpleDe
moUIBuilder))]

You might also like