Well now @bubble.trouble, you’re just getting greedy. But seriously, @nick.carroll, what @bubble.trouble is describing is probably the second biggest weakness in Bubble: That there is no support for objects outside of Things (and Things can only be created through interaction with the database and plugins themselves can neither create nor modify them – that’s the exclusive province of the Create and Modify actions which can only be executed by the Bubble programmer).
A more specific version of that request would be as follows:
It would be desirable to have a generic “Object” data type which might be specified in much the same way as return values from SSAs.
Such objects would not be Things, but would be simple JavaScript objects (probably published as JSON stringified text) that exist only in the page. But Bubble would understand them and one could access their values in the expression builder.
For example, we might be able to construct an object (like a car in this example) that is a JavaScript object composed of the basic Bubble datatypes and app types (represented by their unique IDs) and, if published to a state of type Object, Bubble would understand this. JS object:
car = {
Make_text: "Aston Martin",
Model_text: "Bondmaster 5000",
TrimPackage_text: "Gaudy",
Price_number: 5000,
OwnedbyUser_User: "1670267192276x990887650961694600",
AcquisitionDate_date: "Wed Dec 07 2022 14:46:19 GMT-0800 (Pacific Standard Time)",
SomeOtherThing_custom_fave_thing: "1670267192276x990887650961694655"
}
And then we might publish it to an exposed state (or Action return value) called Car of type Object (e.g., instance.publishState('Car', JSON.stringify(car)
). And, at the exposed state MyPlugin’s Car Bubble would understand that there are fields for “Make” (a string), “Model”, “TrimPackage”, “Price” (a number), “OwnedbyUser” (a User), “AcquisitionDate” (a date), “SomeOtherThing” (a Thing of type fave_thing).
Being able to dynamically publish object type values like this would also be a game changer as @bubble.trouble notes.
EDIT: And this example isn’t so totally great, but imagine that I want to publish a List of Cars and it makes more sense. Or some object that represents a line item in an order (with product, quantity, price, and subtotal fields) which is a less abstract use case.
EDIT 2: Clearly I don’t have my interface design hat on, but you get the idea (in the quickie description I wrote up, I encoded the data type into the name of the field, but obvs the field values could themselves be objects in which we specify the bubble type for the value (or however), e.g.,:
Make: { type: "text", value: "Aston Martin" }
The point was that the limitations at present are at least two-fold: (1) there is no support for objects besides Things and (2) ideally support for objects would be entirely dynamic (the Bubble programmer need not tell us everything or even anything about the output - the plugin is responsible for that).