I am creating an invoicing system and as you can imagine there will be a couple calculations which would need to be done, namely;
Cost of items (cost of one unit + number of units), Cost of labour (cost per hour + number of hours).
Total (Cost of Items), Total (Cost of Labour).
VAT added ((Total items + Total Labour) x 15%).
Grand Total (Total items + Total Labour + VAT)
I thought the best way to break it up would be to have an “Invoice” database with a relation to a “Items” & “Labour” databases. In the “Items” & “Labour” data base there is a column for “Cost per unit” (DataType: Money), a column for “Number of Units” (DataType: Int), also a column called “TotalCost” (DataType: Money).
How do I get the “Cost per unit” + “Number of Units” to automaticly calculate in “TotalCost” column?
In my Front end I would like to make it as user friendly as posible, so I have two input areas where the User can add “Items” & “Labour” sepretly and it be shown in two seperate data tables.
How can I add the “Total Cost” of all the rows in the table, and show the Total amount in a text field below the table?
I would then like to add the two Totals of the “Items” & “Labour” together and show in a text field, I would imagine this would be the same logic as Point 2?
I would like to then save the total of Point 3 to the “Invoice” database, which i will then use to calculate VAT and the Grand Total (Total + VAT), would this be the best way to calcualte this or is there a simplre way?
How can you set a currency in the money in the DataType: Money?
For point 5 you can not set up currency for type Money, but you can create columns with the name of the currency, for example, invoiceUSD or invoiceEUR
I am still struggling with point 2, I am using codeless logic and still cannot find a way to add items in a dynamic row to show a total. The user will add units and cost of units in input field, this will automaticly give a total (Units + Cost of units), the user will then click on an “Add” button (where the logic is stored) the Units, Cost of Units and Total will all be added to a table (Dynamic list in frontend).
When the user clicks on the “add” button I would like for the Grand total to be worked out by adding each row total. Is there codeless logic which can do this?
I think yes. You could get Dynamic List, iterate over them, and calculate the sum of any property you want. If you want to get help with that, you could create a page with a minimum of logic, and we will try to help you with that issue(don’t forget to provide container and page name, and app id)
So I have added two input fields which contain logic, they add up and equal to “RowTotal”. The two buttons add and delete items in the dynamic list “RowAddedUnits”. I have not added any other logic. I have added the calculations below which I am struggling with.
“TotalOfColumn” = Sum of all “RowTotal”
“GrandTotal” = “TotalOfColumn” (In my application I will have two “TotalOfColumn” added up to equal “GrandTotal”).
Hello! I’m struggling with the similar problem.
I have a dynamic list of items. I want to calculate the sum of one property of all items in the list. For this I made value logic as at picture below. But whatever I do it always shows zero. Could you please help?
The set block worked, but I got some strange behaviour.
In my UI the result of sum never changes once I add, delete or change objects from my dynamic list.
I made very strange thing to achieve my goal to see the value once I manipulate with dynamic list.
To every component of my dynamic list I added On Change Event which just put something to the page data. And now if I change something inside my list, I right away see how the sum is changing.
But it seems that this is not how it should be done:)
Can you correct me please?
This is what I did for every component in the dynamic list:
Could we clarify, the end result of actions that we did?
We should have a list of inputs, and the sum of all inputs below them?
Everything you do is correct, except one under-hood detail. And I couldn’t explain that in a simple way.
On Change event triggers changing the Dynamic list, but Content Logic is not directly related for this Dynamic List, and recalculating(in my attempt to investigate this problem) not triggered while we do not change App / Page Data. I think that is normal behavior if you understand JS in deep, but for no-code developers that might be a little strange and maybe hard. So we should discuss that with a team if we can simplify or rework that behavior.
For you, I’ve could recommend trigger changing App / Page Data manually, just by adding a logic like below:
(only row with Date Now)
Please, try that and tell me if it helps you. If you still have troubles with that, create please an empty page with example, and provide app id / container name / page name. And I would help you directly in your app with this example.