Equinox Online Help - Language Reference - A to Z

Home

Pick, PickRecord

Applies to
SyntaxPick (ReturnfieldName ,[SearchExpression], IndexName) PickRecord(ReturnfieldName ,[SearchExpression], IndexName, Field1Name [, Field2Name, Field3Name, Field4Name])
Action[Function] These functions compile a list of remote records that pass a search criterion. You pick one of the records and a specified field value is returned from it.
ScopeUsable anywhere.
Notes

The PickRecord function is included primarily for compatibility with previous versions of Equinox. The Pick function provides access to more fields via the PickFields statement.

It is similar to Lookup, in that it reads a field value from a remote table. It has the advantage that you can choose the required record from a list.

Equinox automatically locates the remote table and searches through it using the index specified by IndexName. A list of all records with an index value starting at SearchExpression is generated. SearchExpression may be a MakeKey value. If SearchExpression is omitted, all of the remote records are included in the list.

The PickRecord statement selects Field1Name and Field2Name, Field3Name and Field4Name if supplied as the fields to display. The Pick statement uses the fields specified in a previous PickFields statement.

The list is presented in a list box on a dialog. For each record, the dialog displays the fields specified. You select a record from the dialog and the value held in ReturnfieldName is returned from it.

The following statements control the look and feel of the list box: PopupTitle, PopupSize, PopupFont, PopupColour, PopupColor, PopupFlags and PopupJustification. The field column captions may be set by the PickCaptions statement and the column widths by the PickColumnWidths statement. All of these statements are reset to default after every Pick and PickRecord. Also the PickFields list is cleared.

Apart from returning the field value this function also sets the SysReply system workarea:

  • 0 Value returned (as normal)
  • -1 User pressed the Escape key
  • -2 No response (timeout error)
  • -3 Undefined error

Note that:

  • You may use this function to read from a record in the current table.
  • You cannot use this function to return a picture field value.
  • It will now display logicial fields
  • Multiselect mode is controlled by 'PopupFlags 64' setting
CategoryPick lists
See Also PickCaptions, PickColumnWidths, PickFields, PickList, PickListSelection, PickRange_PickRecordRange, PickSelection, PickWrite_PickRecordWrite
Example

The following method determines if the current record is involved in a relational dictionary link. If it is not, the user is prompted to select a record in the related table.

The two tables are called Item and Partlist and they are linked on the fields ItemPtno and Ptno (respectively). Hence, when a valid part number is entered into an Item record, an automatic link is created to the corresponding Partlist record. If there is no related record, then the Pick function prompts the user to select a Partlist record. A link is created to the selected record.

if IsField(ptno) = false then
PopupTitle "Choose a part Number"
PickFields ptno, ptdesc
PickCaptions "No", "Description"
ItemPtno = Pick(ptno, ItemPtno, PtnoIdx)
end if

The following is an example of multiple records being selected from a Pick list and the selections being displayed in a print window.
Note a new method language statement must be used to access the results selected from the Pick list – PickSelection iIndex, s:

string szName, s
number iSelections, iIndex

PopupTitle "Choose a car"
PopupColour Red, White, Blue, Yellow
PopupFlags 64
PickFields Body_Type, Tested, No_Of_Doors, Engine_Size, Name
PickCaptions "Body", "Tested", "Doors", "Engine", "Name"
PickColumnWidths 10,7,5,10, 15

szName = Pick(Name, Body_Type, GEngineIX)

| Note no. of multiple selections
iSelections = SysResult

| Multiple selections ?
if iSelections > 0 then
iIndex = 1
print "There were <" & iSelections & "> selections made"

| Troll through list of selections
while iIndex < iSelections + 1
PickSelection iIndex, s
print "Selection " & iIndex & " - <" & s & ">"
iIndex = iIndex + 1
end while
else
print "NO MULTI SELECTIONS MADE !"
end if

print ""