In this tutorial you will learn how to use aggregation formulas and how to use one app's data in another one.
You will create two apps: one for adding new invoices and one for reporting them.
Create a new app. It will be the app for adding new invoices. Add a spreadsheet widget to it.
Fill one of it's columns with data that you would want to get about every invoice: department, product, value, date and subject.
Set all B column cells as editable. Cells type set as:
-dropdown for B1
-text for B2 and B5
-date for B4
-currency for B3
Next add another spreadsheet section. In one of it's columns put department names that will be then visible in dropdown.
Go back to cell B1 in first spreadsheet and in 'Elements' field put department names from the second spreadsheet:
Hide the section with department names. You will do it by putting: =false in 'visibility' field.
2.Adding new invoices
If we want the app to save created invoices we will have to create a workflow for it. Add 'workflow actions' widget. Then go to workflow tab.
Add one state - 'saved' and one action - 'save'.
To be able to use this app's information in report app you need to add aliases to cells B1-B5 - simple names that will tell what kind of information is in the cell. An example of an alias:
Finally, add yourself as the app creator.
Now you will create a raport app.
Add a table widget to it.
Next, go to 'Data' tab, find your first app there and bind it with the table.
Name the table columns the same as the fields in the invoice scheme.
Then add invoice aliases from the first app to the columns. You can do it by dragging them to the table or by putting the names manually.
This table will gather all of the added invoices information. To give it the right order click on 'Date' column and choose sort descending.
We will use an aggregation formula to be able to know how much does every department spend. You will need a new table section with two columns.
Column A name 'department' and column B 'invoices summed value'.
As you previously did you need to bind the new table with the first app. Now use aliases which you created in the invoice-creating app: in column A put: =department and in column B: =sum(value). The second one is an aggregation formula that sums by groups, in our case - by departments.
Change B column type to 'currency'.
Check if your app works by clicking 'preview'.
Add yourself as a creator.
Now run the first app a couple of times, creating different invoices in different departments. In one run you will add only one invoice. Your app should look similarly to this:
After you've created a couple invoices run the report app. It should now show data about all of the added invoices and about value of summed invoices from different departments.
An example of a raport: