Friday, 9 December 2016

AOS dependency service or group failed to start

AOS dependency service or group failed to start

Error : windows could not start ax object server service on local computer. Error 1068: the 

dependency service or group failed to start.


Solution : first check sql server and sql server agent services are running check if it is running.
sql server 2012 with error 17051
sometime most of the people come across with this error while starting the service of sql server

Because of this error you can not open Microsoft Ax. Because  when the database is not opening, then AX is also not support.
Solution:1.      Open the event viewer from server manager -> tools







Then select your error the same error which is highlighted saying Sql server evaluation period has     expired. Because of absence of product key , without product key it is useful for only 180 days
1.      In this case you have to maintain sql server again.
2.      So go to sql server installation center -> click on maintenance link then-> edition upgrade

Do next next then it will come on product key page then use any key according to your requerment . I have chosen this yellow mark key.
MS SQL SERVER 2012 SERIAL NUMBER

MICROSOFT SQL SERVER 2012 DEVELOPER
YQWTX-G8T4R-QW4XX-BVH62-GP68Y

MICROSOFT SQL SERVER 2012 ENTERPRISE SERVER/CAL EDITION
748RB-X4T6B-MRM7V-RTVFF-CHC8H

MICROSOFT SQL SERVER 2012 STANDARD
YFC4R-BRRWB-TVP9Y-6WJQ9-MCJQ7


MICROSOFT SQL SERVER 2012 WEB
FB3W8-YRXDP-G8F8F-C46KG-Q998F

MICROSOFT SQL SERVER 2012 ENTERPRISE CORE
FH666-Y346V-7XFQ3-V69JM-RHW28

MICROSOFT SQL SERVER 2012 BUSINESS INTELLIGENCE
HRV7T-DVTM4-V6XG8-P36T4-MRYT6
On the Select Instance page, select the SQL Instance that you want to fix and Click next. It will take some time and finally you will see a final window and click Upgrade:
After completed this .
Select sql server configuration manager

 
Then start sql server manually then start service again then
Then start Microsoft dynamic AX 2012 service again
Now use open AX J

Note: if you came across with is error while starting sql server from sql server configuration manager
 

Then sql did not accept product key, do it again

once the sql server service is running you can run AOS and oprn AX





Thanks 





























Wednesday, 16 November 2016






How to convert AX to Excel using class x++


this is very easy example to learn that how to use excel class.
first need to create excel in your destination, and put the path in the bold letters. and run it .

static void AxtoExcel(Args _args)
{
    SysExcelApplication      sysExcelApplication;  //this is class
    SysExcelWorkBooks        sysExcelWorkBooks;    //this is class
    SysExcelWorkBook         sysExcelWorkBook;       //this is class
    SysExcelWorkSheets       sysExcelWorkSheets;      //this is class
    SysExcelWorkSheet        sysExcelWorkSheet;       //this is class
    SysExcelRange            sysExcelRange;           //this is class
    CustTable                custTable;
    int                      row = 1;
    str                      filename;
    ;

    // name of the file

    filename = "C:\\Users\akshay\Desktop\fa.xlsx";
    sysExcelApplication = sysExcelApplication::construct();


    // create excel workbook and worksheet
    sysExcelWorkBooks =  sysExcelApplication.workbooks();
    sysExcelWorkBook  =  sysExcelWorkBooks.add();

    SysExcelWorkSheets = sysExcelApplication.worksheets();
    SysExcelWorkSheet  = SysExcelWorkSheets.itemFromNum(1);

    //excel columns captions

    SysExcelWorkSheet.cells().item(row,1).value("Account");
    SysExcelWorkSheet.cells().item(row,2).value("Name");
    row++;

    //fill the custtable to excell

    while select custtable
    {
        if(row == 20) // this means to get only 20 row
        break;

        SysExcelWorkSheet.cells().item(row,1).value(custtable.AccountNum);
        SysExcelWorkSheet.cells().item(row,2).value(custtable.Name);
        row++;
        }

//Check whether the document already exists

   if(WinApi::fileExists(fileName))
      WinApi::deleteFile(fileName);

   //Save Excel document
   sysExcelWorkBook.saveAs(fileName);

   //Open Excel document
   sysExcelApplication.visible(true);
   //Close Excel
   //xlsApplication.quit();
   //xlsApplication.finalize();
}




Thanks

Akshay




Add true and false image on your form







Add true and false image on your form



Today i got little improvement. There i have to check qty is greater then another qty.
If it true then print right image or if false then print cross image front of qty field.

Let do this with minimum code.

  1.  First add window control in your form.
  2. Fill the properties like this




4. Now the right code in qualitycheckline table. Mathod.



display inventtestimage resultimage()
{
#resAppl
real total;
;
total = (this.EndQty /  minOne(this.qty())) * 100 ;
if(total < 10)
 return #Image_OK;

return #Image_NotOk;
}





Thanks

Akshay

Tuesday, 15 November 2016





Calculating code Execution time

