Salesforce

How Do I Retrieve the Sequential Number of a Record That is Handled by a Batch Program? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Retrieve the Sequential Number of a Record That is Handled by a Batch Program? (Magic xpa 3.x)

Often, in a batch program, you will want the number of the current record. You might use this, for example, to give the user an informational message, to create a sequential line number, or to cancel processing during debugging.

Magic xpa has a built-in function to handle this, called Counter(). It takes one parameter, which is the generation of the task. So Counter(0) returns the number of records processed by the current batch task, Counter(1) returns the records processed by the parent, etc.

Using Counter()

  • Wherever you want to retrieve the current number of records processed, in the Expressions Rules, type

Counter(0)

For the current task. Use Counter(1) to refer to the number of records the parent has processed, Counter(2) for the grandparent, etc.

In this example, we use the value returned by Counter(0) to display a message to the user. Since the value returned is numeric, we use the Str() function to convert it to a string.

See also

The Online and Rich Client Samples projects (program LG08 and RLG08)

Reference
Attachment 
Attachment