-
Notifications
You must be signed in to change notification settings - Fork 32
Variables in text. Empty variables in will display path to datasource. #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In the long term, we hope to replace these variables with dynamic expressions. With expressions, it's possible to control what gets displayed if the value is empty. Right now (even in your screenshot example), there is no proper default. Displaying an empty string is a bit better - but it's still not optimal. We could, of course, figure out that the field is formatted as a number (or uses a number type in the data model) and assume You can fix this in your app at when using the latest |
As an easier quick-fix, I believe we should support a default parameter (in plain text, or possibly other text keys - if easy to implement). {
"id": "entityInfoBusinessId",
"value": "Business ID: {0}",
"variables": [
{
"key": "EntityInfo.BusinessId",
"dataSource": "dataModel.default",
"default": "(missing value)" // <--------- New parameter
}
]
}, This might have consequences for Studio, so we should make sure Studio doesn't clean these up for us. It's also relevant for the possible future language file format, where references to the data model will change at some point (@mjulstein @mijohansen @TomasEng @andrealouisestanderen). |
Kunne man brukt |
Tekstnøklene har ikke en 1-1-relasjon med komponentene, så det blir ikke naturlig å putte Vi støtter nå dynamiske uttrykk på alle verdiene i [
{
"id": "entityInfoBusinessId",
"value": "Business ID: {0}",
"variables": [
{
"key": "EntityInfo.BusinessId",
"dataSource": "dataModel.default"
}
]
},
{
"id": "entityInfoBusinessIdNotFound" // <--- Lagt til
"value": "Business ID not found",
}
] Og i layout-fila: {
"id": "abc123",
"type": "Header",
"textResourceBindings": {
"title": [
"if"
["equals", ["dataModel", "EntityInfo.BusinessId"], null]
"entityInfoBusinessIdNotFound",
"else",
"entityInfoBusinessId"
]
}
} Med andre ord, man kan nå bruke uttrykk for å bytte mellom forskjellige tekstressurser, avhengig av f.eks. verdien som ligger i datamodellen. En manglende verdi vil være lik |
Description of the bug
If a variable's datasource is empty, the path to the datasource will be displayed.
Steps To Reproduce
Clone and run app ra0182.
Additional Information
No response
The text was updated successfully, but these errors were encountered: