Linking Tables

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
rharkonen
Posts: 3
Joined: 2015-10-14 02:32

Linking Tables

Post by rharkonen » 2015-11-28 18:50

Hi,

I have a database Client, Asset and Stall table for a parking lot. Client has the personal information and is linked to an asset. The asset then has a drop down menu to pick a stall number to attach to it. My problem is I would like to be able to click on stalls and tell which stalls are empty from the ones without an asset attached. My preference would be to show a field with the clients name in the stall so that I know who is in which stall.

Tables Layout:

Client
-firstname
-lastname
-phone
-email
-address

Asset
-make
-model
-licenseplate
-stallnumber

Stall
-stallnumber

Thanks!

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

Re: Linking Tables

Post by a.gneady » 2015-11-29 22:23

You should add a client lookup field in asset table to link assets to clients. Then, for the stall table, open the "Parent/Children settings" window in AppGini and enable listing child assets, then generate your application ... this way, when a user clicks a stall to open it in the detail view, he can see a list of assets attached to it. The client info would be visible as well since you now have a client lookup field in the stall table.
:idea: AppGini plugins to add more power to your apps:

rharkonen
Posts: 3
Joined: 2015-10-14 02:32

Re: Linking Tables

Post by rharkonen » 2015-11-30 02:48

I do have it setup like that, but my problem is there is no quick way of seeing which stalls are empty when you list all of the stalls. I would like it if I could have a column that would generate information showing that there is an asset in a stall. This way I would be able to filter by full or empty stalls only.

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

Re: Linking Tables

Post by a.gneady » 2015-12-01 11:36

You could add a checkbox field "hasAssets" or similar name to the stalls table, set it as read-only in AppGini, and have it updated to "1" if any asset is inserted/updated with the corresponding stallnumber. You can use the asset table's after_insert and after_update hook functions for that: http://bigprof.com/appgini/help/advance ... ter_insert
:idea: AppGini plugins to add more power to your apps:

rharkonen
Posts: 3
Joined: 2015-10-14 02:32

Re: Linking Tables

Post by rharkonen » 2015-12-02 02:34

Ok, thanks for that. I will play around with it and see what I can come up with!

Post Reply