Salesforce

How Do I Determine the Bulk Size When Fetching Records from a Database Table? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Determine the Bulk Size When Fetching Records from a Database Table? (Magic xpa 3.x)

Sometimes you may want to know the size of a database table. There are three functions to do this:

  • DbSize() returns the size of the table, in bytes.

  • DbRecs() returns the number of records in the table.

  • DbViewSize() returns the number of records in the current data view.

Each of these works slightly differently, as explained below.

DbSize()

DbSize() is used when you want to determine the size of the table in bytes. The syntax is:

DbSize(dsource#, tablespec)

where:

  • dsource# is sequence number of the table in the Data repository.

  • tablespec is the name of the table, if you want to specify a different one than the default.

In this example,

DbSize('1'DSOURCE,'')

returns 19,470, the byte size of the table.

DbRecs()

DbRecs() is used when you want to determine the number of records in the table. The syntax is:

DbRecs (dsource#, tablespec)

where:

  • dsource# is sequence number of the table in the Data repository.

  • tablespec is the name of the table, if you want to specify a different one than the default.

In this example,

DbRecs('1'DSOURCE,'')

returns 33, the total number of records in the table.

DbViewSize()

DbViewSize() is used when you want to determine the number of records in the current data view. The syntax is:

DbViewSize (generation)

where:

  • generation is the task’s hierarchic position in the runtime task tree (0 for the current task, 1 for the parent task, and so on).

In this example,

DbViewSize(0)

returns 12, the total number of records in the table. This is because, although there are 33 records in the table, the user has used a Range to show only the records beginning with the letter ‘T’.

Reference
Attachment 
Attachment