Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to reference child element for computation on JSON Form?

Issue

I am having trouble computing the Sub Total on my JSON form, specifically on the Expense Lines. The current code only works for the first line and I am unable to reference the current array item to achieve dynamic computation. This seems to be an enhancement that needs to be addressed in the code.

Resolution

The issue at hand was how to dynamically reference the child elements in a JSON form to compute data on multiple lines instead of just the first line. The original solution involved using an index to reference the specific line, but this only worked for the first line and not subsequent lines.

A proposed solution was to use the sourceData property from the JSON form to compute data dynamically rather than referencing a particular index. However, this did not work as the form involved child objects rather than the main object.

Ultimately, it was identified as an enhancement that needed to be addressed and an issue was created to resolve the problem. No further solution or code example was provided as it requires further development work.