A simple calculation Example

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
mwilliam
Veteran Member
Posts: 32
Joined: 2018-03-31 09:03
Location: London, Kentucky

A simple calculation Example

Post by mwilliam » 2018-03-31 14:17

Could one of you wonderful people post a AppGini project that will do a calculation from fields:

ID
day1
day2
day3
total

I want to see how its done. and where to put the code.

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: A simple calculation Example

Post by R Tammam » 2018-04-10 22:33

Hello mwilliam , will you put dates like 11/4/2018 or numbers like 5 days

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: A simple calculation Example

Post by pbottcher » 2018-04-11 06:08

Hi mwilliam,

where would you like to see the total calculated? You have an option in AppGini "Show column sum" in the field definition.
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.

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: A simple calculation Example

Post by R Tammam » 2018-04-11 18:02

mwilliam , here's another idea , you can make the new project normally and just open the project folder
go to hooks file , then table name and put the following line in before inset and before update function , and it will sum them automatically

Code: Select all

$data['total'] = $data['day1'] + $data['day2'] + $data['day3'];

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: A simple calculation Example

Post by Moh Youba » 2018-04-12 22:42

Hello guys, I have same question, please any one with help
I have 3 table
1 - clients
2 - credit (loan)
3- versement (payment)

it the table client, I want to display
- total of credit
- total of loan
- balance
sum_of_field.jpg
sum_of_field.jpg (89.13 KiB) Viewed 4469 times
Please any solution.
Thank you

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: A simple calculation Example

Post by R Tammam » 2018-04-17 23:08

Hello Moh Youba,
i will explain the idea for you,
you will need to use after insert function in hook
after inserting in credit table ot after inserting in vestments table
you should first select sum of credits where customerid = logged customer and then use this value to update the credits field in cousomter table
and so on you can go through this logic for tota versement and for balance

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: A simple calculation Example

Post by Moh Youba » 2018-04-18 06:42

Hello R Tammam

Thank you for your reply. I will try to follow your suggestions.

AEmpeno
Veteran Member
Posts: 72
Joined: 2018-01-04 18:48

Re: A simple calculation Example

Post by AEmpeno » 2018-08-30 21:30

Were you able to make it work?

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: A simple calculation Example

Post by Moh Youba » 2018-08-31 13:17

Yep...

Post Reply