If you havenāt heard of the Trebuchet method, itās a term coined by @Lucas_Pires that refers to creating inline arrays. Inline arrays can be an efficient way to create relations without requiring a helper table thereby preserving your row count!
Previously, the Trebuchet method required about 6 columns and 2 custom actions (4 updates to add and remove a single item). This new version of the Trebuchet method cuts that usage IN HALF (3 columns, 1 action).
The magic lies in leveraging the Multiple Files column to store an array of items that youād like to relate to another table. You have to see it to believe it!
Enjoy
Click here to see the previous version of the Trebuchet method
Great tutorial Bob @Robert_Petitto . Thanks for this. It will come VERY HANDY for one of my projects.
Just a question though, if you dont mind, I heard you mention that this will use the same number of updates as if you were adding or deleting a row.
Does this consume updates though since you were using Glide tables and therefore updates should ot be consumed unless i misunderstood something.
That would depend whether you are on a legacy or new pricing plan. On the new plans there would be no updates involved. However, the multiple files column is a non-computed column, so editing it will consume updates on the legacy plans.
I see. Yes I guess that would be useful, but unfortunately itās not supported.
It would be even more useful if it could be set as the Role column in the User Profile. But unfortunately it doesnāt support that either.
Thatās great @Robert_Petitto. I just found out that the āMultiple Filesā column can have another function and can be inputted with the āset column valueā action. Thank you for sharing.
Bob and I have been discussing the potential for using this method with JSON data for a while. Initially it wasnāt possible, but Glide recently made a change that now allows you to store JSON Objects inside a multiple files column. The problem is that the data within a single JSON object often changes, so using the Remove Element column to remove from the array can easily fail. I think there are probably still valid use cases for storing JSON in a Multiple Files column, but it might require a different approach for managing the array.
Supreme as always, Robert, thank you very much!
Only question i have which way is faster - this one JSON Trebuchet or using Data Structures? Abd if JT is faster, what would be use cases for DS now, when we become to know about JT?
I havenāt given the two had to head test so Iām unsure which one is faster. The problem Iāve always had with data structures is that you canāt add new data to a structure that doesnāt exist so at some point in the array creation process, you have to fill it with a empty structure .