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

Ability to consume attachment in CSV format within the form #6825

Open
ebruchez opened this issue Mar 3, 2025 · 2 comments
Open

Ability to consume attachment in CSV format within the form #6825

ebruchez opened this issue Mar 3, 2025 · 2 comments

Comments

@ebruchez
Copy link
Collaborator

ebruchez commented Mar 3, 2025

Scenario:

  • attach CSV file
  • action reads CSV file and populates a repeated grid with the contents of the file

What we already have:

  • an Attachment form control, of course
    • the result in the form is a URL (pointing either to a temporary file, or to a persistence layer URL)
  • the Action Syntax,
    • allows calling services, iterating over data, filling grids, setting control values
  • calling an action upon a file being attached
    • fr:attachment dispatches xforms-value-changed, and might be good enough
    • it could also dispatch xforms-select/xforms-deselect

What is needed:

  • calling a service or function which can dereference the URL of an attachment
    • services currently are not linked to attachments
    • possibly the doc() function could be used?
    • XPath 3 has unparsed-text(), which is a better fit
  • convert CSV content to XML

Security considerations:

  • consider what URLs doc() and/or unparsed-text() have access to

+1 from customer

@avernet
Copy link
Collaborator

avernet commented Mar 4, 2025

It might also be worth thinking about what a higher-level solution built into Form Runner would look like. For example, form authors could enable an "Add CSV/Excel data" feature for any repeated grid that could implement that functionality, possibly mapping columns in the CSV/Excel to columns in the grid. We could have options for replace versus add. The CSV/Excel wouldn't be attached to the form.

@ebruchez
Copy link
Collaborator Author

ebruchez commented Mar 4, 2025

Higher-level has benefits:

  • more form author-friendly
  • can be maintained and improved over time

Drawbacks:

  • larger implementation effort

The two approaches are not exclusive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants