Page 1 of 1

Linking Tables

Posted: 2015-11-28 18:50
by rharkonen
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!

Re: Linking Tables

Posted: 2015-11-29 22:23
by a.gneady
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.

Re: Linking Tables

Posted: 2015-11-30 02:48
by rharkonen
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.

Re: Linking Tables

Posted: 2015-12-01 11:36
by a.gneady
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

Re: Linking Tables

Posted: 2015-12-02 02:34
by rharkonen
Ok, thanks for that. I will play around with it and see what I can come up with!