I want to build an app with Glide where I can do the following. I add rows where I have a column with the day and a column with an amount of hours. After that the users can add up the hours between two dates bij selecting a start and an end time. How do I do this?
This is the answer of ChatGPT but I want to do it in Glide Tables only How to do it? Or do you have example apps?
Let’s assume you write the user selected Start Date and End Date to two user specific columns.
Start by adding two single value columns to your table that contains the data: one for the start date and one for the end date. This will apply those dates to every row in the table.
Now add an if-then-else column:
– If date is before single value start date, then null (leave empty)
– If date is after single value end date, then null
– Else amount of hours
Now do a rollup->sum on the if-then-else column to get the total number of hours between the two dates.
Sorry to ask stupid questions, but where do i get the data for the two single-value columns (start date and end date)? I never really understand this concept. Well I sometimes do, but not here.
Whichever table/row you write those start and end dates to would be the table/row where to point the single value columns. I assume you would have date pickers somewhere in your app, and those date pickers write to a certain table/row. That’s where you want the single value columns to retrieve those values. Then the single value columns will populate the same value on every row.
Yes, exactly. Assuming you have a date picker that populates a start date in the first row of a table, then you can use the single value column to take that value from the first row and populate it across all rows.
The idea is this, I have different people / companies adding hours / money they put in a big project.
I want to be able to calculate the amount of hours / money in a period per company.
I want to be able to choose that period by picking start and end date. And then do the calculation.
So I have a growing table with rows with work / money done by people for different companies.
Then it doesn’t feel like I can use the first row, am I right?
You can use any table you want. You could have a single row table that serves as the driver for your screen or tab. In the table you could have 2 user specific columns to hold the start and end dates, as well as a rollup column to sum hours from an IF column in the project table. In the project table, you would have 2 single value columns and an IF column as @Darren_Murphy described above.
You can also use the same table if you choose. There are lots of ways to get the same result.