Type to start searching...

Picker

Picker elements provide a consistent user experience for selecting objects.

Description

Typically, you declare a just one Picker (.picker file) for a class or enumeration. This controls captions, icons, searching, filtering, and paging of the picker pop-up dialog to make picking the right item(s) easy and consistent. Multipicker and single Picker controls then reuse the Picker definition in portlet layouts. There are two main use cases:

In the first case, single item pickers use a Picker control. The control specifies the type ahead search, filter, chip caption, and icon

In the second case, multi item pickers use a MultiPicker control. The control specifies the type ahead search, filter, chip caption, icon, and intersection class that items are written to.

They may be used to select Classes or Enumerations.

Pickers are created in .picker files

Properties
addEvent : string

S-expression for custom behaviour when add button is pressed. If unhandled or not set, goes to framework behaviour to launch 'dialog' next. If a model is returned, try to select the added model in the origin picker. Add UI appears if this or dialog is set.

Example


`(func-name ...)

association : string

Association path or expression returning a dynamic field type information message


Common keys:
value - dynamic field association path relative to containing attribute
type - dynamic field type "string", "number", "integer", "date", "boolean", or converter argument list (<type> [<format> [<unit>]])


Multipicker, picker keys:
picker - picker configuration name
multi - true for multipicker
captions - multipicker item captions association path
valueCaption - selected value caption text association path


Primitive keys:
items - properties of items collection to select query value from (: type <Type>) (: order <order by>) (: where <where>)
captions - item captions association path
values - item values association path
bounded - true for bounded items

Example


Example 1. Touch types
Entity.filter:
...
   <Field association="actTouchTypeDates" ... mode="queryField?" picker="mda:TouchTypeLast" poly="true" .... type="touchType"/>
...
TouchTypeLast.picker:
<Picker association="queryAssocLastTouch" class="TouchType" ...>
   <Mode name="queryField?"/>
</Picker>
TouchType.meta, queryAssocLastTouch attribute value: (message (: value ((TouchDateTypeEnum'get 'NEXTTOUCH)'value)) (: type (collection "date" "date.m.f")))

Example 2. Entity custom fields
Entity.filter:
...
   <Field association="customFields" case="CO HOU PSN PSN_CO PSN_CO_HOU PSN_USR USR" mode="queryField?" picker="mda:CustomFieldType" poly="true" ... type="type"/>
...
CustomFieldType.picker:
<Picker association="queryAssoc" ... class="CustomFieldType" ...>
   <Mode name="queryField?PSN PSN_USR USR" where="(and (@ active) (any (or (@ entityTypes entityType isContactType) (@ entityTypes entityType isUserType))))"/>
   <Mode name="queryField?CO" where="(and (@ active) (any (@ entityTypes entityType isCompanyType)))"/>
   <Mode name="queryField?HOU" where="(and (@ active) (any (@ entityTypes entityType isHouseholdType)))"/>
   <Mode name="queryField?PSN_CO" where="(and (@ active) (any (or (@ entityTypes entityType isContactType) (@ entityTypes entityType isCompanyType))))"/>
   <Mode name="queryField?" where="(@ active)"/>
   <Mode name="queryField?PSN_CO_HOU" where="(and (@ active) (any (or (@ entityTypes entityType isContactType) (@ entityTypes entityType isCompanyType)  (@ entityTypes entityType isHouseholdType))))"/>
</Picker>
CustomFieldType.meta, queryAssoc attribute value:
(let* ((config (list
      (: ent (message (: value "entityValue") (: type "Entity") (: picker "mda:Entity")
         (: captions "fullNameFirstLast") (: multi #t)
      ))
      (: cur (message (: value "currValue") (: type (collection "number" "currency.s" (@ unit)))))
      (: cnv (message (: value "currValue") (: type (collection "number" "currency.s" (@ unit)))))
      (: dte (message (: value "dateValue") (: type (collection "date" "date.m.f" (@ unit)))))
      (: num (message (: value "numValue") (: type "number")))
      (: txt (message (: value "stringValue") (: type "string")))
      (: qp (message (: value "stringValue") (: type "string"))))
   )(msg (cond ((assq (string->symbol (@ editorClass)) config) => cdr))))
   (unless (null? (@ enumType))
      (msg'items (message (: type "QuickPickEnumCode") (: order (collection "display.displayOrder"))
         (: where `(and (@ active) (= (@ type customFieldType) (string->oid ,(oid->string (@ :oid))))))
      ))
      (msg'captions "display.caption")
      (msg'bounded (@ allowQuickPicksOnly))
   )
   msg
)

attributes : string

Additional association paths to retrieve

captions : string

Association path or expression to the caption of the items in the collection

Note that this property isn't a list of values. It is simply the association path, or expression, to the caption of the items.

It is called captions (plural) because it retrieves the caption(s) from the collection's item(s).

class : identifier

