Skip to content

Commit

Permalink
add docs for options-metadata (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnusrm authored Dec 11, 2023
1 parent 196b74a commit efbc850
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions content/app/development/data/options/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,33 @@ if (string.IsNullOrEmpty(someArg) || string.IsNullOrEmpty(someOtherArg)) {
Notice that this wil result in the option value and not the label being present as the end users answer.
{{% /notice%}}

### Store metadata for the parameters used to retrieve options in tha datamodel

You can store metadata for the parameters used to retrieve options in the datamodel by setting the `metadata` property
on the components `dataModelBinding` property:

```json
{
"id": "some-dropdown-component",
"type": "Dropdown",
"textResourceBindings": {
"title": "NyGarantiLoyvetype"
},
"dataModelBindings": {
"simpleBinding": "soknad.nyGaranti.loyvetype",
"metadata": "soknad.transportorOrgnummer"
},
"required": true,
"optionsId": "loyvetyper",
"mapping": {
"soknad.transportorOrgnummer": "orgnummer"
}
},
```

This configuration will store the metadata of the retrieved options as a comma separated string in the
field `soknad.transportorOrgnummer` in the datamodel.

## Description and HelpText

`description` and `helpText` is supported by options in apps that use version v7.8.0 or higher. `description` and
Expand Down
27 changes: 27 additions & 0 deletions content/app/development/data/options/_index.nb.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,33 @@ if (string.IsNullOrEmpty(someArg) || string.IsNullOrEmpty(someOtherArg)) {
Merk at dette vil resultere i at PDF vil vise verdien valgt og ikke label som sluttbrukers svar.
{{% /notice%}}

### Lagre metadata for parametrene som ble brukt til å hente options

Du kan lagre metadata for parameterene som ble brukt til å hente options i datamodellen ved å sette `metadata` property
på komponentens `dataModelBinding` property:

```json
{
"id": "some-dropdown-component",
"type": "Dropdown",
"textResourceBindings": {
"title": "NyGarantiLoyvetype"
},
"dataModelBindings": {
"simpleBinding": "soknad.nyGaranti.loyvetype",
"metadata": "soknad.transportorOrgnummer"
},
"required": true,
"optionsId": "loyvetyper",
"mapping": {
"soknad.transportorOrgnummer": "orgnummer"
}
},
```

Denne konfigurasjonen vil lagre metadata for parameterene som ble brukt til å hente options som en kommaseparert
streng i feltet `soknad.transportorOrgnummer` i datamodellen.

## Beskrivelse og Hjelpetekst

`description` og `helpText` støttes av options i apper som bruker versjon v7.8.0 eller høyere. Beskrivlese og
Expand Down

0 comments on commit efbc850

Please sign in to comment.