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
Auto Fill not storing data if hidden in DV
Re: Auto Fill not storing data if hidden in DV
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.
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
Re: Auto Fill not storing data if hidden in DV
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
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
Re: Auto Fill not storing data if hidden in DV
I would gladly purchase a library of Hooks code that could be modified for different purposes.
Re: Auto Fill not storing data if hidden in DV
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.
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
Re: Auto Fill not storing data if hidden in DV
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
'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
Re: Auto Fill not storing data if hidden in DV
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:
With the value in hand we update the other table:
Both lines goes in after insert hook and after update hook in audit table.
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);
Code: Select all
sql("update à udit` set `project_id` = $proid where `id` = {$data['id']}",$eo);
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: Auto Fill not storing data if hidden in DV
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.
Since Appgini will always use id of the parent for all the fields, and show the values when the child is open.
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);
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper