Monday, 26 May 2014

Restrict the Page header part of report to open on next page in ax 2009


Write the below code on header method . override executeSection() method.


public void executeSection()
{
if(element.page() == 1)
super();
}

Restrict User to enter only 10 digit numeric values in a string field on a Table.


public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
int q;
int ascii;
int i;
q= strLen(this.Phone);
ret = super(_fieldIdToCheck);
if(this.Phone)
{
for (i=1; i<=q; i++)
{
ascii = char2num(this.Phone, i);
if( ascii >= 48 && ascii <= 57)
ret = true;
else
{
ret = false;
error(‘Phone Number must be numeric only’);
break;
}
}
if(q!=10)
{
error(‘Phone Number must be of 10 digits’);
this.Phone = “”;
this.insert();
}
}
return ret;
}