Pages

Banner 468 x 60px

 

Wednesday, November 22, 2017

Create Dialog using x++

1 comments
Create Dialog using x++ :

Creating class in ax 2009
declare following variables in class
DialogField DialogFromDate,DialogToDate;
// DateTimeUtil fromDate;
// DateTimeUtil toDate;
FromDate fromDate;
ToDate toDate;

protected Object dialog()
{

Object ret;
DialogRunbase dialog; //= super();
Dialog = super(dialog);
Dialog.caption("Percentage Calculation");
DialogFromDate = dialog.addField(typeid(FromDate));
DialogToDate = dialog.addField(typeid(ToDate));
return dialog;
}

public boolean getFromDialog()
{
boolean ret;
ret = super();
fromDate=dialogFromDate.value();
toDate=dialogToDate.value();
return ret;
}

Dialog in Report using axapta x++ language
Dialog in Report

1. Class Declaration
public class ReportRun extends ObjectRun
{
 dialogField dftest_Enum_EDT;
 dialogField dfFromDate,dfToDate;
 dialogGroup dialogGroup;
 test_Enum_EDT test_Enum_EDT;
 Date dtFrom,dtTo;
 str strtest_Enum_EDT;
}

2. Dialog
public Object dialog(Object _dialog)
{
    DialogRunbase dialog = _dialog;
    ;
    dialogGroup = dialog.addGroup("DialogGroup");
    dftest_Enum_EDT = dialog.addField(typeid(test_Enum_EDT));  //dialog.addFieldValue(typeid(test_Enum_EDT));
    dfFromDate = dialog.addField(typeId(FromDate));//dialog.addFieldValue(typeId(FromDate),dtFrom);
    dfToDate = dialog.addField(typeId(ToDate));//dialog.addFieldValue(typeId(ToDate),dtTo);

    return dialog;
}


3. getFromDialog
public boolean getFromDialog()
{
    ;
    strtest_Enum_EDT = dftest_Enum_EDT.value();
    test_Enum_EDT = dftest_Enum_EDT.value();
    dtFrom = dfFromDate.value();
    dtTo = dfToDate.value();

    return true;
}

4. fetch
public boolean fetch()
{
   ;
    info(enum2str(test_Enum_EDT));
     info(date2str(dtFrom,123,2,4,2,4,4));
    info(date2str(dtTo,123,2,4,2,4,4));
  }
Labels: add Field to dialog, Dialog, Dialog in Report using axapta x++ language, DialogRunbase, getfromdialog
Tuesday, September 20, 2011
Fundamental of Class Declaration in axapta
Class Declaration

The classDeclaration consists of three types of definitions:
Variables used to create fields in the dialog
Variables used within the data manipulation
Local macro to define which variables to pack (in other words,remember for next time, and/or use on the batch server)

In this example the class declaration is as follows:
public class DemoRunBase extends RunBase
{
DialogField dialogAccount;
DialogField dialogFromDate;
DialogField dialogToDate;
LedgerAccount ledgerAccount;
FromDate fromDate;
ToDate toDate;
#DEFINE.CurrentVersion(1)
#LOCALMACRO.CurrentList
ledgerAccount,
fromDate,
toDate
#ENDMACRO
}
The individual fields of the dialog will be initialized in the method dialog(). When the dialog is accepted by the user, the contents of the dialog fields are read in the method getFromDialog(). As both methods have to access the same variables, they are defined as members of the class.
The manipulation in the method run() uses the information from the dialog. This information is stored in variables with specific data types. These variables are initialized in the method getFromDialog() and read in the method run().

The information for the last used dialog values is packed into a container structure. The variables that should be packed are defined in the CurrentList
macro in the classDeclaration.
Labels: Dialog, DialogField, extends RunBase, Fundamental of Class Declaration in axapta, getfromdialog, local macro, public class
Sunday, June 19, 2011
Create a dialog radiobutton in axapta
Create a dialog radiobutton

Dialog dialog = new Dialog();
DialogField df;
FormRadioControl frc;
;
df = dialog.addField(typeid(BaseEnum1));
frc = df.control();
frc.caption("Whatever the label should be");
frc.helpText("Whatever the help message should be");
dialog.run();
Labels: Create a dialog radiobutton, Dialog, dialog field control, help text, put radio button control on dialog box in axapta
Saturday, January 8, 2011
How to Declare dialog variable in class using axapta x++


DialogField DialogFromDate,DialogToDate;

// DateTimeUtil fromDate;

// DateTimeUtil toDate;

FromDate fromDate;

ToDate toDate;

DateTimeAccepted tmpdate;
Labels: Dialog, dialog field, dialogClass example and using dialog in axapta, fromdate, getfromdialog, How to Declare dialog variable in class using axapta, todate
Class and dialog in axapta
DialogField DialogFromDate,DialogToDate;

// DateTimeUtil fromDate;

// DateTimeUtil toDate;

FromDate fromDate;

ToDate toDate;

DateTimeAccepted tmpdate;

