Doens.be

  • Linkedin flickr twitter delicious Facebook Youtube

Posts Tagged ‘Performance’

The Ax Infolog

Wel all know the small dialog that gives the user usefull information about what is happening in Ax. In this post I will tell u some more about this.

You can add information to the Infolog by calling:

  • Infolog.add(…)
  • info(…)
  • warning(…) or checkfailed(…)
  • error(…)
  • You can add some structure in it by using setPrefix(…)
  • Using the Proxy-class for the Enterprise Portal


(more…)

Batch job performance boost

Did you ever have trouble with the performance of your batch-job? Well maybe this small trick can shorten the time your batch runs.

The big idea: Try to split up your gigantic batch in smaller pieces. Launch a batchjob that produces many smaller batchjobs (tasks) that can handle a subset of the data you need to process. For example you can create a batch that creates a batch with sub-tasks for each company.

How do you plan a batch from code?

1
2
3
4
5
6
7
8
9
10
11
12
BatchHeader batHeader;
BatchInfo batInfo;
TstRunBase rbbTask;
;
rbbTask = TstMyBatch::construct();
batInfo = rbbTask.batchInfo();
batInfo.parmCaption("MyBatch");
batInfo.parmGroupId("");
batHeader = BatchHeader::construct();
batHeader.addTask(rbbTask);
batHeader.save();
info(batInfo.parmCaption());

You can download a quick example I made. This is a job you can schedule and it will produce a new Batch job with a task for each company when you don’t select a company while shedualing (Class_TstRunBase.xpo). I hope this can help you.

Schedule the batch:

The result:

Counting the number of records in a QueryRun

When you want to count the number of records that are currently displayed on a form, and you have only one data source, just call the static method countTotal() from the SysQuery-class.

public void executeQuery()
{
    ;
    super();
    info(int2str(SysQuery::countTotal(EmplTable_ds.queryRun())));
}

But when you want to do the same when you joined multiple data sources, you will actually have to loop trough the whole selection. You can do this easily by calling countLoops() on the SysQuery-class. Keep in mind that this has a serious influence on your performance.

public void executeQuery()
{
    ;
    super();
    info(int2str(SysQuery::countLoops(EmplTable_ds.queryRun())));
}