Hey!
I’m just getting started with SME and I’m struggling with the ‘include’ option.
When a user fills out my form, I want to use the input data in another DM, so that a service person can host and edit every form.
How can I do that? When I try to use ‘include’, I get the error message: 'The included model may only contain a single, non-repeatable group at top level"
Hey @julius-low-kernel,
there is no automatic datasynchronization for included fragements in A12, because one can use the same include with different semantics - and even Repeatabilities.
For example an address block might be modeled in one Document Model and included into a different Document Model “Invoice” once as Billing Address, once as Shipping Address. You probably do not want to keep those synchronized per default.
If “a service person can host and edit every form” means, that the data of all forms should change simultaneously, you could use Relationships (and CDMs). There you split the data objects (the main form and the part you want to include) and give them two independent document lifecycles.
(In the address example: there is a centrally managed list of address documents, users can link an address document to their Invoice via a Relationship link. When a service user changes the address, it would be changed for all the Invoices.)
Please have a look in GetA12 Documentation > Modeling > Data Modeling > Relationship Modeling > Differences Between a Relationship and a Repeat
for more information about the two approaches.
On the other hand, A12 provides the Mapping feature to transfer data from one document to another on server side. You could use this feature to pull data from one document to another. The two documents (and the data therein) would keep their own, independent lifecycle. Changes on one document would not be reflected automatically on the other.
And regarding the error message “'The included model may only contain a single, non-repeatable group at top level”
Currently A12 only supports to include Document Models into other Document Models, if they have just one root group and share locales.
Just create one Group on the highest level and move all the model content you currently have into this Group. Then you should be able to include it into different Document Models.