Skip to content
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

Subform: cellContent display value based on optionList #2475

Open
kentare opened this issue Sep 23, 2024 · 1 comment
Open

Subform: cellContent display value based on optionList #2475

kentare opened this issue Sep 23, 2024 · 1 comment
Labels
kind/feature-request New feature or request org/brg Issues relevant for Brønnøysundregistrene. status/triage

Comments

@kentare
Copy link

kentare commented Sep 23, 2024

Description

Context

We have 1-n subforms that have a option list with text resources attached. We need the cellContent to display the text that is connected via the option list text resource value.

Current behaviour

Under is an example of todays behaviour. Rapport-RR0007U.aarsregnskap.type.value is connected to a option list in the subform

A table column in subform

          {
            "headerContent": "Test headercontent 2",
            "cellContent": {
              "query": "Rapport-RR0007U.aarsregnskap.type.value",
              "default": "default tekst da lookup failed"
            }
          }

Option list

[
  {
    "value": "S",
    "label": "Regnskapstype-Selskapsregnskap.label"
  },
  {
    "value": "K",
    "label": "Regnskapstype-Konsernregnskap.label"
  }
]

Result

image

Proposed solution 1

Specify option list to render text from

    "cellContent": {
    "query": {
           "dataModelBinding": "Rapport-RR0007U.aarsregnskap.type.value",
           "optionsId": "option_list_id"           
         },
     "default": "default tekst da lookup failed"
      }

Proposed solution 2 (preferred)

Dynamic expressions in context of the subform datamodel. Rapport-RR0007U.aarsregnskap.type.value is the value in the subform datamodel.

    "cellContent": {
    "text":  [
           "if", [
               "equals",
               ["Rapport-RR0007U.aarsregnskap.type.value", "S"],
               "Regnskapstype-Selskapsregnskap.label"
           ],
          "else", "Regnskapstype-Konsernregnskap.label"
       ],
     "default": "default tekst da lookup failed"
      }

To target other datamodels (not the subform datamodel) you could still do something like this ["dataModel", "Path.Inside.DataModel", "someDataType"]

Additional Information

No response

@kentare kentare added the kind/feature-request New feature or request label Sep 23, 2024
@RonnyB71 RonnyB71 added the org/brg Issues relevant for Brønnøysundregistrene. label Sep 23, 2024
@olemartinorg
Copy link
Contributor

Hi! This should be possible already, although not with any of the methods described in the proposed solutions. In the subform you can configure the component which is using the options to store the display value in the data model. You can then refer to that path when displaying the value in the Subform table. If you don't want that value to be a part of the data model later, you can configure it as a shadow field (although deletion of shadow fields from sub forms are currently untested, i believe).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request New feature or request org/brg Issues relevant for Brønnøysundregistrene. status/triage
Projects
Status: No status
Status: No status
Development

No branches or pull requests

3 participants