blog for Dynamics Axapta

Archive for May, 2011

Go To Main Table Functionality in Axapta

Hi All,

We all know about “Go To Main Table” Option in our Axapta Forms and Tables. Here I wrote one sample for how to get that functionality in our forms or table. This is done by three ways:

1) By EDT Relations

2) By using JumpRef method

3) By using FormRef property in Table

EDT Relations:

If you use an EDT in tables which have relation with some other table fileds, that time you can able to navigate the main table or main form.

FormRef Property:

Select the Table and go to properties and select the required form in the FormRef property.

JumpRef method:

If you are not having that option, simply write a override the JumpRef method in a field of DataSource or in a Form Control. Here i show you a sample jumpRef method code:

public void jumpRef()
{
Args            args;
MenuFunction    menuFunction;
;

args = new Args();
menuFunction = new MenuFunction(menuitemDisplayStr(“FormName”), MenuItemType::Display);
args = new Args(menuFunction.object());
args.caller(element);
args.record(“RecordName”); // to be a datasource which added in the current form
menuFunction.run(args);
}

In the form init() which we called here, we have to check the condition whether the form is called by any dataset or not.

Thanks & Regards

Vasanth Arivali

Using Regular Expression in Ax 2009

Hi Guys,

Here i posted a small job , to explain how we use regular expressin in Axapta. Try it.

static void RegularExpression_Test()

{

int nameLength,myStringLength;

str myname = “Vasanth”;

str myString = “1234″;

str formatString , formatString1;

System.Text.RegularExpressions.Regex regEx;

System.Text.RegularExpressions.Regex regEx1;

System.Text.RegularExpressions.Match regMatch;

InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);

boolean retVal, retVal1;

;

nameLength = strLen(myname);

myStringLength = strLen(myString);

formatString   = strfmt(@”^[0-9]{%1}”, myStringLength);

formatString1   = strfmt(@”^[a-zA-Z ]{%1}”, nameLength);

permission.assert();

//BP Deviation documented

regEx = new System.Text.RegularExpression.Regex(formatString);

regEx1 = new System.Text.RegularExpression.Regex(formatString1);

regMatch = regEx.Match(myString);

retVal = regMatch.get_Success();

print retVal; // Returns True;

regMatch = regEx1.Match(myname);

retVal1 = regMatch.get_Success();

print retVal1 // Returns True;


}

Thanks & Regards,

Vasanth Arivali