Hi,
I’m looking for a tutorial or some guidance on how to do the following work in a server action. I imagine that with the power of Wappler, this s/b easy to accomplish, but I don’t know how.
Starting Point:
Let’s say I have two tables: ITEM and SUMMARY.
To drastically simplify the question, let’s say the tables have the following structure:
ITEM
- idCLIENT
- Amount
SUMMARY
- idCLIENT
- Total
There is a one to many relationship between SUMMARY and ITEM. Also, let’s assume for now that I only need to sum amounts from one table into the other.
More specifically, at the end of my server action, SUMMARY should have one and only one record for each idCLIENT and its field Total should contain the sum of all the Amount fields in the ITEM table that belong to that Client. All the work needs to happen on the server side – nothing on the client side.
For example:
Before the server action, let’s say ITEMS contains 4 records:
- Client A 1,000
- Client B 1,200
- Client A -250
4 Client B -800
At the end of the server action, SUMMARY should have 2 records as follows:
- Client A 750
- Client B 400
Any pointer in the right direction will be appreciated.
Many thanks!
Alex
Last updated: