many-to-many relationships

Confluence User - 07 May, 2018

Hi there

What is the best way to achieve many-to-many relationships in Joget? Here's a hypothetical scenario that explains the question:

  • I have a 'suppliers' table with a list of suppliers
  • I have a 'products' table with a list of products
  • Products can be offered by many suppliers, suppliers can offer many products

What is the best way to achieve this in Joget whilst maintaining a normalised data structure? I want to create a project form where I can add suppliers to products by looking them up. When looking up suppliers I want to see details (e.g. their location) and I only want to store the supplier Id against / product Id combination.

 Thanks for your help!

Edit: changed the example from employee/project to supplier/product as this is probably a better example of non standard functionality.

forms;datalists

2


07 May, 2018
confluenceUser
confluenceUser

Hi there,

Please see this article - https://dev.joget.org/community/display/KBv6/Many+to+Many+Relationship+Form+Design

Hope it helps.

Thanks.

Hugo

09 May, 2018
confluenceUser
confluenceUser

Hugo, I just tried out the provided example app and it works well for the simple (one field) use-case.

The only issue seems to be with the way the Form Grid manages the display and storing procedure when using many-to-many relationships.

For example, if I add TextField2 in form 2 and I want to be able to see it in the Grid in from 1, I need to add a (ajax) subform and can then see that coming through in the grid if I add TextField2 as a column.

However,

  1. the data gets now stored in table2 if I changed anything in the popup subform (correct behaviour) but also adds columns in the mapping table. (undesirable behaviour)
  2. When I save and open up form 1 again, I can only see TextField1 (I would have to use custom jdbc to pull through TextField2 of form 2 as well)

Do you have any tips / ideas how to resolve these two issues. I attached a new version of the example app where you can see what I mean.

APP_Many2Many-1-20180509153107.jwa

Cheers,

Eric

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print