hi,
I have a form with a subform showing payments (amount and type: checks, cash, credit card).
I calculate the total in a "calc" object and totals per payment type in "display" objects.
I want these totals in the parent browse form, but "display" values aren’t stored in the database and can’t be shown there.
How can I display the overall total and totals per payment type in the browse form?
Is there an object like "display" that saves calculations to the database for use in the browse form query, or
........another solution?
thx,
Yves
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
subforms and display object Topic is solved
Re: subforms and display object
Yves,
Can you share your database with us?
Steven
Can you share your database with us?
Steven
If you like nuBuilder, how about leaving a nice review on SourceForge?
Re: subforms and display object
Maybe you can use PHP code in the “After Save” event to write the value directly to the database:
nuGetValue('object_id') retrieves the current value of an object from the form.
$GLOBALS['nu_record']['id'] contains the ID of the currently saved record (make sure your table has an id field).
(not tested)
Code: Select all
// In the “After Save” tab of the form
$displayValue = nuGetValue('object_id'); // Get the value of the display object
$recordId = $GLOBALS['nu_record']['id']; // Primary key of the current data record
if ($displayValue !== null) {
nuRunQuery("UPDATE table SET display = ? WHERE id = ?”, [$displayValue, $recordId]);
}
$GLOBALS['nu_record']['id'] contains the ID of the currently saved record (make sure your table has an id field).
(not tested)
-
- nuBuilder Team
- Posts: 4242
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 68 times
- Been thanked: 422 times
- Contact:
Re: subforms and display object
Values of Display objects are stored in the database if you add the "nuEdited" class.
E.g.
Code: Select all
$('#display_object_id').addClass('nuEdited');
-
- Posts: 305
- Joined: Sun Mar 14, 2021 8:48 am
- Location: Geneva
- Has thanked: 83 times
- Been thanked: 11 times
Re: subforms and display object
I have put this code on the nuload event , custom tab of the related display object. It works !!! How can I update all the records without having to open records one by one and save it on previous records prior to this change ?
Yves
Yves
-
- nuBuilder Team
- Posts: 4242
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 68 times
- Been thanked: 422 times
- Contact: