Function Lookup####( FormNumber, FieldName, FieldValue )
Description
A look-up script must comply with certain naming rules. Because every look-up is identified by the form to which the lookup refers, the naming rules have been adapted accordingly. For a lookup to a specific form, the corresponding look-up script will be defined as follows. The #### represents the number of the form code (including leading zeros) that would normally be opened by the default Isah look-up.
Parameters
The FormNumber parameter specifies which look-up screen the look-up script starts. This, however, is not relevant for look-up scripts in the event script. It may be useful to know for a look-up script in the general look-up script.
The FieldName parameter specifies the field in which the return value must be inserted.
The FieldValue parameter specifies which value was present in the 'look-up edit' when the lookup was started.
Besides the input parameters, there must also be a ReturnValue. The return value will, in case it is not unassigned, be placed in the 'look-up edit'.
Example Of A Look-up Script
The following script shows an example of the use of look-up scripts.
Rem# I0047
function
Lookup0040( FormNumber, FieldName, FieldValue )
Dim
aLookupObj
set
aLookupObj = new TSimpleLookup
aLookupObj.SQL =
"Select part number,description from t_part"
aLookupObj.Title =
"Select a part"
aLookupObj.ResultField =
"part number"
aLookupObj.LocateValue = FieldValue
rem
DefaultValue is FieldValue
Lookup0040 = FieldValue
if
aLookupObj.Lookup
then
Lookup0040 = aLookupObj.ResultValue
End If
set
aLookupObj = nothing
end function