Hello all, I need to model a many to many bidirectional relationship.

Hello all,

I need to model a many to many bidirectional relationship...which I know that is not available in Appian, but I am trying in some other ways.
The scenario is the following I have an application object which have two lists: list A and list B. In the interface I receive the application object through a rule input, and I have three sections:
- One editable grid for list A. This controls ri!application.A_list
- One editable grid for list B. This controls ri!application.B_list
- One editable grid for the link between them (this is basically a reproduction of the clasical many to many lookup table), which contains 2 dropdown fields, one for A one for B. This controls ri!application.A_B_list.

My initial ideea was to save in the A_B Link CDT the IDs of the entities A and B which are corelated. But this can not be applicable (or at least I was not able to do it), because at the moment of the creation, A and B entities do not have IDs. We need to...

OriginalPostID-170436

OriginalPostID-170436

  Discussion posts and replies are publicly visible

  • ... first save them to the DB.
    My second ideea was to save in the A_B Link CDT the entire A and B objects. This looked pretty good, but actually in the DB was saving 2 rows for A, and 2 rows for B. I suppose this is because of the one2many (application - A/B list) and one2one relationships ( A/B list - A_B_list).

    Did anybody managed to find a workaround for this? Could you please help me with some examples?

    Thank you,
    Octavian
  • You could use two screens with a write to the DB inbetween them. Have your user input task with Grid A and Grid B on the first screen, have the save to DB node, then another user input task for the linking of the two Grids.
  • Hello,
    Yes, I analysed this possibility but unfortunately it is not compliant with the business needs.
    I got it solved in another way: I have everything in the same screen. I created a link table as is in a many2many relationship, but without any foreign keys. For each A and B, when I add a new item I also generate a unique number (in the interface). This number I save in the relationship table. I also use expression rules and query rules to get the B items allocated to A and the A items allocated to B.

    Octav.