data from parent table

Wish to see a specific feature/change in future releases? Feel free to post it here, and if it gets enough "likes", we'd definitely include it in future releases!
Post Reply
User avatar
baudwalker
Veteran Member
Posts: 86
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

data from parent table

Post by baudwalker » 2018-03-13 07:01

is it possible to get the actual data from the parent table instead of the ID

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

Re: data from parent table

Post by a.gneady » 2018-03-14 09:49

You'd need to do a join query .. something like this:

Code: Select all

$parent_value = sqlValue("select parent_caption_field from parent_table left join child_table on parent_table.id=child_table.lookup_field where child_table.id='{$record_id}'")
Replace parent_caption_field, parent_table, child_table, lookup_field, id with actual names. $record_id is the variable containing the ID of the child record.
AppGini: Responsive, collaborative web db apps in minutes.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

User avatar
baudwalker
Veteran Member
Posts: 86
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

Re: data from parent table

Post by baudwalker » 2018-03-24 03:30

I must be getting old!!, what file are you referring to?

Barry

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

Re: data from parent table

Post by a.gneady » 2018-03-28 08:41

I didn't mean any specific file in particular. But this should work in any PHP file inside hooks, or for any custom file you add to your AppGini app.
AppGini: Responsive, collaborative web db apps in minutes.
:idea: Learn all the tips and tricks of customizing AppGini apps through our online course.

Post Reply