I’m creating a carbon emissions calculator and I’m wondering if there is a possibility for the user of the app to:
Add a project
Which leads to calculator page and saves calculations in that project
Then, a page called My Projects will hold all the projects added to the app
After clicking on each project, it’ll open a project details page with a table of calculations that have been made
I’ve already created the calculator, but I’m not sure how to add that project layer to the app, so that each new project starts and saves brand new calculations.
Is it the case of somehow relate each project to the calculations row? If so, how to do that?
I’d start by creating a Projects table, and add the columns you need to store the raw data for each project. eg. the values that are used in the calculations.
Then it’s just a matter of creating a form that will gather the data, and add a row to your projects table.
How are you currently doing your calculations?
Are they done in the Glide Data Editor, or in some external source such as a Google Sheet?
Depending on the nature and complexity of the calculations, I’d be inclined to add all the calculation logic to the Projects table. This would allow for dynamic calculations with results shown immediately as each project is viewed.
What are you currently doing with the calculations - are they being saved in their own table?
Or do you just clear out the form each time and throw away the data?
If you’re already saving each calculation, then the simple solution could be to associate each one with a Project via a ProjectID column.
I see! This is what I might be looking for. How do I create that ProjectID column? I tried to find a Unique Identifier option, but no avail… Could you help?
Add a RowID column to your Projects table (this will be the ProjectID)
Add a column to your Calculator Table, and name it ProjectID
To associate a calculation with a Project when you save it, add a Choice component to your Form screen:
– Use the Projects table as the source
– The target column will be your ProjectID column
– Use Projects->RowID for the value
– Use the Project Name for “display as”
Then later on, to associate calculations with Projects:
Add a multiple relation column to your Projects table, that matches the RowID with Calculations->ProjectID
Use that relation as the source of a collection on your Project details screen
So no user should ever see any other users calculations?
If that’s the way it should be, then a better approach would be to use Row Owners.
User Specific columns aren’t really intended to be used in the way that you’re doing it there. Normally you only use them when users need to write different values to the same column in the same row. But if I understand what you have there, each user is adding a new row when they save the calculation.
It appears as though you’re using a custom form, so you definitely need to be collecting the form inputs into user specific columns. But when you save the calculation, you should take those values and write them to non-user specific columns.
I see… This is very helpful to know, thank you. Yes, the idea for now is that each user has their own calculations, but you made a good point…
I’ll explore Row Owners and all the information you provided above. I’d need to digest tit and play around with it and I’ll get back to you shortly. Thank you for your help!
Your solution with RowID and ProjectID worked perfectly! Thank you.
I have a quick question regarding the Project form > when clicked Add. I’d ideally like to make a calculation over there, on that form pop-up, do you think it’s possible?
The issue that I’m facing is that I can’t replicate the same steps when re-creating that calculator on the pop-up form. E.g. the Relations options are not showing up as they are in my original calculator.
Do you happen to know why this might be? Thank you
The native Add form and Edit form are technically not connected to any row. It’s kind of a temporary state where your new or existing data is held. Because of that, computed columns such as relations, are not accessible because data has not been written to a row yet.
The difference with your custom form, is that each time you change your choice, the value is immediately written to the table, so the relation can be built off of that value and you can access that relation.