SeedData - cWebPromptList
Called during prompt list activation to seed and find the starting target record
Type: Function
Return Data Type: Boolean
Parameters
| Parameter | Type | Description |
|---|---|---|
| hoUpdateColumn | Handle | Handle of update column object |
| hoInitialColumn | Handle | Handle of initial column object |
Syntax
Function SeedData Handle hoUpdateColumn Handle hoInitialColumn Returns Boolean
Call Example
Get SeedData hoUpdateColumn hoInitialColumn to BooleanVariable
Description
Normally, you want your prompt list to start at some target position. In most cases, this target is determined by the contents of the control that invoked the list. The SeedData function performs this task. The seeding process is controlled by other properties, such as peUpdateMode, pbAutoSeed, piUpdateColumn and phmPromptSeedBufferCallback. This is a complex process and should normally not be interfered with. If you do choose to augment this function, you should first carefully study the code in this class.
When a prompt list is invoked, the message SeedData is called. Depending on your update mode (peUpdateMode), the seeding process is handled different ways.
Relational Prompt Lists
If your prompt list is relational (peUpdateMode is umPromptRelational) and pbAutoSeed is True, the seeding process will consist of performing an entry update based on the data in the invoking view. This moves the data from your invoking object's view into the table buffer. It then attempts to find the closest match to this data. This makes the seed behave in a similar fashion to a Request_Find GE, with the exception that, if the find fails, it will attempt to then find the data in opposite direction (LT).
Since most prompt lists are relational, this could be considered the normal seeding behavior.
Value Prompt Lists
If your prompt list is an update by value list (peUpdateMode is umPromptValue) and pbAutoSeed is True, the seeding process will consist of moving the invoking object's value into the table buffer and performing a find on this value. The table buffer value that is seeded and the index to be used are determined by piUpdateColumn, which you must set, usually in the invoking object's Prompt_Callback event.
Object oStartCustNumber is a cWebForm
Set Label to "Customer Number:"
Set pbPromptButton to True
// The following code connects the customer selection list to this form
Set PromptObject to oCustomerWebLookup
// this forces a simple value update for column 0
Procedure Prompt_Callback Integer hPrompt
WebSet peUpdateMode of hPrompt to umPromptValue
WebSet piUpdateColumn of hPrompt to 0
End_Procedure
End_Object
Custom Prompt Lists
If your prompt list is a custom update list (peUpdateMode is umPromptCustom) and pbAutoSeed is True, the seeding process will consist of moving the value of psSeedValue into the table buffer and performing a find on this value. The table buffer value that is seeded and the index to be used are determined by piUpdateColumn. You must set psSeedValue and piUpdateColumn yourself, usually in the invoking object's Prompt_Callback event.
Procedure Prompt_Callback Integer hPrompt
String sValue
WebSet peUpdateMode of hPrompt to umPromptCustom
WebSet piUpdateColumn of hPrompt to 1 // on name column
WebGet Value of oMyStartForm to sValue
If (sValue="") Begin
Move "M" to sValue // if empty jump in middle of list
End
WebSet psSeedValue of hPrompt to sValue
End_Procedure
Custom Seeding
You can override the seeding process by setting the callback property phmPromptSeedBufferCallback. If set, this will contain a callback event that will be sent to the invoking object and that event is then used to seed your table buffer. If you seed the buffer, that inactive seeded buffer will be used for the find. If you seed the buffer and find the record yourself, that active record will be used as your seed.
// set within your cWebPromptList object
Set phmPromptSeedBufferCallback of hPrompt to (RefProc(SeedBuffer))
:
// set within your cWebForm
Procedure SeedBuffer Handle hoPrompt
WebGet Value to Customer.Customer_Number
WebGet Value of oDivision to Customer.Division
End_Procedure
Procedure Prompt_Callback Integer hPrompt
WebSet peUpdateMode of hPrompt to umPromptValue
WebSet piUpdateColumn of hPrompt to 0
End_Procedure
When phmPromptSeedBufferCallback is used, it overrides the regular seeding behavior in all modes except umPromptNonInvoking.
Return Value
Returns True if a seed/find succeeded.