Wednesday 18 January 2012

Create a parameter Table in Ax 2009

Hi Friends,
    We have a small requirement of making a parameter Table to separate module. The basic of parameter table is found in this blog. We have a mandatory field named "key" which is of integer type.The properties of parameter table is as follows,
MaxAccessMode   Edit
CacheLookUP       Found
TableGroup           Parameter
And the properties of Key field is as follows
AllowEditOnCreate,AllowEdit, Visible is set to "NO"
The methods of find and exist are as follows,

static client server FleetParameters  find(boolean _forupdate = false)
{
    Parameters parameter;
    ;
        select firstonly parameter
            index Key
            where parameter.Key == 0;

        if (!parameter)
        {
            Company::createParameter(parameter);
            NumberSeqReference::construct(Parameters::numberSeqModule()).load();
        }
    return parameter;
}

exist

static boolean exist()
{
    return (select firstonly RecId from Parameters).RecId != 0;
}
And the update method of Table

void update()
{
    super();
    flush Parameters;
}
And Delete method of Table is overriden as

void delete()
{
    throw error("@SYS23721");
}
And a method called number sequence module is written as

static client server NumberSeqModule  numberSeqModule()
{
    return NumberSeqReference_VkFleet::numberSeqModule();
}

And then create a form parameters
And do not forget to write the init method on the form , The form data source properties is as follows
AllowCheck,AllowDelete,AllowCreate is set to "No",LinkType  "Passive",Insert at end  "No".

                                                                              Vivek Chirumamilla







1 comment:

  1. The field Key isn't supposed to be mandatory, it will always hold the value 0. And what is the purpose of exists() method? You already have the find() method which will return the record.

    ReplyDelete