💫 A NEW way to Trebuchet!

:wave: Hey fellow Gliders!

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 :star_struck: (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!

:popcorn: Enjoy

Click here to see the previous version of the Trebuchet method

:dizzy: The Trebuchet Method

Thank you to @Darren_Murphy for the discovery of this functionality!

18 Likes

Box office stuff :popcorn:

5 Likes

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.

2 Likes

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.

2 Likes

Thanks @Darren_Murphy for that response. I was confused about what he meant but this explains it.

So if it is not computed does it mean we can set it as row owner?

No, you can’t make it a Row Owner.
What would be the use case for that?

Like in google we can set array column as row owner

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.

1 Like

What @Darren_Murphy said :point_up: :sweat_smile:

1 Like

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.

Very good! I already wanna see the next video using Json Object

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.

2 Likes

Supreme as always, Robert, thank you very much! :pray:
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? :thinking:

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 .

1 Like