-
We want to adapt our application for sending eForms, but we cannot modify the visual part. Is there a way to translate the information we currently have in our application to the conceptual model using the SDK? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Good question, yes you can get to the conceptual model but not directly. The visual model and the conceptual model are linked by the fields.json node and field ids
Fields.json: Notice type definitions (one per notice sub type), which shows how to build a form for each notice: If you cannot modify the form data you receive or treat, you could transform it into a format closer to the visual model before going to the conceptual model. Personally I would transform the entire form into JSON (if not already in JSON) and then create my own enriched visual model like JSON copy (with correct node ids and field ids assigned). For example:
All the fields that are below ND-Lot, thus having ND-Lot somewhere as a parent, must be grouped under something having ND-Lot specified otherwise they cannot be repeated correctly. Field example:
BT-137-Lot MUST be under a visual group (area of your form) which points to ND-Lot, assuming of course that this field is allowed in this notice sub type which you can check using the NTDs or the fields.json "noticeTypes". As a starting point you can refer to the notice type definitions: From there as long as the hierarchy (the nesting) is correct, you should be able to use the SDK and code of the editor demo. Another thing to note is that in the Editor demo the missing non repeating nodes are added, this means it is possible to only focus on the repeating nodes in a first step. The Editor demo will also complain if the hierarchy is missing repeatable nodes, so you could use that to help. I recommend you look at the unit tests as they are self-contained and simpler than real examples which allowed me to test the "to XML" feature without having too much clutter. The simplest one is the one based on a simplified dummy X02 form but it does not show node repetition: I recommend you also start with a dummy notice just to be more familiar with the concepts, for this I think this unit test is the most interesting, simple and complete as it tests nested repetition: |
Beta Was this translation helpful? Give feedback.
-
If that is possible, it would be easier yes. |
Beta Was this translation helpful? Give feedback.
Good question, yes you can get to the conceptual model but not directly.
The visual model and the conceptual model are linked by the fields.json node and field ids
By node I mean the items in the xmlStructure part of the fields.json file (those having ND-... as an id).
form (hierarchical) -> fields.json info + form data enriched with node and field ids -> conceptual model
Fields.json:
https://github.com/OP-TED/eForms-SDK/blob/1.5.0/fields/fields.json
Notice type definitions (one per notice sub type), which shows how to build a form for each notice:
https://github.com/OP-TED/eForms-SDK/tree/1.5.0/notice-types
If you cannot modify the form data you receive or treat, you could transform it i…