*DBLOOP

<< Click to Display Table of Contents >>

Navigation:  Reference > Pre-processor >

*DBLOOP

The *DBLOOP command starts a loop which scans all the rows in a sheet. The form of the *DBLOOP command is:

[*DBLOOP loopindex = fileindex;sheetname]

[*DBLOOP loopindex =(start)fileindex;sheetname]

[*DBLOOP loopindex = fileindex;sheetname;columnname,columnname…]

[*DBLOOP loopindex =(start)fileindex;sheetname;columnname,columnname…]

Where start is the row to start from. Use *LAST if all rows are not needed.

IMPORTANT: the start number starts at 1 so will be numerically one smaller that the actual row in the spreadsheet, because row 1 is used for the header row that identifies the columns.

Where the index name fileindex was used in the *DBOPEN command. The file must be open when *DBLOOP is used.

The sheetname is the name of the sheet in the Excel file or the table in the Access file.

VERY IMPORTANT: you must not nest DBLOOP command on the same worksheet.

VERY IMPORTANT: if sheetname contains blanks you must surround it with quotes for example: ’r;My sheet’.

The index name loopindex is used in references to cells in the spreadsheet (cellref).

If the sheet contains a lot of columns, the desired columns can be listed as columnname separated by commas.

VERY IMPORTANT: if columnname contains blanks you must surround it with quotes for example: ’r;My column’.

The loop must end with a *DBEND command.

Cell references with loopindex can only be used between the *DBLOOP and *DBEND commands.

Any number of *DBLOOP commands can be used on an open file.

The PP command *SLE cannot be used with *DBLOOP and *DBEND.

Examples of *DBLOOP commands:

[*dbopen dfNameFile=’File of Names.xls’]

[*dbloop dlList=dfNameFile;Names]

[dlList.Surname]

[*dbend dlList]

[*dbloop dlList=dfNameFile;’First name’,Surname,Title]

[dlList.title][dlList.’First name’][dlList.surname]

[*dbend dlList]

[*dbclose dfNameFile]

Examples of DBLOOP with start row specified:

[*dbloop dlThis=(2)dfFile;Sheet1]

[*dbloop dlThat=(FirstRowWanted-1)dfFile;Sheet1]