How to Enable Disable Field in Dialog in SSRS Report in Ax 2012

Description:-
sometimes the report itself have UIBuilder Class that's extends from SRSReportDataContractUIBuilder Class, the report dialog build by this class, if you found that's the report has a UIBuilder Class, you can modify the dialog from it, else if the report doesn't has this Class, chick if the Report has a contract Method UIBuilder for the Report, and make you dialog shows in the way you want.
 
First of all you have to create contract class for that and create method for parameters.

Contract Class:-
[DataContractAttribute, SysOperationContractProcessingAttribute(classstr(SampleUIBuilder))]
class SampleContract implements SysOperationValidatable
{
    NoYesId   IsDiamension;
}


[DataMemberAttribute,SysOperationLabelAttribute("Diamension")]
public NoYesId parmDiamension(NoYesId _IsDiamension = IsDiamension)
{
    IsDiamension = _IsDiamension;
    return IsDiamension;
}

No create UI Builder class and give meaningful name for that
UI Builder Class:-
class SampleUIBuilder extends SysOperationAutomaticUIBuilder
{
    DialogField     dialogDiamension;
    SampleContract SampleContract;
} 


public boolean dialoggetDiamension(FormCheckBoxControl _checkBoxControl)
{
    ;
    dialogToDate.enabled(_checkBoxControl.checked());
}


public void build()
{
    int i;
    SampleContract   contract; 

    contract = this.dataContractObject() as SampleContract;
    dialogDiamension = this.addDialogField(methodStr(SampleContract, parmDiamension),contract);
}


public void postBuild()
{
    SampleContract   contract;
    super();
    contract = this.dataContractObject() as SampleContract;
    dialogDiamension  = this.bindInfo().getDialogField(contract, methodstr(SampleContract, parmDiamension));
    dialogDiamension.registerOverrideMethod(methodstr(FormCheckBoxControl, modified),
        methodstr(SampleUIBuilder, dialoggetDiamension), this);
    //dialogToDate.enabled(any2enum(dialogDiamension.value()));
    if (dialogDiamension)
    {
        dialogDiamension.value();
    }
}


public void postRun()
{
    //super();
}

No create Controller Class for run the report
Controller Class:-
class SampleController extends SrsReportRunController
{
    SampleContract Contract;
}


protected void prePromptModifyContract()
{
    super();
    //if (this.parmArgs() && this.parmArgs().record())
    //{
        Contract = this.parmReportContract().parmRdpContract() as SampleContract;
        Contract.parmDiamension();
    //}
}


public boolean showPrintSettings()
{
    return false;
}


public boolean showQueryValues(str parameterName)
{
    return false;
}


public static void main(Args _args)
{
    SampleController controller;
    controller = new SampleController();
    controller.parmReportName(ssrsReportStr(SSRSReportName, SSRSReportDesignName));
    controller.parmArgs(_args);
    controller.startOperation();
}

Now Create Data Procedure class to run you login and get data from procedure.
Data Procedure Class:-
[SRSReportParameterAttribute(classStr(SampleContract))]
class SampleDp extends SRSReportDataProviderBase
{
    SampleContract contract;
    NoYesId     _IsDeamensionEnable;
    MyTable MyTable;
} 


[SRSReportDataSetAttribute("MyTable")]
public MyTable get MyTable ()
{
    select * from MyTable;
    return MyTable;
}


[SysEntryPointAttribute]
public void processReport()
{
    contract = this.parmDataContract() as SampleContract;
    _IsDeamensionEnable = contract.parmDiamension();
}

No in Visual Studio add the following
1.      Add Report
2.      Add Data Set
1.  Set the Properties for that Data Set.
3.      Set the Parameters you want to set blank value for ItemId Parameters
1.      Allow blank = true
2.      Nullable = true
4.      Add Precision Design
5.      Deployed SSRS Report and Run it.

Related Posts

Previous
Next Post »

1 comments:

comments
Anonymous
January 17, 2019 at 2:07:00 PM GMT+5:30 delete

Hi :)
could you explain from where you get "dialogToDate"
dialogToDate.enabled(_checkBoxControl.checked());

Reply
avatar

Thanks for comments.....