Code for exchange rates in Dynamic AX 2012

Hi, currency::find(CurrencyCode).findExchRate(today()); in Dynamic ax 2009 following code is for Dynamic AX 2012     static ExchRate exchRateFind(CurrencyCode _currencyCode = ”){    ExchangeRateType    ExchangeRateType;   // ExchangeRate        ExchangeRate;    ExchangeRateCurrencyPair    ExchangeRateCurrencyPair;    ExchRate    ret;    ExchangeRateHelper exchangeRateHelper;    TransDate transactiondate;    CurrencyExchangeRate exchangeRate1;    CurrencyExchangeRate exchangeRate;    ;    exchangeRateHelper […]

Data filtration in dialog box In Microsoft Dynamics AX

public class CustAmountCalculation extends RunBase{    DialogField fieldAccount;    CustAccount custAccount; }     public Object dialog(){     Dialog dialog;    DialogGroup groupCustomer;    dialog = super();    fieldAccount = dialog.addField(extendedTypeStr(custAccount), “CustomerAccount”);    return dialog;}     public boolean getFromDialog(){    custAccount = fieldAccount.value();    return super();}     public container pack(){    return […]

List of data validation methods on table level in Dynamic AX

The validation methods allow the programmer to verify that certain conditions are fulfilled before an action is executed.In Axapta, methods of validation at two levels can be programmed: 1.                  Table 2.                  Origin of data of a form It is important to know that the methods of validation of the tables are executed whenever they are […]

Job / class /code to import the CSV / Excel file in to Vendor table in Dynamic AX 2012

Hi,1.Prepare the CSV (If it was excel convert ti CSV)  file containing following fields in same order as belowaccount EnglishName English SearchName Invoice account VendorGroup Terms of payment Currency One-time supplier Country/region Delivery terms Mode of delivery Misc. charges group Buyer group 2. Create a class using below codes and just run by using |> run button or F5 /**********************************************/public class VendorMasterImport extends RunBase{    CommaIo       […]

Code / job to import CSV / Excel to CustTable in Dynamic AX 2012

1.Prepare the CSV (If it was excel convert ti CSV)  file containing following fields in same order as belowCustomer account English Name English Search Name Invoice account Customer group Terms of payment Currency One-time customer Country/region Delivery terms Mode of delivery Misc. charges group Language 2. Create a class using below codes and just run […]

Creating & Using the find() methods in Dynamic AX 2012

Hi,1. Create a table,2. Use the 2 EDTs and make it one as index as unique by property AllowDuplicates : NO3. Create a find method in the table using below code and patten static TableName find(UsedEDT _UsedEDT ,                       boolean          _forUpdate = false,    […]

jumpref() in Dynamic AX

Hi, public void jumpRef(){Args args = new Args();PurchTable     purchTable; // that we are using not in the datasource list or it can be; args.caller(this);purchTable= PurchTable::find(purchTable.PurchID);Args.record(purchTable); new MenuFunction(menuitemdisplaystr(purchTable), MenuItemType::Display).run(args); //menu item name of that form that is to refer}

Find methods() / inserting the values from one form where action is taking place is to be reflect in another form in Dynamic AX

Hi, public void modified() { SMAServiceObjectTable   smaServiceObjectTable; SMAServiceOrderTable    smaServiceOrderTable, smaServiceOrderTable1; //Tables I used here and smaServiceOrderTable1 will act as datasource that I added TableId                 loctableid; super(); loctableid = element.args().record().TableId; if (loctableid == tableNum(smaServiceOrderTable)) smaServiceOrderTable = element.args().record(); ttsBegin; //Updated by Alfasith- This to display in OrderFormTable […]

Lookup() in Dynamic AX

Right click on the field method and override the lookup method in for that stringedit method. public void lookup(){    Query query = new Query();    QueryBuildDataSource queryBuildDataSource;    QueryBuildRange queryBuildRange;    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);    sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));    sysTableLookup.addLookupMethod(tablemethodstr(CustTable,Name));    queryBuildDataSource = query.addDataSource(tableNum(CustTable));    queryBuildRange = queryBuildDataSource.addRange(fieldNum(CustTable, AccountNum));    queryBuildRange.value();    sysTableLookup.parmQuery(query);  […]

Job to create text and write in to it…

static voidTextIoTest(Args _args) {     TextIo Io = new TextIo(@”C:Temptest.txt”, ‘w’);     ;     Io.outFieldDelimiter(”);     Io.outRecordDelimiter(‘rn’);     Io.write(    strLfix(“Bharath Likes”,20), ‘|’, strRfix(“Bel Poori”,15), ‘|’, 117);     Io.writeExp([strLfix(“abc”,20), ‘|’, strRfix(“xyz”,15), ‘|’, 117]);     Io.write(); // To force CR NL }

Report Method Sequence (Methods in reports) in Dynamic AX

Method Description init Initializes the report and its objects. This is the earliest method that can be overridden among those executed when a report is constructed and run. Override this method to add initialization tasks, such as the following: ·    Validation of the argument objects received ·    Initialization of supporting classes ·    Dynamic changes to […]

Method Sequences in Dynamic AX

Event Method Sequences in Form Scenarios User actions on a form are input through mouse pointers and keyboards. These actions cause events that are recognized by Microsoft Dynamics AX. The recognized events include the following: •           Opening a form •           Closing a form •           Leaving a control •           Leaving a record •           Deleting a record […]

Add Base Enum in to the Dialog in Dynamic AX

Hi,   Create a EDT name it Gender then in properties enumType : //select the enum name Use the below code and enjoy. static voidSimple_Dialog (Args _args) { dialog dialog; dialogGroup dialogGroup; dialogField dialogField; dialog = newDialog(“Simple Dialog”); dialogField = dialog.addField(extendedTypeStr(Gender)); if (dialog.run()) { print dialogField.value(); pause; } }   OR TRY Below static void CreateRadio(Args […]

String Function in Dynamics AX

1 – str2Capital () : Convert first character in to Capitalstatic void Jobtest(Args _args)        {            str source,desti;            ;            source  = ‘dynamics ax’;            desti   = str2Capital(source);            info(strfmt(“%1 : %2”,source,desti));        }    Using str2CapitalWord() method convert the first character of the first word in Sentence to Capital. 2- str2Con () : Concatenate the word or sentence from specified […]

Macros in Dynamics AX X++

  A macro is a variable known to the precompiler. The variable can have a value that is a sequence of characters, but it is not required to have a value. The #define directive tells the precompiler to create the macro variable, including an optional value. The #if directive tests whether the variable is defined, and optionally, whether it […]

inserting into table by job in AX X++

static voidDataDic_InsertRecord(Args _args) { MyTable myTable; ; ttsbegin; myTable.initValue(); myTable.accountNum  = “100”; myTable.custName  = “Alt. customer id 100”; myTable.custCurrencyCode  = “USD”; if (myTable.validateWrite()) myTable.insert(); ttscommit; }