Altinn / Altinn/app-frontend-react

Writing formulas with integrated dynamic values

Open
#1,584 1 comment 0 reactions 0 assignees View on GitHub
kind/feature-request org/ssb
Dominant language
TypeScript
Stars
21
Forks
33
Avg merge
6d 23h
Merged PRs (30d)
3

Description

### Description

There is no way of writing a proper formula in html/markdown without using Javascript (as far as i know). I tried to present a fraction like this we had in AltinnII.
![image](https://github.com/Altinn/altinn-studio/assets/42466346/cd759fe8-d5dc-4cb8-98c2-4a9e5c341f9f)
but ended up using this, which has poorer readability.
![image](https://github.com/Altinn/altinn-studio/assets/42466346/f9dce1e7-3259-4ed3-b7d0-f2aa0e07ec09)

In these pictures the number 99 % has been calculated in C#, so it should be possible to integrate values from the datamodel and if possible text from the resource-files.

I found something that looks useful on this web-page: https://www.sqlpac.com/en/documents/html-equations-math-with-mathjax-asciimath.html but I don't know how to f.ex. use this to make a custom "formula-component" or something like that.

### Additional Information

With this implemented it would also be possible to write far more advanced expressions, like this f.ex.
![image](https://github.com/Altinn/altinn-studio/assets/42466346/06a3dc52-0590-4c21-bc83-45a8680afea2)

Not that I need to right now, but I guess there are other people that also have a need to explain how things are calculated, maybe Skatteetaten?

Contributor guide

Open the contributing guide

Research direction

No source file, test, or entry point is identified. Start by reviewing the frontend's existing HTML/Markdown rendering and the proposed MathJax approach, then define how formulas receive datamodel and resource values. Done should mean authors can render readable formulas with integrated dynamic values.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.