Tuesday, 5 April 2011

How to check if your variable suit the conditions given in query range

Use inRange methods from Global class

static boolean inRange(str _rangeValue, anytype _value)



str _rangeValue;

str _value ;

boolean result;


_rangeValue = ‘200..500’;

_value = ‘300’;

result = Global::inRange (_rangeValue , _value);


The result variable will be equal to true

How to set focus when first time opening form in axpta

Override method firstField on a form, and call after super method setFocus of a control which should focused after form is opened. Example:

public void firstField(int _flags=1)

How dynamically change data source field properties?

myTable_ds.object( fieldNum( myTable, myField ) ).visible( false );
myTable_ds.object( fieldNum( myTable, myField ) ).allowEdit( false );

How to override lookup in Ax2009?

Write following method on form level

void SummaryProjectLookup(FormControl ctrl)
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProjTable),ctrl);
Query query = New Query();
QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(ProjTable));
QueryBuildRange queryBuildRange;

sysTableLookup.addLookupfield(fieldNum(ProjTable, ProjId));
sysTableLookup.addLookupfield(fieldNum(ProjTable, Name));
sysTableLookup.addLookupfield(fieldNum(ProjTable, Status));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(ProjTable, Type));
public void lookup()