CreateActionField
Creates an action field to display the extraction preview.
Compatibility
Available as of IDEA version 9.0
Syntax
CreateActionField(database as Object, fieldName as String, lookupTable as String, lookupField as String, Optional additionalFields)
Parameters
database
Object containing the opened database.
fieldName
Name of the field the action field will be created for.
lookupTable
Name of the lookup table to find matching values in.
lookupField
Name of the field used for the lookup. The lookup field must have the same name in both databases.
additionalFields
Name of additional fields used for the lookup. The maximum number is seven.
Remarks
It is not mandatory to have a field in the lookup database with the same name as the field for which the action field will be defined.
The maximum number of common fields that can make up the lookup key is eight.
If the lookup fields do not have the same name, IDEA raises the error "The following field(s) cannot be found in the database db:MISSING_COLUMN" when clicking on the action field.
Example
Sub Main
Dim SimpleCommand As Object
Dim db As Object
Dim SourceFileName As String
Dim DbExtension As String
'Initialization
Set SimpleCommands = SmartContext.MacroCommands.SimpleCommands
SourceFileName = SmartContext.PrimaryInputFile
DbExtension = SimpleCommands.DatabaseExtension
'Open the database
Set db = Client.OpenDatabase("EXTRACTION" & DbExtension)
'Create an action field for field "CUSTOMERCODE" in database "EXTRACTION" based on the PrimaryInputFile and using "CUSTOMERNAME" and "DEBTORCLEARINGDATE" lookup fields.
SimpleCommands.CreateActionField db, "CUSTOMERCODE", SourceFileName, "CUSTOMERNAME", "DEBTORCLEARINGDATE"
'Close the database
db.close
Set db =Nothing
'Release object
Set SimpleCommands = Nothing
End Sub