Sunday, 2 March 2025

Arrange report parameters in one column - UI Builder

Sometimes customer has requirement to have the specific design changes on report/parameter dialog, we came across one of such requirements to have all report parameters in one column of the dialog. This can be achieved with code of couple of lines in build method of UI builder class.

Here’s a code sample demonstrating how this can be done:


/// <summary>

/// UI builder class for managing report control

/// </summary>

class Demo_ReportUIBuilder extends SrsReportDataContractUIBuilder

{

    DialogField dialogField1;

    DialogField dialogField2;


    /// <summary>

    /// Overriden method to handle the report dialog controls

    /// </summary>

    public void build()

    {

        super();


        dialogField1 =  this.bindInfo().getDialogField(this.dataContractObject(),

    methodStr(Demo_ReportContract, parmField1));

 

                //Set as mandatory

         dialogField1.fieldControl().mandatory(true);


        dialogField2 = this.bindInfo().getDialogField(this.dataContractObject(),methodStr(Demo_ReportContract, parmField2));

        

//Code to arrange fields in one column -

        SysOperationDialog dlg = dialog as SysOperationDialog;

        dlg.mainFormGroup().columns(1);

    }

}


Binding Parameters: We used the getDialogField() method to bind the report parameters to dialog fields. In this example, parmField1 and parmField2 are the parameters being used.
Mandatory Field: The mandatory(true) method is used to set parmField1 as a mandatory field for the report.
Single Column Layout: To arrange all the report parameters in a single column, we accessed the SysOperationDialog and used the mainFormGroup().columns(1) method to set the layout to one column.

If you want to display the parameters in multiple columns, you can modify the columns() value accordingly.

No comments:

Post a Comment

Filtering Company-Specific Product Templates - SysRecordTmpTemplate lookup

Hi Techies - Recently I have come across a requirement where I needed to display product templates specific to a selected company for a give...