Forum Academy Marketplace Showcase Pricing Features

Do a Search for a Thing's List of Fields (Introspection)

I would like to see a do a search for a thing’s fields, i.e. introspect and return all the fields of data type.

This would be very useful for:

  • Creating drop downs where you want the user to select the field of the thing dynamically.
  • Viewing a thing’s list of fields and values via a repeating group.

In fact in practice, at the moment I would like to do a dynamic filtering using operands and and or to search for multiple criteria dynamically. Currently my options are to hard-code (or hard-no-code) each field, which requires updating the system each time new fields are added and it does not allow selecting the same field in multiple sub-clauses of the search query. The better way would be to have a selection of the field via a drop down populated dynamically with the data of the thing and a value.

Something like:

First, I agree with your comment. That would be a great convenience.

Second, personally I couldn’t live with the “in practice” options so a while back I came up with a solution. I’m not saying you should want or need to implement this. I’m just providing it as an option and example of what can be done in Bubble even now.

Full disclaimer: I wrote this as a proof of concept. It could be made into a plugin for easier implementation (and probably someone already has, I honestly didn’t care to look)

Use a server script to pass in a Data Type (properties.thinglist1 is “Do a search for Persons:first_item:converted to list”):

Store the list of field names in a custom state (of type text - is a list):

Use the state as a data source (in my example I used it in an RG as I was building sortable headers):

Output result:

2 Likes

I have something for you both @umiumansa, @bubble.trouble… I made a plugin version of this:

Reminder: I work for tips - GRUPZ: Karma-Ware Plugins for Bubble

2 Likes

@bubble.trouble this element plugin version is a lot more efficient (faster) than sending that request to the server, though your idea and code are quite clever! :slight_smile:

@umiumansa this can give you dynamic field labels. Check out the Output Options. Let me know if there’s some variation you can’t get here that you might want.

Demo page here (very simple, but as with all my plugins there’s documentation for every field) that includes a link to the editor: https://list-shifter-dev-test.bubbleapps.io/version-test/fielder?debug_mode=true

Note that there are no actions in this plugin, but it does trigger an “Initialized/Updated” event when its fields change and it has published the new field values (though there’s really no need for that to ever be used).

Plugin is forkable if you wanna see how I build plugins or tweak the code to your specific needs.

4 Likes

You’re a world saver @keith Thank you.

1 Like

@Keith From one NG to an OG nice to see you active again. You made quick work of that :).

Thanks for always making your code available so the rest of us can stand on the shoulders of giants.

2 Likes