Auto-complete Plug-in Examples
This document is for developers or administrators who reuse the prepared and delivered plug-ins for the auto-complete service or want to use other examples which are described below as well.
How to develop auto-complete plug-ins is described here: Auto-complete Plug-ins
Delivered Plug-ins
With every installation of the service-manager, two plug-ins are installed.
The availability and a summary can be checked by calling the info
endpoint:
http://<servicemanager>/app/api/autocomplete/info
object-catalog
Beginning with version 10.10, this object-catalog can be defined via a selected object type. The object type fields must be mapped to the target fields of the catalog. This is done via the following URL parameters
Parameter | mandatory | Description |
---|---|---|
| no | Possible values: Use the placeholder |
| yes | Technical name of the object type where the values are read from. |
| yes | Technical name of the object type property of type string containing the value for the list. |
| no | Technical name of the object type property of type string containing the neutral description for the value if no localization is needed. |
| no | Technical name of the object type property containing the description for the value for English. |
| no | The order direction. Default is |
| no | Technical name of the object type property of type boolean containing the flag controlling the attribute |
| no | Technical name of the object type property of type boolean containing the flag controlling the attribute |
URL Example for object-catalog
:
You can test the object-catalog endpoint via the browser with the following example configurations:
Download this package with schema-template containing the object type catcurrency
, add it to your schema, include permissions in your role, and deploy the schema:
Download this package with the data and the import tool. Edit the catcurrencyimport.properties and enter data for accessing the rest-ws, save the changes, and then run catcurrencyimport.bat
Open the browser, and enter this URL and exchange <servicemanager> with your domain:
http://<servicemanager>/app/api/autocomplete/object-catalog?cat_objecttype=catcurrency&value=catcurrency.currencyiso&description=catcurrency.description&create=catcurrency.create&edit=catcurrency.edit&situation=edit
In the designer, for an object property of type string
the attribute URL for auto-complete
looks like this:
autocomplete/object-catalog?cat_objecttype=catcurrency&value=catcurrency.currencyiso&description=catcurrency.description&create=catcurrency.create&edit=catcurrency.edit&situation={situation}
Response example
{
"entries": [
{
"value": "AED",
"description": "UAE Dirham",
"selectable": true
},
{
"value": "AFN",
"description": "Afghani",
"selectable": true
},
{
"value": "ALL",
"description": "Lek",
"selectable": true
},
...
}
json-catalog
Beginning with version 10.10, this catalog is filled with the contents of a JSON file located on the server and accessible to the client-service.
To use this plug-in, the file path must be defined in the client-prod.yml
:
json.catalog.sources
- pathkey: 'example1'
path: '../data/example1.json'
- pathkey: 'example2'
path: '../data/example2.json'
The parameter passkey
determines the source file for this catalog. The parameter refresh
controls whether the file is read for every request or only at the startup of the client-service. The default is false
.
Example:http://<servicemanager>/app/api/autocomplete/json-catalog?pathkey=example2&refresh=true
The content of the JSON files must match the following format with entries
that can be defined recursively:
{
"entries": [
{
"value": "EU",
"description": "Europe",
"description_de": "Europa",
"selectable": false,
"entries": [
{
"value": "GER",
"description": "Germany",
"create": false,
"edit": false
},
{
"value": "GRC",
"description": "Greece"
},
{
"value": "FRA",
"description": "France"
}
]
},
{
"value": "AUS",
"description": "Australia",
"roles": [ "TEST_ROLE_1", "TEST_ROLE_2" ]
}
]
}
The roles
are compared with the yuuvis RAD role names associated with the logged-in user. The values edit
, create
and selectable
define whether the entry
is selectable in the given form situation
and if it is selectable at all. With selectable
= false
the entry is only shown but cannot be selected in the edit or create situation
of the form in the client.
Response example
For the user’s language set to de
and the situation= search
the response looks like this:
Form script usage for dynamic list fields
This section shows examples of how to reuse the auto-complete plug-ins within form fields classified as a dynamic list.
dummy
This simple plug-in dummy
offers the data of the Greek alphabet:
Its returned data looks like this:
The following formscript calls the auto-complete endpoint dummy
and fills the object property stringforalphabet
: