Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

Open Cursor

Use this command, in conjunction with the Fetch and Close Cursor commands, to define a cursor in a DataTable object, which allows you to move through the various records and then fetch them to a string variable.

Syntax:

Open Cursor CursorName Select "Columns" From DataTableName

where:

  • CursorName is the name for the cursor.
  • Columns can be one of the following:
    • * — To navigate the cursor through all columns.
    • Column1, Column2, ... ColumnN — To navigate the cursor through the specified columns, where Column is the column name.
  • DataTableName is the name of the DataTable object for which to open the cursor.

Syntax example:

Create Variable amountRow[] as String

Create DataTable dtAllSalaries Using "AllSalaries.lvdtd"

Download dtAllSalaries Open Cursor amounts

Select "Employee ID, Entity, Amount" From dtAllSalaries

Fetch FIRST DATATABLEROW from amounts into amountsRow

While $LVS_FETCHSTATUS$ != -1

If $LVS_FETCHSTATUS$ == 0

//Insert data table row processing here

Run MODEL "TransferTableData.lvmod" ON daSalaries

END If

Fetch NEXT DATATABLEROW FROM amounts INTO amountsRow

END While

Close Cursor amounts

Published:

Open Cursor

Use this command, in conjunction with the Fetch and Close Cursor commands, to define a cursor in a DataTable object, which allows you to move through the various records and then fetch them to a string variable.

Syntax:

Open Cursor CursorName Select "Columns" From DataTableName

where:

  • CursorName is the name for the cursor.
  • Columns can be one of the following:
    • * — To navigate the cursor through all columns.
    • Column1, Column2, ... ColumnN — To navigate the cursor through the specified columns, where Column is the column name.
  • DataTableName is the name of the DataTable object for which to open the cursor.

Syntax example:

Create Variable amountRow[] as String

Create DataTable dtAllSalaries Using "AllSalaries.lvdtd"

Download dtAllSalaries Open Cursor amounts

Select "Employee ID, Entity, Amount" From dtAllSalaries

Fetch FIRST DATATABLEROW from amounts into amountsRow

While $LVS_FETCHSTATUS$ != -1

If $LVS_FETCHSTATUS$ == 0

//Insert data table row processing here

Run MODEL "TransferTableData.lvmod" ON daSalaries

END If

Fetch NEXT DATATABLEROW FROM amounts INTO amountsRow

END While

Close Cursor amounts

For an optimal Community experience, Please view on Desktop