Auto Fill not storing data if hidden in DV

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
rpierce
Veteran Member
Posts: 258
Joined: 2018-11-26 13:55
Location: Washington State

Auto Fill not storing data if hidden in DV

Post by rpierce » 2022-10-14 16:15

Hello,

I have an auto fill field "Project ID" which is coming from another table. I don't want to show while entering data. If the field is not hidden in DV the data is stored into the database. If the field is hidden in DV then no data is stored in the database. I'm probably missing something somewhere I hope one of you can help me.

Thank you,
Ray

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Auto Fill not storing data if hidden in DV

Post by AhmedBR » 2022-10-14 18:00

This is how I do it:
Keep it hidden in DV and update the database using sql in hooks after insert and after update if necessary.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

rpierce
Veteran Member
Posts: 258
Joined: 2018-11-26 13:55
Location: Washington State

Re: Auto Fill not storing data if hidden in DV

Post by rpierce » 2022-10-14 18:21

Thank you Ahmed,

But, I have no idea of how to write the sql statement to get that done. My sql skills are growing, but slowly I'm afraid.

Ray

rpierce
Veteran Member
Posts: 258
Joined: 2018-11-26 13:55
Location: Washington State

Re: Auto Fill not storing data if hidden in DV

Post by rpierce » 2022-10-14 22:46

I would gladly purchase a library of Hooks code that could be modified for different purposes.

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Auto Fill not storing data if hidden in DV

Post by AhmedBR » 2022-10-15 12:08

I do not think there is a library of hooks,I am just an average coder myself, but I would be happy to help you with this one.
Just tell me the table names and the fields in question.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

rpierce
Veteran Member
Posts: 258
Joined: 2018-11-26 13:55
Location: Washington State

Re: Auto Fill not storing data if hidden in DV

Post by rpierce » 2022-10-15 17:44

Great!

'project' is the main Parent table and I want the 'project_id' field to appear in the database for the child table. 'audit' is the child to 'project' and 'findings' is the child to 'audit'. I also want the 'project_id' field data in the findings table. I have that set as an auto fill but it isn't being populated in the database either since I have it hidden in DV.

I'm sure this is confusing but I'll give you any more information you need.

Thanks for offering to help.

Ray

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Auto Fill not storing data if hidden in DV

Post by AhmedBR » 2022-10-15 18:53

Just need one more field name, the other field that causes the auto fill, as we are going to use it to get the sqlvalue of project_id

In other words project_id in the audit table is auto filled based on what field in the audit table?

Here is how it works, this way you can do it in other places if you need to:
First we get the value from the project table that is not auto filling:

Code: Select all

      $proid=sqlvalue("select `project_id` from `project` where `id` = {$data['THE FIELD THAT CAUSES the auto fill']}",$eo);
With the value in hand we update the other table:

Code: Select all

    	sql("update àudit` set `project_id` = $proid where `id` = {$data['id']}",$eo);
Both lines goes in after insert hook and after update hook in audit table.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Auto Fill not storing data if hidden in DV

Post by AhmedBR » 2022-10-15 19:00

By the way the above will get the actual value, but in case you just need to make just a reference, then it is even simpler:
You just set the value as the other field.

Code: Select all


sql("update àudit` set `project_id` = `THE FIELD THAT CAUSES the auto FILL`  where `id` = {$data['id']}",$eo);

Since Appgini will always use id of the parent for all the fields, and show the values when the child is open.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

Post Reply