Thanks for the pics @Anonymous, it does help, but I have more questions 😁
I'm not sure I get the button pressing and count experience - I may need some more explanation here....
- Do the < and > icons move between devices, or does it increase/decrease the count for that item you pressed, which you then want to patch? If so, wouldn't it be easier to just let them edit the numbers next to each "button"?
- Are you wanting to patch each individual item count, or update them all and do one patch?
- Are you using a form here? If so, shouldn't you be using the SubmitForm() function to update data instead of Patch()?
Lastly, and possibly more importantly, is there a reason your list has to be constructed in this manner?
Your column names are effectively an element of your data, which is why you're trying to variabilise them into expressions. Column names are simple references that usually describe what data the column contains - they should never be considered data themselves.
Add to that the fact that new devices will always be coming along - with this model that means adding more columns, and having 300 columns on a list is not a good idea.
Rethinking this may save you many, many headaches down the line.
I understand these things aren't always easy or practical to change, but consider the following table construct as an alternative:
| Device | _Current Inventory | Date |
| Dell Latitude | 37 | 05/03/2022 07:13PM |
| Surface 3 (i5) | 24 | 05/03/2022 07:13PM |
| Surface 3 (i7) | 12 | 05/03/2022 07:13PM |
Firstly, yes, you will have more records per timestamp - we've effectively unpivoted your original model, but with good reason. But now you have three columns. Performance-wise, that's a win in many respects.
It will also allow you to work with the data a lot easier, instead of having to hard code column references in your formulas (because you can't variabilise them).
If you want to run analytics on this data at some point this type of construct would be also be useful.
What you will lose is the ability to reference all the data for a specific timestamp in a single row - meaning you can't use the Form() control to update multiple records here - but considering you were trying to use Patch() instead of SubmitForm() in the first place I'm guessing this wouldn't be that big an issue for you...?
But the benefits are multiple - You can Filter() by device and timestamp, do lookups on certain devices for certain timestamps and patch data back in bulk or for specific device for a specific timestamp.
Your Date data will also be of a Date type, saving you having to convert it everywhere outside the list (like in Power Automate, Power Apps or Power BI) - and this means easier-to-use date functions.
Anyway, the model doesn't have to look exactly like this, and I understand it's not always possible to change, but I would seriously consider redesigning it to get your device names into your actual data instead of having them as columns...
Kind regards,
RT