woensdag 19 mei 2010

Access Form Control without Autodeclaration

Source: http://www.artofcreation.be/2010/04/13/odd-code-in-ax-2-control-enum-on-forms/

Example: disable control named "ButtonFunctions".
element.control(Control::ButtonFunctions).enabled(false);

Also: http://dynamicsuser.net/forums/p/43984/222374.aspx
Enable/disable form field in datasource field modified method:

public void modified()
{
    super();

     if (CEMPAbsence.Accrual == Accrual::Yes )
    {
        CEMPAbsence_ds.object(fieldNum(CEMPAbsence,AccrualType)).enabled(True);
    }

dinsdag 4 mei 2010

Detecting default values

Use the int prmIsDefault(anytype argument) function.

See: http://sysdictcoder.com/blog/detecting-default-values/

Example:
static void ADU_BMS_prmIsDefault(Args _args)
{
    container   myCon;
                
    str prmIsDefaultTest(container _con = myCon)
    {
        ;
        if (prmIsDefault(_con))
        {
            return "parameter was not provided, using default";
        }
        else
        {
            return "parameter was provided, using provided parameter";
        }
    }
    ;

    info(strfmt("test without parameter: %1", prmIsDefaultTest()));
    info(strfmt("test with parameter: %1", prmIsDefaultTest(myCon)));

    // Infolog output:
    // test without parameter: parameter was not provided, using default
    // test with parameter: parameter was provided, using provided parameter
}

Creating a user manual or step-by-step reproduction of a problem - Windows 7

Ever struggled with screencaptures and MS Word to create a manual, or step-by-step reproductions of a problem?
Try this: start – run – PSR (Windows 7 only)
It’s like the Task Recorder in AX.

InventOnHand vs InventDimOnHand

source: http://axforum.info/forums/showthread.php?t=31363
and http://www.dynamicsaxtraining.com/tips-tricks/inventonhand-vs-inventdimonhand

What's the difference between InventOnHand and InventDimOnHand classes and in what cases they must be used?

Axapta InventOnHand class is wrapper for InventSum table. Unique index for InventSum table is ItemId + InventDimId. In other word, this class is used to get on hand for item with specific dimension. For example, if you require getting on-hand qty for “Bottle” items that have “green” color, “standard” size and are stored in “22” warehouse, “1” Aisle, “4” Shelf then you use InventOnHand class.

But, if you require getting on-hand qty for warehouse location then InventOnHand class couldn’t help us. Because one location could contains different items. Or if you require get on-hand qty for pallet. In these cases InventDimOnHand class must be used. This class is used when you require on-hand qty for specific inventDim. InventDimOnHand сlass consists of InventDimOnHandMember classes. Each InventDimOnHandMember class contains information about Item, Dimensions and Qty.

X++ Code to find OnHand Stock for Item

See http://learnax.blogspot.com/2010/01/x-code-to-find-onhand-stock-for-item.html