\
Source Code
Commands
Column
Column Macros
The "Column" command creates some standard definitions
which record some useful information about the tables and columns being
defined to make reference to the column easier if you are writing custom
VBSCRIPT code, these are:
- MACRO: COL#.TableName.ColumnName
This will expand to an integer representing the columns location
within a record (1, 2, ...).
- MACRO: COLSTR.TableName.ColumnName
This will expand to a VBSCRIPT expression which refers to the
columns data within a record as a string ("oRec.StringData(2)" etc).
The record name can be passed as positional parameter 1 if required
but the default of "oRec" is probably what you want.
- MACRO: COLINT.TableName.ColumnName
This will expand to a VBSCRIPT expression which refers to the
columns data within a record as an integer ("oRec.IntegerData(2)" etc).
The record name can be passed as positional parameter 1 if required
but the default of "oRec" is probably what you want.
In the following example we wish to avoid hardcoding column numbers or
refering to specific VBSCRIPT variables:
<$Table "Dialog">
dim DialogNameTitle
<$Row @Where="" @OK=^? > 0^ @Code="Y" *Title="DialogNameTitle">
;--- Debug stuff --------------------------------------------------
say ""
say "DialogName = " & <$COLSTR.Dialog.Dialog>
say "Width = " & <$COLINT.Dialog.Width>
;--- Set up the new title in the VB variable mentioned above ------
DialogNameTitle = "[\[]" & <$COLSTR.Dialog.Dialog> & "[\]] - " & <$COLSTR.Dialog.Title>
<$/Row>
<$/Table>
This example shows how you can see if a particular column has been
defined or not and vary processing if required:
#ifndef COL#.CustomAction.Action
#error ^This should be defined :-), Don't know why we got here!^
#endif
#ifndef COL#.CustomAction.ExtendedType
#error ^We need the "ExtendedType" column of Windows Installer 4.5+.^
#endif