I know from the Documentation that there is interlocking between Document Models and Form Models. It seems that this interlocking goes so far that when I save a new document, the document created references the Document Model in the Form Model.
Does this mean that when referencing Heterogenous Document Models that I need to model a Form Model for each individual subType that is not abstract? For Example:
| Document Model |
Annotations |
Form Model |
| Contract_DM |
abstract = true |
- |
| Contract_DM_subType1 |
superTypes = Contract_DM |
Contract_FM_subType1 |
| Contract_DM_subType2 |
superTypes = Contract_DM |
Contract_FM_subType2 |
| Contract_DM_subType3 |
superTypes = Contract_DM |
Contract_FM_subType3 |
| Contract_DM_subType4 |
superTypes = Contract_DM |
Contract_FM_subType4 |
I understand this approach if you assume that the different subTypes have extra Fields and Groups modelled on them. This approach seems inefficient if the Fields and Groups are identical and only the Validation and Computation Rules change.
Is there any way that all 4 subTypes can reference a single Form Model?
All of our examples for heterogeneity have different form models, exactly for the reason that you mentioned - we assumed that they have different fields. Could you please describe your concrete use case?
Looking at the code, it looks like it should also work if you only declare one form model in the scene, which should reference the abstract DM.
Sorry for the delay in replying.
This idea came from the world of insurance, where the premium that the customer pays depends on the amount being insured and a percentage which represents the risk to the insurer so that:
Amount being insured x Risk = Cost of Contract
or
10 000 € x 5% = 500 €
As the risk rarely changes, it makes sense to put this value directly into the Computation Rule:
Precondition
FieldFilled(AmountBeingInsured)
Computation
[AmountBeingInsured] x 0.05
When this risk percentage changes, the modeler can create a new subtype document model with the new value. Old documents can still be loaded and recalculated correctly as they reference the subtype document model that they were created with.
The idea was to use heterogeneous subtypes to reflect occasional changes in business logic. The modeler cannot use a single document model as this could lead to incorrect recalculation of old values.
Alternative solutions might be:
| Alternate Solution |
Pros |
Cons |
| Model Risk as a Field |
Risk Value is stored in database with the Document |
Unclear how and when this field should be filled. Using an Initial Value in the Form Model doesn’t feel right. Using a Workflow process feels like overkill |
| Risk is stored in a separate Document |
Multiple Risk Documents with different rates can be stored |
Calculation only works in CDM context .Correct document must be linked |