Junction Tables

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
djd
Posts: 4
Joined: 2014-08-20 13:49

Junction Tables

Post by djd » 2014-08-20 13:59

Hi,

Apologies if this has been answered before (I couldn't find it by searching).

How does AppGini implement junction tables? I have used these to do my many-to-many relationships in my database.

http://en.wikipedia.org/wiki/Junction_table

I would like a button similar to the existing 'Display a link to children records from' option in AppGini but that gives me all the matching records from the other non-junction table. E.g. Using the example given by wikipedia, I would like a button on the User table detail view that takes me to a view of the corresponding Permissions records, without needing to interact with the UserPermissions table in between.

Am I missing something or this more difficult?

taclark
Posts: 1
Joined: 2014-08-22 12:14

Re: Junction Tables

Post by taclark » 2014-08-22 12:26

I am looking for the same thing. Thanks for your post, but I haven't found an answer either.

djd
Posts: 4
Joined: 2014-08-20 13:49

Re: Junction Tables

Post by djd » 2014-08-28 19:52

Any ideas devs? It has been 8 days with no reply. Is this product still supported?

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: Junction Tables

Post by a.gneady » 2014-09-01 19:55

All you need to do is follow the example in the Wikipedia page you mentioned .. just create 3 tables, one of them containing 2 lookup fields, one for each parent table ... now under the users table, you won't see a list of permissions from the permissions table, but rather a list from UserPermissions table (the junction table) .. However, you can configure the lookup field in UserPermissions to display the PermissionDescription value rather than the PermissionKey value by setting the parent caption field to PermissionDescription.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

djd
Posts: 4
Joined: 2014-08-20 13:49

Re: Junction Tables

Post by djd » 2014-09-05 19:48

Hi Ahmed,

Thanks but this doesn't provide the single click button on the User table detail view that takes me to a view of the corresponding Permissions records. It only gives me a view onto the intermediate table and so you have to click again to begin editing.

I ended up making a clone of Permissions_view.php called Permissions_view_User.php. Permissions_view_User.php takes the UserID and returns a table view of all the Permissions associated with the UserID. I also have to edit the User_templateDV.php to include a button for Permissions_view_User.php.

I am surprised that Appgini doesn't have a built in feature for this given how common many-to-many relationships are in databases.

tresero
Posts: 1
Joined: 2014-09-11 20:44

Re: Junction Tables

Post by tresero » 2014-09-11 20:51

Any word on this? Without a way to do M2M it is almost impossible to create realworld applications.

Post Reply