≡ Menu




Dynamics Ax 2012 : Exploring the Radio buttons as a report parameter

It is common scenario in report development to use check boxes or radio button as parameter.  Any Boolean variable define at data contract class become check boxes at report dialog. But how we make radio button on report dialog. When we require radio button then it means we have more than two values and one value is required to select. For this purpose we have to create a new enum at AOT.   Let see we create a new base enum with Name Enum student.

BaseEnum

 

Right click on EnumStudent and open property window and set Style property as Radio button

EnumProperty

 

 

 

Now you have to create a new data contract class where we define parameter that will contain the selected value for enum.

 

 

 

[DataContractAttribute]

public class StudentDataContacts

{

EnumStudent enumStudent;

}

[ DataMemberAttribute('Student By'),SysOperationLabelAttribute('Student By')

]
public EnumStudent parmStudent(EnumStudent _EnumStudent =

enumStudent )

{

enumStudent = _EnumStudent;

return enumStudent;

}

When we deploy the report and run from menu Item, Report dialog will be appear like as follow screenshot.
Report Dialog

Now questions is that how we used this radio button parameter.

At report level, we can use this radio button parameter for grouping or such other operations. It return string value. For example I used here to just display what value of radio button selected in report Expression as

Expression

We can use this parameter inside the Process report method of Data Provider class as

public void processreport()
{
EnumStudent _EnumStudent;
str _StudentType;
StudentDataContact _DataContact;

_DataContact = this.parmDataContract();

_EnumStudent= _DataContact.parmStudent();

_StudentType=enum2str(_EnumStudent);

_TempStudentList.Firstname ="Ali";
_TempStudentList.LastName="Raza";
_TempStudentList.StudentType=_StudentType;
_TempStudentList.insert();

_TempStudentList.Firstname ="Raza";
_TempStudentList.LastName="Ali";

_TempStudentList.StudentType=_StudentType;
_TempStudentList.insert();

}

Hope this helps.

{ 0 comments… add one }

Leave a Comment