protected Object dialog()
{

Object ret;

DialogRunbase dialog; //= super();



;

Dialog = super(dialog);

Dialog.caption("Percentage Calculation");

DialogFromDate = dialog.addField(typeid(FromDate));

DialogToDate = dialog.addField(typeid(ToDate));

return dialog;

}

public boolean getFromDialog()


{

boolean ret;

ret = super();

fromDate=dialogFromDate.value();

toDate=dialogToDate.value();

return ret;

}
public container pack()
{

container ret;

// ret = super();

return ret;

}
Labels: axapta classes, Axapta dialog, Class and dialog in axapta, class dialog, Dailog example, Dialog, dialog creation
Creating dialog through axapta classes
public class Class abc
{
DialogField DialogFromDate,DialogToDate;

// DateTimeUtil fromDate;

// DateTimeUtil toDate;

FromDate fromDate;

ToDate toDate;

DateTimeAccepted tmpdate;
}

protected Object dialog()
{

Object ret;

DialogRunbase dialog; //= super();

;

Dialog = super(dialog);

Dialog.caption("Percentage Calculation");

DialogFromDate = dialog.addField(typeid(FromDate));

DialogToDate = dialog.addField(typeid(ToDate));

return dialog;

}

Dialog and get value from dialog box using Axapta
Below is a Code how  to add dialog and get value from dialog box in dynamics Axapta. This is very simple you just need to create one method which is overridden method is dialog. Dialog method used to initialized dialog box for your form or report but without using get from dialog method you can not get value of dialog control.

So both method is important dialog and getfromdialog.

public Object dialog(Object _dialog)
{
DialogRunbase dialog = _dialog;
DialogGroup dateGroup;
;
dateGroup = dialog.addGroup("");
dateGroup.frameType(1);
dateGroup.columns(2);
fromdate = LedgerPeriod::findOpeningDate(systemdateget());
toDate= systemdateget();
dialog.addGroup("@SYS4083",dateGroup);
dialogFromDate = dialog.addFieldValue(typeid(FromDate),fromDate,'',"@SYS67");
dialog.addGroup("@SYS8828",dateGroup) ;
dialogToDate = dialog.addFieldValue(typeid(ToDate),toDate,'',"@SYS67");
dialog.addGroup("@SYS24500");
dialogPageChange = dialog.addFieldValue(typeid(NoYes),pageChange,"@SYS15349","@SYS24755");
dialogResetPage = dialog.addFieldValue(typeid(NoYes),resetPage,"@SYS9358","@SYS24756");
dialog.addGroup("@SYS12608");
dialogDetailSummary = dialog.addFieldValue(typeid(DetailSummary),detailSummary,'',"@SYS24757");
dialogNoneBeginTransEnd = dialog.addFieldValue(typeid(NoneBeginTransEnd),noneBeginTransEnd,
"@SYS1046","@SYS69638");
dialogIncludeOpening = dialog.addFieldValue(typeid(NoYes),includeOpening,"@SYS23250","@SYS54008");
dialogIncludeClosing = dialog.addFieldValue(typeid(NoYes),includeClosing,"@SYS14844","@SYS82258");
dialog.addGroup("Opening Balance Account");
dialogOpeningBalance = dialog.addField(typeId(LedgerAccount)
,"Opening Balance Account");
return dialog;

}

public boolean getFromDialog()
{
;
fromDate = dialogFromDate.value();
toDate = dialogToDate.value();
detailSummary = dialogDetailSummary.value();
pageChange = dialogPageChange.value();
resetPage = dialogResetPage.value();
noneBeginTransEnd = dialogNoneBeginTransEnd.value();
includeOpening = dialogIncludeOpening.value();
includeClosing = dialogIncludeClosing.value();
OpLedgerAccount = dialogOpeningBalance.value();

return true;
}


Creating a Dialog in X++
Creating a Dialog in X++ or AX 2009

static void CreateDialog(Args _args)
{
  Dialog dailog= new Dialog("Test Dialog");//(Created a object of Dialog class)
  Dialogfield field1,field2,field4,field3;//(objects of Dialog field Returns Dialogfield)
  DialogTabpage tab;//(object of DialogTabpage)
  ;
  field1=dailog.addField(typeid(Transdate));//(Parameter should be EDT or Enum)
  field2=dailog.addField(typeid(AccountName));
  field4=dailog.addField(typeid(CustName));

  tab   =dailog.addTabPage("Overview");//(Creates a new Tab Page )
  field3=dailog.addField(typeid(ABC)); //(Once you create Tab page All the fields after that will in     that )
  dailog.addGroup('Help');//(Creates a  Group)
  dailog.addField(typeid(ItemId));//(Now all the fields will be in Group Help)
  dailog.addText("I am Called"); //(adds text)

  if(dailog.run())//(Checks whether Dialog is running or not)
     {
    info(strfmt("%1,%2",field1.value(),field2.value()));//(Gives Value of field1 and field 2)
     }
}

The Output  will be as follows




1 comments:

Anonymous said...

I'd like to find out more? I'd want to find out some additional information.

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH