is it possible to automatically calculate with the values that someone has just entered into the form and then save them in the database when you click on create/save button?
For example you already have in database some value x=100 and then you enter the value into the form y=10. Is it possible to automate x*y=z and save it to the database?
Yes, it is possible. If you want the new value to be displayed instantly, you can add a custom formula to the text field.
And you can save the calculated value to the database by adding Action to the button.
You can use built-in “Sum”, “Average” etc. only for Number variables, not the text ones.
What are you trying to achieve? May be there is another way to do that
I’m trying to make a company statement of work in our construction company. I want the workers to be able to record the work themselves.
So I have individual items they work on, each item has its value for which they do the work.
So I determine the value they work for (x). And they fill in the form once a month in the form, how much of this item they worked (y). So I need to multiply x * y=z to write in the database that (z) and then add up for all items how much they worked (SUM of all Z).
As you can see, today I can read from the table the individual items on which they work on a given construction site. And I need them to be able to write once a month for each item, how much they made and how much money they make for all the items together.
Ok, now I see.
Why have you decided to store Z as Text?
As for me, the database might look like the following:
DB-Workers [Name; CostPerHour; link to DB-Works - one worker can do many DB-Works]
DB-Projects [ProjectName; link to DB-Works - one project can have many DB-Works]
DB-WorkTypes [WorkType name - to be able to select from list]
DB-Works [WorkName; DB-Project; DBWorkType; DB-Worker who does it, Number of hours, Total cost for this work].
So when the worker adds some work, the extra record in DB-Works collection will be created. When creating this record, you set:
WorkName - text, coud be anything
DB-Project - project should be selected
DB-WorkType - which type of work, selected by worker
DB-Worker - set automatically (if the worker adds the work) or manually (if manager does it)
Number of Hours - set manually
Total Cost - calculated based on DBWorker->CostPerHour * Number of Hours.
Then you can have the sum of all TotalCosts for the worker, if you create a list of DB-Works filtered by DB-Worker.
sorry that I response after long time. I didn’t have time to build an application. I still can’t understand how to enter an order to calculate Total cost when it can’t be used as custom formula for a number in DB.