Manifest Parameters
Parameters are means to provide dynamic values for certain card attributes.
The manifest parameters are replaced during manifest processing and
can be used with a double bracket syntax like: "{{parameters.city}}
".
Parameters can be used inside "sap.card
" scope.
There are two groups of parameters:
- User defined manifest parameters
- Predefined manifest parameters
User Defined Manifest Parameters
Card developers define input parameters in the card manifest. The input parameters can be everything including user IDs, authentication tokens, locations, language etc... It is possible to assign default values to the input parameters in the manifest. If parameter value is not set during card creation or integration, default value will be used. Parameters are defined in the "configuration" section of the manifest. All parameters are replaced during manifest processing and changing them will cause re-processing of the manifest.
Since version 1.87 user-defined parameters can also be accessed in expression binding with single brackets binding syntax "{parameters>/city/value}".
Parameter properties:
Property | Type | Required | Default | Description | Schema Version | Since |
---|---|---|---|---|---|---|
value | any | Yes | The value of the parameter. | 1.15.0 | 1.65 | |
type | string | No | string | The type of the value for the parameter. See 'Parameters types' below for list of available types. | 1.20.0 |
Parameter types:
This table shows the supported value types for manifest parameters.
Note: Currently the type of the parameter is used only in UI adaptation during designtime. There is no runtime data type validation.
Type | Description | Example |
---|---|---|
string | This is the default type. | https://sap.com/ |
integer | Number limited to integer values. | 15 |
number | Number which allows any numeric values. | 3.14 |
boolean | Valid values are true and false. | false |
date | Any valid date string. Does not include time. | 2020-02-27 |
datetime | Any valid datetime string. Includes time. | 2020-02-27T09:30:00.000Z |
array | Any valid array. (Since version 1.87) | [2,3,5,8,13] |
Predefined Manifest Parameters
The following parameters can be used in the manifest and do not require definition in the "configuration" section.
Parameter | Type | Description |
---|---|---|
TODAY_ISO | string | Replaced with the today's date in ISO format |
NOW_ISO | string | Replaced with the "now" timestamp in ISO format |
LOCALE | string | Replaced with the locale for the current language in BCP47-compliant language tag. |
Examples
User defined manifest parameters "city" and "weatherServices" with default values set. The "city" value is used inside the request. The "weatherServices" value is used inside the title.
{ "sap.card": { "configuration": { "parameters": { "city": { "value": "Berlin", "type": "string" }, "numberOfCustomers": { "value": 5, "type": "integer" } } }, "type": "List", "header": { "title": "Customers & Suppliers of '{{parameters.companyName}}'", "subTitle": "Situated in {{parameters.city}}.", "icon": { "src": "sap-icon://customer-briefing" } }, "content": { "data": { "request": { "url": "https://services.odata.org/V2/Northwind/Northwind.svc/Customer_and_Suppliers_by_Cities", "parameters": { "$filter": "{{parameters.city}}", } }, "path": "/articles" }, "item": { "title": "{CompanyName}", "description": "{ContactName}", }, "maxItems": "{{parameters.numberOfCustomers}}" } } }
Changing the city parameter can be done by using the API of the card. This will cause manifest re-processing:
var oParameters = { "city": "Sofia" } oCard.setParameters(oParameters);
Using the predefined manifest parameter "TODAY_ISO" inside the subtitle of the card:
{ "sap.card": { "type": "List", "header": { "title": "Some title", "subTitle": "Date: {{parameters.TODAY_ISO}}" }, ... } }
Parameters of type array can be used in expression binding:
{ "sap.card": { "type": "Object", "configuration": { "parameters": { "teamMembers": { "value": ["Donna Moore", "Alain Chevalier"] }, "visibleFields": { "value": ["firstName", "lastName"] } } }, ... "content": { "groups": [ { "title": "Contact Details for: {=${parameters>/teamMembers/value}[0]}", "visible": "{= ${parameters>/visibleFields/value}.indexOf('firstName')>-1}" ... } }Try it Out