SelectBestColumn - cDbCJGridPromptList
Finds the best column for the passed table and column number
Type: Function
Return Data Type: Integer
Parameters
| Parameter | Type | Description |
|---|---|---|
| iFile | Integer | The table number for your target |
| iField | Integer | The column number for your target |
Syntax
Function SelectBestColumn Integer iFile Integer iField Returns Integer
Call Example
Get SelectBestColumn iFile iField to IntegerVariable
Description
SelectBestColumn is used to by relational prompt lists to determine which column best matches the binding data for the invoking data entry object (DEO). It does this by searching for a column that has the same binding table and column values that were passed to the function. If it cannot find a match, it returns -1. You can use this and other conditions to determine which column should be used as your update column.
Procedure Prompt_Callback Integer hoPrompt
Integer iCol
Set peUpdateMode of hoPrompt to umPromptValue
// get best column for customer.name
Get SelectBestColumn of hoPrompt Customer.File_Number 1 to iCol
If (iCol=-1) Begin
Move 0 to iCol // if no good column, use 0
End
Set piUpdateColumn of hoPrompt to iCol
End_Procedure
Return Value
The first column number that matches the target. If no match is found, -1.