How to handle Occurence number of elements ? ? ?

I have generated an application using XApplication Generator.
In my schema I have some elements with maxNumbers = * meaning can be multiple.
In the project generated with I have to press Add button to insert a new occurence of this type.
But I dont want to have to do that :frowning:
How can I arrange this so that I have these nodes inserted when I first create the record.
(I used to do this in Bolero very easily
in the class ClsFormHandler there used to be two fields named :xwizEmptySingles and xwizEmptyGroups)
Do anybody have an idea how to implement the same thing in XApplication ?


in comparison with X-Wizard there is a difference: X-Application does not support a ?More Data? button which adds new field to each occurrence (elements with multiplicity * or +) of a document. Instead of this button X-Application supports element actions to insert or remove entries from a single occurrence. In this way it is more flexible.

However, what can you do if you want to have more empty entries within an occurrence.

(A) You could change your schema to change the number of default entries for an occurrence:




In this case the element ‘X’ must three entries of ‘myOccurrence’ at least and X-Application will create three default entries within the create page.

- With this change three entries of ‘myOccurrence’ are mandatory for a document. Documents with less than three will not be accepted by Tamino.
- The change does not affect the behavior of the element action. A click to the add button/link will insert only one new entry.
- X-Application does not check the content of the elements. If the fields are empty they will not be removed from the occurrence: When the user enters only one entry, the two other remain in the occurrence and can not be removed.

(B) Change the source of X-Application: You could control the processing of documents. The class you have to deal with is
It has methods for creating / removing / committing … documents. You could add code into the create method that fills occurrences with empty fields. Within the commit method you would add code, that checks occurrences for empty content and removes it.

Remark: If you decide this (B) will be your solution, wait for our next X-Application 3.1.2 planned for end of February. We spent a lot of work to redesign the code and renamed also some classes. ‘ModuleInstance’ for instance was renamed to ‘SessionContext’.

Unfortunately, I can not tell you a simple solution as changing the value of a parameter. Perhaps someone else familiar with X-Application finds a simpler approach to solve your problem.