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: 188
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: 1281
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.
: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.

User avatar
baudwalker
Veteran Member
Posts: 188
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: 1281
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.
: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.

Post Reply