Altinn / altinn-pdf

Altinn platform microservice for generating PDFs
0 stars 1 forks source link

Dynamics in repeating groups not handled in PDF #4

Closed OddArneSaetervik closed 2 years ago

OddArneSaetervik commented 2 years ago

@ingunnjv commented on Wed Feb 02 2022

What needs to be solved?

When a form has repeating groups with dynamics in them, I would like to reproduce the dynamics in the PDF by excluding different components in different entries in the repeating group.

I have a form with many repeating groups, where each group contains its own dynamics. Example: image

If "Annet" is chosen, a textbox appears where user can fill in a description: image

In the PDF, I did not find a way to implement this. So the component for "Beskrivelse av annet format" is always visible even if "Annet" is not chosen: image

How do you want it solved?

I want to configure this in PdfHandler. Perhaps we could add a "{0}" to the string of components in repeating groups, similarly to how it is handled in RuleConfiguration. Would also need a way to access indices of the field which triggers dynamics.

Alternative solutions

It is already possible to loop through entries in a repeating group in PdfHandler since it is a list, so a possible solution is to add functionality for passing an index to layoutSettings.Components.excludeFromPdf. For example by adding an index to the component name string. This leaves more work for the developer of the app.

acn-sbuad commented 2 years ago

This is already supported. Documented syntax on docs.altinn.studio.