Insert item at beginning of list?

How can I add an item to the beginning of a list?

I think you can sort a list based on creation date. This is how the last created item can be shown as first item of the list.

My list is not a Thing.

It is a list from an external API.

If you have a single (scalar) item you can in some places (list type fields for sure, but perhaps other places/anywhere) do single-item :converted to a list :merged with some-other-list.

This will keep the lists in that order putting the single item at the first position in the list.

This may or may not work with API response objects. Seems like it should.

The other way (non-one-liner in expression builder) is to, in some step, set a Custom State (or other state like object) of List type to be single-thing :converted to a listand then, in some later step, merge that list with your other list.


Thank you @keith !

“merge with” did the trick!

1 Like

BTW, if you (for example) needed to push a non-unique value onto the first position in a list, this wouldn’t work in vanilla Bubble. But you can use things like my “karma-ware” (open source but shareware) plugin List Shifter (the “Custom List” state and associated SET Custom List action) or my (commercial) plugin Floppy (Floppy’s RAM List and associated actions) to accomplish that. Both offer more sophisticated (and more array-like - rather than Set-like -behavior) data manipulation capabilities.

This topic was automatically closed after 70 days. New replies are no longer allowed.