Friday, July 23, 2010

periodic call in axapta

Suppose if at the client level i want to call method periodically I can achieve this task via setTimeOut method. This method will call the method specified in the argument after the provided interval.

Suppose.

if i write the line.

this.setTimeOut(identifierstr(method1), 5000, true)

The setTimeOut method will call method1 after the 5 second when the form is idle. If we want to call method1 with the no restrictions of idle then we don't need to provide true in the 3rd argument.

this.setTimeOut(identifierstr(method1), 5000)

Thursday, July 8, 2010

fetch selected data from grid

When you are on form and want to select the selected data from the grid, You can get from the table datasource from the form by using ****_ds.getFirst(true). It will provide the reference of the respective table buffer.
for example if i select some rows from the CustTable form and I want to show it in an infolog.

Use the following Code.

CustTable custTable1;


super();

for (custTable1 = custTable_ds.getFirst(true); custTable1; custTable1 = custTable_ds.getNext())
{
info(strfmt('%1', custTable1.AccountNum));
}



If you will not provide true in custTable_ds.getFirst(), it will fetch all the records.

so to fetch all records from the grid.

change the for loop line.

for (custTable1 = custTable_ds.getFirst(true); custTable1; custTable1 = custTable_ds.getNext())