Wednesday, October 28, 2015

Overview of Buttons Controls in AX 2012

Button Controls in ax 2012

1.     Button:  The button type does not have a predefined action. Use this button to execute custom X++ code. To create the button action, use the AOT to override the clicked method and enter the X++ code that you want to run. Has a clicked method that works like the clicked event in other languages. Use this for maximal flexibility when you want something to happen when the user clicks on a button. You decide on what you want to happen by overriding the click method.


2.     CommandButton:  Like a button except that you have built in commands that you often won’t customize. For example, one command is called “new”. It literally creates a new record against the data source table. Actions like those rarely need customization, so why not just have a quick and easy way to create them? With the commandButton, we change a quick setting and we are in business.

3.     DropDialogButton: Sometimes, users need a small form to popup when they click a button. You can think of this like the irritating popups on websites except that hopefully, you aren’t irritating your users. You link to the small form when you click this control which looks like a button.

4.     MenuButton:  A menu button is a control that displays a list of buttons. Use a menu button to make buttons available that are rarely used and do not have to be visible in the action pane. Careful not to get this mixed up with the “menu.” Menus are those page options that appear when people open up a client module like Accounts Payable Area Page. They are meant more for modular navigation than form navigation. Menu Buttons are groups of organized buttons that give us the ability to sort our buttons in groups. So we could use a menu button control to organize 4 different buttons (menu item) that each open a different form page.

5.     MenuItemButton: A menu item button opens a specified form in a new window. Use a menu item button when you want to open a detailed form to create or update a record. This is the most commonly used button. It’s main purpose is to provide links and respect built in security. So when a user clicks on it, we will often launch a form or a report. The button only works if the user has the permissions for it to work.


6.     Seperator: Usually, you will place a nice little vertical line between groups of related buttons on your action Pane to make things look nicer. Users will usually fiddle around with that vertical separator (which looks just like a vertical line) until they find the look that they like.

Tuesday, October 27, 2015

How to Create X++ Query in Ax 2012 R3

Hi Friends,

Simple Example of how create X++ Query

static void XPPQuery(Args _args)
{
    Query                   query;
    QueryRun                queryRun;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildDataSource    queryBuildDataSource1;
    QueryBuildDataSource    queryBuildDataSource2;
    QueryBuildRange         queryBuildRange;
 
    CustomerTable           customerTable;
    CardTable               cardTable;
    TransactionTable        transactionTable;
 
 
    query = new query();
    queryBuildDataSource    = query.addDataSource(tableNum(customerTable)); //Add Query
    queryBuildDataSource.addSortField(fieldNum(customerTable,AccountNumber),SortOrder::Descending);
 
    queryBuildRange =    queryBuildDataSource.addRange(fieldNum(customerTable,AccountNumber));
    //queryBuildRange.value(queryValue('11')+('*'));
 
    queryBuildDataSource1   = queryBuildDataSource.addDataSource(tableNum(cardTable));
 
    queryBuildDataSource1.relations(true); // define Relations
    queryBuildDataSource1.joinMode(JoinMode::InnerJoin); //define Join Mode
 
    queryBuildDataSource2   =  queryBuildDataSource1.addDataSource(tableNum(transactionTable));
    queryBuildDataSource2.relations(true);
    queryBuildDataSource2.joinMode(JoinMode::ExistsJoin); // only shows trasancton customers no dublicate;
    queryBuildDataSource2.joinMode(JoinMode::NoExistsJoin);// no did transactions
    queryBuildDataSource2.joinMode(JoinMode::InnerJoin);// all trasaction details with multple times
    queryBuildDataSource2.joinMode(JoinMode::OuterJoin);
 
    queryRun    = new QueryRun(query);  //Passsing Query to Queryrun
 
    while(queryRun.next())
    {
        customerTable = queryRun.get(tableNum(CustomerTable));
        cardTable     = queryRun.get(tableNum(cardTable));
        transactionTable    =queryRun.get(tableNum(transactionTable));
     
        info(strFmt("%1,%2,%3,%4", customerTable.AccountNumber, customerTable.AddressCity,cardTable.Amount,transactionTable.TransID));//customerTable.Name));
 
 
    }
    
 
}

Keep Daxing....!

Thursday, October 22, 2015

How to open Form through X++ or JOB in Ax 2012

Hi friend,

Toady,  I am going to help you how to open Form through code or X++  in AX 2012.
It is very simple, I think most of the people knows any way i am sharing my thoughts.


It has two ways to open the form

1. Open the FORM Name
2. Open the FORM, with Form Display Name. 


1. Open the FORM with Form Name

static void FormOpen(Args _args)
{
   
    Args  args;
    FormRun formRun;
   
    args = new Args();
    args.name(formstr(FormA)); // mention Form Name
    formRun = new FormRun(args);
    formRun.run();
    formRun.wait();
   
}


2. Open the Form with Form Display Name

static void FormOpen(Args _args)
{
 
MenuFunction menuFunction;
menuFunction = new MenuFunction(MenuItemDisplayStr(FormA), MenuItemType::Display);
menuFunction.run();
   
   
}


Happy Daxing...