The class or enumeration from which instances will be selected by this picker.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter or an underscore. Case and length are not restricted. Letters, numbers and underscores are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

converter : uiIdentifier

Converter name. If not specified, value type name is used to generate it.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter. Case and length are not restricted. Letters and numbers are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

crop : boolean

True to crop icons

descriptions : string

Association path or expression to the description of the items in the collection

Note that this property isn't a list of values. It is simply the association path, or expression, to the description of the items.

It is called descriptions (plural) because it retrieves the descriptions(s) from the collection's item(s).

dialog : string

Name of the dialog used to create new entries if addEvent is not handled. Add UI appears if this or addEvent is set.

factory : string

New item factory event: <class> <event>|<event>

icons : string

Association list of association paths or constants to the icon properties of the items in the collection

Association list of association paths or constants: (image|data|type|icon|default|lock . <a1> ... <an>|"<const>")

Note that this isn't a list of values. It is simply the association path, or expression, to the icon of the items.

It is called icons (plural) because it retrieves the icon(s) from the collection's item(s).

Example


Configuring data table avatar for Entity.meta

<Table>
   <Column ... icons="(image . image)(data . mimeData)(type . mimeType)(icon . icon)(default . &quot;icon:person&quot;)(lock . locking)" .../>
   ...
</Table>

image - The name of the attribute that contains the image (usually of type Obj) from the current instance. The attribute name doesn't need to be called "image", but often is.
data - Obj'mimeData attribute of type binary returning the image data. Always mimeData if the image attribute is of type Obj.
type - Obj'mimeType attribute of type string returning mime type of the image data. Always mimeType if the image attribute is of type Obj.
icon - optional. The name of an attribute of type string returning an icon name if the image is null
default - optional. "icon:person" - A constant expression to fall back on if both image and icon are null
lock - optional. The name of the attribute returning the optimistic locking value. Always locking if the image attribute is of type Obj.

order : string

Item order specification: ((<attr1> . #t|#f) ... (<attrN> . #t|#f)

List of attributes or attribute and boolean pairs to indicate ascending (#t) or descending (#f).
Example


((name . #t) (company . #f))

pattern : string

Converter pattern

Examples include


date.m.f
currency.s
shortCurrency
percent
quantity
priceCurrency
shortDate
{0;choice;0||1|{$};*}  - this syntax allows for different treatment of plurals
{@$.fullName;link;;@i}
time.m
datetime.m.f
{@$.fullName;string;}
integer
shortTimestamp
ids.conversationsTo
#,##0.##
date.l.f
longDate
{@$.userPerson.fullName;string;}
internationalPhone

reader : string

Custom read event. [<class>]'<event> <arg1> ... <argN>

Specification: [<class>]'<event> <arg1> ... <argN>

<class> is an optional class symbol. When omitted, the items collection class is used. <event> is a read event symbol. <arg#> is an event argument value which can be either a constant or a scheme expression evaluating to a constant at run-time on the client, using special local variables provided by the framework: this (=controller), :node (=active node), :attributes, :where, :orderBy, :count, :offset, :xlock, or a UI initializer variable.

If arguments are not specified, a default list is supplied by the framework: :attributes :where :orderBy :count :offset :xlock

Examples:

a) Generate a request to 'readList event with default arguments: readList

b) Generate request to readList event with attributes, and orderBy argument values supplied by the framework. readList :attributes :orderBy

c) Generate request to Contact'readDetail with attributes supplied by the framework, and the contact argument calculated using (current-contact) client library function. Contact'readDetail :attributes (current-contact this :node)

In a library: (define (current-contact controller node) ... )

d) Generate request to 'read event with a constant attribute list: read '(lastName firstName) :where :orderBy :count :offset :xlock

search : string

Search text association path

sort : ComboSortType

Set to "server" to perform sort on the server, "client" to perform sort on the client when order expression is not supported by the data source

Valid values based on“string”.
client

The model will be sorted on the client.

server

The model will be sorted on the server.

tooltips : string

The attribute, association path, or a constant specifying tooltips.

unit : string

Converter unit association path or expression

values : identifierList

Association path or expression to the value returned from the items in the collection

If blank, the value will be the object itself - not an attribute on the object.

Note that this property isn't a list of values. It is simply the association path, or expression, to the return value of the items.

It is called values (plural) because it returns the values(s) from the collection's item(s).

Valid values based on“token”.
(:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*\s+)*(:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*)?

Each element in the list must begin with a letter or underscore. Elements are space delimited.

where : string

Logical expression that the items must satisfy. If quasiquoted, it is expanded on the client every time the model is (re-)loaded.

Special local variable this (=controller) is provided by the framework for the function
Example


Constant where expression:
(= (@ firstName) "Joe")

Function returning where clause:
`(generate-where-clause this "EntityId")

In a library:
(define (generate-where-clause controller var)
...
)

Content
  • Sequence of: