I am wanting to create a bidding application which is similar to the northwind orders demo but instead of orders of products it will be a pre-order bid or estimate of products and labor. I know how to create one record at a time in the data collection form, but is there a way to add multiple records from one form?
An example is I add a size of electrical conduit to to the bid, but before i submit the form i would also like to specify how many conductors of a certain size are in the conduit. Once saved i would have two line items in my estimates table. The first line for the conduit with price and labor columns attached. The second line with the conductors with price per ft and labor attached.
Is there a way to do that in appgini?
Create Multiple Records in a Table from one form
Re: Create Multiple Records in a Table from one form
Hi,
yes, you can do that in the after_insert hook. Create your sql statement to insert the record in the table an call the sql/sqlvalue function to execute it.
yes, you can do that in the after_insert hook. Create your sql statement to insert the record in the table an call the sql/sqlvalue function to execute it.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Create Multiple Records in a Table from one form
pböttcher,
Thanks for the reply. I am not sure how that is done, but maybe by watching Ahmed's Udemy course along with your reply, I will be able to figure it out.... hopefully...
Thanks for the reply. I am not sure how that is done, but maybe by watching Ahmed's Udemy course along with your reply, I will be able to figure it out.... hopefully...
Re: Create Multiple Records in a Table from one form
Interested to know the method.
Re: Create Multiple Records in a Table from one form
Hi,
as pbötcher wrote:
use the /hooks/tablename.php -> after_update function to
a) read the entry from the database that has just been created. For this you use the $Selected_ID variable that AG provides in that function. Something like this (pseudo code):
b) write the entry again (maybe including some changes)
Olaf
as pbötcher wrote:
use the /hooks/tablename.php -> after_update function to
a) read the entry from the database that has just been created. For this you use the $Selected_ID variable that AG provides in that function. Something like this (pseudo code):
Code: Select all
$record = sql("select * from yourtable where pkfield = " . $selected_id;
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view