Aggregated BDM sub-objects filling from UI forms

1
0
-1

Hi there,

I'd like to get some best practices / how-to info regarding filling BDM fields in sub-objects connected with aggregations.

For instance, I'd like to use a global process pool object "Research" containing aggregated subobjects such as "Operations" that are to be created & populated.
The main "Research" fields are populated in a first form attached to a specific task and the "Operation" subobject list is to be populated within a repeat container in a following form.

I believe this should work fine but I'm not sure how to implement and specifically instantiate and link the collection to the main Research object.
I am currently getting an error in the second step if the collection unless the collection is empty.

Can you provide me with some hints on this subject, please? Is it the right way to do it or should I use specific/separate objects in the contract?

Many thanks in advance for your help.

Cheers.

Roland

2 answers

1
+1
-1
This one is the BEST answer!

Hello Roland,

The current way to achieve what you have described is to:

  1. have a first BDM instance storing your main object (it will contain a "list" attribute that we will fill later)
  2. have a second BDM instance that temporarily store the list items.
  3. use a first operation on your second step to retrieve the list from the contract and store it to your BDM list
  4. use a second operation on your second step to assign your BDM list to your main object attribute

This may not seem the most direct way but the items need to be created in DB first before assigning them to the main object. Note that in this process, the list data is not replicated as we only handle references.

Here is a complete example that demonstrate this use case:
https://github.com/Bonitasoft-Community/aggregated-bdm-example

I hope this helps,

Comments

Submitted by rdelahoupliere on Mon, 03/21/2016 - 18:25

Hi Philippe,

Many thanks for your help & example, this is exactly the scenario I'm trying to implement :)
Temporary objects are no issue.

I'll try to apply this method to my test process and keep you posted!

Cheers,

Roland

1
0
-1

Hi Philippe,

Many thanks, I confirm this works great.
Both the main object and the subobjects get attached and persisted.

I however have 2 more questions :

1- Why use the link to the subarray stored in the main object ( ../{{mainObject.links[0].href}} ) instead of the direct link to the same array instance contained in the task context?
The order of the links elements in the array may become unstable in case there are different types of subobjects, leading to a possible random object while the links in the context are completely qualified?

2- How to get the elements in a simple table array? I cannot get a table to get filled.

I specified
- a variable "operations" of external API type, and tried both links (2 separate tables to test) ../{{context.operations_ref.link}} or ../{{research.links[0].href}} (data retrieved fine when entered in browser)
- the column keys & labels
I tried the content mapping with several expressions "operations", "$operations", "data:$operations"...

Array still remains empty... Can you please help me on this matter?

Many thanks in advance.

Cheers,
Roland

Notifications