Get Current Record Number Action

image\Action_Database_Current_Record_Number.jpg

The Get Current Record Number action will return the position number of the current record in the Select List of a Query; the number is then saved in a variable. For example, if a Select List contained 10 records, the position number of the first record in the query is 1, the second 2, and so on.

Note:
Be careful when using the Next Record and Previous Record actions that you update the Get Current Record Number action, otherwise the number displayed on the page will not match the current record displayed on the page. Use the Variable Changed trigger for this action, to ensure that the number on the page is updated when you move to a new record.

Setting up the Get Current Record Number action:

1. Add the Get Current Record Number action to your trigger, as described in adding actions. The Get Current Record Number tab will automatically appear when you add the action.

Note:
A Variable Changed trigger on the page normally triggers this action.

2. Click on the down arrow to the right of the Query box to open a list of query’s you have previously created in this publication.

Note:
If the drop down box is empty, you have not previously entered a Database Query action to this publication. You must have created at least one Database Query action in order for this action to work.

3. Use the Variable option to select the name of the variable in which the number of the current record will be stored – the variable will always contain a number, the value of which will be the number in the Select List that this record is positioned. Click on the down arrow to the right of the Variable box to open a list of all the variables in your current publication.

Note:
Alternatively, click on the New… button to open the New Variable dialog box where you can create a new variable.

4. Click on the Apply button to save your changes.

Note:
This action is normally used with the Get Number of Records action to display information to the user in a format similar to:

 Record: 1 of 8 Total Records 

This can be easily achieved by drawing one Text object on a page and inserting the variable name (point 3 above) into the text box – see Example.

Related Topics:

Working with Databases - Overview

Introducing the Database Actions

Showing Records from a Database in Opus

Choosing an Action