Here’s an interesting situation. I’m not sure what to search for or where to start…
In my Account stable I have created a MAX field related to a connection. I’d like to be able to report other values of the record that evaluates as the MAX.
For example, MAX is the record with the latest Date. I’d like to get the Hours value of that record.
You should then be able to use a Sum field on the Accounts table to fetch this value.
Scenario 2 - You want to output hours for the latest week, which may not always be the current week:
Use some code that turns your Accounts grid from this:
Into this:
Ensure your Hours table is sorted by Week from latest to earliest
In your Accounts grid, add a connection field of the Hours field, with comma-separated values
Insert the below code in your JS editor, replacing view_1 with your Accounts table key, and field_1 with your connected Hours field.
This code will display the first value of the comma-separated Hours values in this field.
Note that if you export the grid, all of the comma-separated values will display, so this will only work as a read-only solution
Scenario 3 - The above will not work and you need it to record the latest week’s Hours in the Accounts table:
You will need to use an automation (e.g. Flows, Make, Zapier, Knack JS) to run every time an Hours record is created/updated to:
Determine if it’s the latest week with comparison to the Account’s max week value
If so, update the Account’s Hours field to the Hours record’s value
Let me know which solution you go for, if at all!
Also, if I’ve overthought this and someone else has an easier solution, let me know!
Thanks Stephen.
Some interesting ideas.
I think I explained it poorly.
The MAX field is in the Account table. It finds the connected record with the latest (greatest numerical “week of” field) date.
I’d like to get the Hours from that particular connected record.