<< Click to Display Table of Contents >> Navigation: Reference > Pre-processor > *DBCOLUMN |
The *DBCOLUMN command checks whether a column exists in a sheet. The form of the *DBCOLUMN command is:
[*DBCOLUMN hascolumnindex = fileindex;sheetname;columnname]
Where the index name fileindex was used in the *DBOPEN command. The file must be open when *DBCOLUMN is used.
The sheetname is the name of the sheet in the Excel file or table in the Access file..
The index name hascolumnindex is set to 1 if the column exists in the named worksheet. It is set to zero if the column is not found.
It is more efficient to use *DBCOLUMN before *DBLOOP rather than inside a loop between *DBLOOP and *DBEND.
Any number of *DBCOLUMN commands can be used on an open file.
Examples of *DBCOLUMN commands:
[*dbopen dfNameFile=Names.xls]
[*dbcolumn HasAddress=dfNameFile;Names;Address]
[*dbcolumn HasPostcode=dfNameFile;Names;Postcode]
[*set HasEither=HasAddress+HasPostcode]
[*dbloop dlList=dfNameFile;Names]
[*skip 99 on HasEither.gt.0]
[dlList.Name] has no address nor postcode
[*99]
[*dbend dlList]
[*dbclose dfNameFile]