This code is used to measure the code execution in millisecond and then convert in second.
Try to put this code in your code that you want to mesure.

public void GetExecutiontime()
{
int start;
int end;
int milliseconds;
real seconds;

;
start = winAPI::getTickCount();
sleep(1000);
end = winapi::getTickCount();
milliseconds = end - start;

seconds = milliseconds / 1000;
info(strfmt("total seconds - %1", seconds));
}


I put this code in my class then call this mathod in run mathod.

If you want to run this code in job then run .




Thanks


Akshay

Monday, 14 November 2016


How to add field lookup in your form.




Today i met i problem where i want to create a new line and select item from item field lookup .
But the problem is , client want he want to see item details which is filled in another form.

Example : one form RackInqueryForm , attach RackInqueryTable having these field

Now i want all the field in another form when i lookup by item id. in second form

Second form StockInOutForm .


Go to second form StockInOutForm -> datasource -> field itemid ->mathod -> overrides mathod.
Lookup mathod.

public void lookup(FormControl _formControl, str _filterStr)
{

   sysTableLookup  sysTableLookup = sysTableLookup::newParameters(tablenum(RackInqueryTable), _formControl);

   Query query;
   querybuildDatasource querybuildDatasource;
   ;

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, itemid),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, itemname),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Rack),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Shelf),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, Onhandrack),true);

sysTableLookup.addLookupfield(fieldnum(RackInqueryTable, RamainRackQty),true);

query  =new query();
queryBuildDataSource = query.addDataSource(tablenum(RackInqueryTable));

   // Add sorting index to query

   sysTableLookup.parmQuery(query);

   sysTableLookup.performFormLookup();




  // super(_formControl, _filterStr); // if this line is in not comment then it will lookup dual , //first your query and second default query
}





Thanks 

Akshay




Thursday, 10 November 2016



How to use jumpRef() / how to add go to main table or view details





Today i have add "go to main table" in my form field , in ax 2009 , this is also use full for AX 2012 user also becouse code are same, coding are same.just like view details in ax 2012

Example : i have created a form where i take item id and item name, qty.

now i have to add go to main table/view details on item id .

1. go to your created form,

2. select your form data source,

3. select field that you want to add this.

4. override jumpRef() mathod.

5. write this code according to your requirement.

public void jumpRef()
{
    inventtable inventtable;
    args args;
    menufunction mf;
    ;
// rackinquerytable.ItemId this is your table item id where you want to put this technique.//
// first need to match item id in both table//

    inventtable = inventtable::find(rackinquerytable.ItemId);
    if(!inventtable)
    {
    return ;
    }
    args = new args();
    args.caller(element);
    args.record(inventtable);
    mf = new menufunction(menuitemdisplaystr(inventtable),menuitemtype::Display);
    mf.run(args);

}



Thanks
Akshay

Wednesday, 2 November 2016





Get item name using item id (using active mathod and display mathod)

Today i am using active mathod to store item name in database table using display mathod.

Step1 . create table and take 2 string control one for itemid and second form itemname

Step 2. Write mathod in table mathod dispaly mathod name itemname

display itemname itemname()
{
inventtable inventtable;
;
return inventtable::find(this.ItemId).ItemName;
}

Step3. Now create form take both control and in itemid control datasource new table and datamathod name this display mathod itemname().
By this now when you select itemid , you will select itemname. But by this you will not see itemname in table.

For that

Step4. Form -> datasource mathod -> overwrite active mathod and write this code.

public int active()
{
   int ret;

   ret = super();
   
   RackInqueryTable.itemname = rackinquerytable.itemname();

   return ret;
}


Now you will see change in form and table too.



Thanks


Akshay





Automatic show on-hand inventory after selection particular item.(using modifiedField())


Today i am working on project. While making project i will meet simple requirement at every step .
Some time those who are new in Ax world , need basics , here one is simple technique to get item’s onhand  value on selection.



Step1 . create table name onhandtable.

Step2. Take itemid field and actualonhand field in real control.

Step3. In  table mathod overwrite mathod call modifiedField().

Step4 . and write code





Thanks

Akshay



Wednesday, 19 October 2016






Change the value based on another field.

Today I got very simple modification in form where I have to add two field , 1 for ledgertype and 2 for account . when I select vendor then all the vendor account details shows in 2 field , if select customer then customer account details lookup in 2 field.
Take a real scenario
1.       Create two field in table one is accounttype(enum) and second accountnum(string).

2.       Take enum field and select LedgerJournalACType(vendor, custome bank,ledger etc)

3.       Go to table and create relation.

4.       Right click on relation and create relation name “customer” and table “custtable”

5.       Now right click on customer relation and create fixed relation

6.       Select field “accounttype” then relation with enum value 1(which you can find in LedgerJournalACType enum).

7.       Then create second relation in customer relation is normal relation .

8.       Select field accountnum and second related field in accountnum(custtable).

And for other field continue the steps.




Thanks

Akshay