Ax 2012 Tips and Tricks

1. Call the Calling form methods from Caller form

First Form

public void CallingMethodforEnable()
{
button1.enabled(true);
}

public void CallingMethodforDisable()
{
button1.enabled(false);
}

Second Form

void clicked()
{
if(stringedit.valueStr()==’1′)
element.args().caller().CallingMethodforEnable();
if(stringedit.valueStr()==’0′)
element.args().caller().CallingMethodforDisable();
}

2.For Mark All Records in a grid

Method 1:

void clicked()
{
super();
element.task(2842);
element.task(2842);
}

Method 2:

void clicked()
{
#task;
super();
element.task(#taskSelectAll);
}

Method 3:

void clicked()
{

bt = Bill_TabMethod_ds.getFirst();

while(bt)
{
Bill_TabMethod_ds.findRecord(bt);
Bill_TabMethod_ds.mark(true);
bt = Bill_TabMethod_ds.getNext();
}

}

Refreshing form’s datasource without affecting cursor position in Axapta

Refreshing form’s datasource without affecting cursor position in AX

We can do in two ways
1.Just calling the Research method by passing true boolean value
MyTable_ds.research(true); // boolean value retain the cursor position

2.you can use method setPosition() and getPosotion()
{
int position;
;
position= MyTable_ds.getPosition();
MyTable_ds.research();
MyTable_ds.setPosition(position);
}