September 06, 2013

Simple Dialog Box in Axapta 2012

Simple Dialog Box in Axapta 2012






Hi Folks,

The following example displays the dialog box and prints the value entered to the screen.

Code:
static void theAxapta_DialogBox(Args _args)
{
dialog              dialog;
dialogGroup    dialogGroup;
dialogField      dialogField;
;
dialog              = new Dialog("Simple Dialog");
dialogGroup    = dialog.addGroup("Customer");
dialogField      = dialog.addField(extendedTypeStr(custAccount));
if (dialog.run())
{
print dialogField.value();
pause;
}
}

Output:
















Note:

    1.   The dialog.run() method returns true if OK is clicked, and false if Cancel is     clicked.
    2.   Dialog Group is used to group dialog fields which are logically same.

-Harry

September 04, 2013

How to create a lookup on Dimension(SysDimesion) ENUM

How to create a lookup on Dimension(SysDimesion) ENUM

Note:
1. DimentionSetCombination is the table in Which dimension hierarchy stored 
2. MachineHour is a customized table in this example, you can use your own logic in the same
3. fieldId2Ext is an X++ keyword which is used to access a particular array index value.
 example:  fieldId2Ext(fieldNum(DimensionSetCombination,Dimension),4)


public void lookup()
{
    SysTableLookup       sysTableLookup =      SysTableLookup::newParameters(tablenum(DimensionSetCombination), this);
    Query                query;
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange      queryBuildRange, queryBuildRangeDlvryWH;
    ;

    sysTableLookup.addLookupfield(fieldId2Ext(fieldNum(DimensionSetCombination,Dimension),4), true);

    query                   =   new Query();
    queryBuildDataSource    =   query.addDataSource(tablenum(DimensionSetCombination));
    queryBuildRange         =   queryBuildDataSource.addRange(fieldId2Ext(fieldnum(DimensionSetCombination,Dimension),3));

    queryBuildRange.value(MachineHours.CostElement);
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

-Harry

Multiple Tables in field Lookup method

Hi Folks,

Here is an example of lookup where you can use multiple tables in the lookup method. 



-Harry

September 03, 2013

How to create a link in info log

Issue:  I come across a user requirement , that user need a link on info log for go to main table.

Scenario:  For example
If user create a Purchase Order from "Release approved purchase requisition", than system create a PO and in info log it show the PO number. When user double click on this PO number it redirect to PO form.
User need this same functionality for a customized process.

Possible Solution:
Use following code for Info log

Info(strfmt('Journal_Number : %1 \n Voucher_Number : %2 ', _journalnum, _voucher),"",SysInfoAction_TableField::newBuffer(ledgerJournaltable));

-Harry