Page 1 of 1

data from parent table

Posted: 2018-03-13 07:01
by baudwalker
is it possible to get the actual data from the parent table instead of the ID

Re: data from parent table

Posted: 2018-03-14 09:49
by a.gneady
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.

Re: data from parent table

Posted: 2018-03-24 03:30
by baudwalker
I must be getting old!!, what file are you referring to?

Barry

Re: data from parent table

Posted: 2018-03-28 08:41
by a.gneady
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.