Dynamically choose the Field to display for a Thing

Hi folks,

Is it possible, in a text field, when displaying data dynamically, to set the Thing’s field that I want to display dynamically? It’s easy to set the Thing itself dynamically from the Parent object, but can I set dynamically the field to display? For example, if I have a Product data type with Color, Size, and Price fields, can I use dynamic information to choose which of those three fields to display, taking information from the parent group? I hope that’s clear!

For more details on my use case, I am trying to build a page that displays a long set of product specifications, that are broken down in different categories (70+ fields total, so I don’t want to set a fixed layout that I have to change every time I add or remove a field).

How I’m doing it now:

  • I have a data type “Specification Category” that has the 6 main categories of product specification (for example Electrical, Material, Waterproofing, etc). .
  • I have a data type “Specification Item” that has the different items and the related category.
  • I have a data type “Product” whose fields are all of “Specification Item”.
  • On my product display page, I have a Repeating Group to display all Specification Items, nested inside a Repeating Group to display all Specifications Categories. I’m able to display all Items inside their Category neatly, but I’m struggling to then access the value of the fields for the Product I’m displaying.

Another option would be to break up the product information per category and have a “master” product data type pointing to all 6 sub-objects, but I’m trying to see if there’s a way to do it without that as I would like to keep my product database as flat as possible.

I’ve been searching on the forum for a while but can’t seem to find a good answer for that problem. Thanks for the help!

I think the only way to do exactly what you are talking about would be to add conditionals on the text but I think that would become a lot of conditionals. Or you could just build 6 different repeating groups or whatever it may be and then dynamically choose which one is visible based on the parent group product’s category.

1 Like

Thanks for your answer! Indeed, I was thinking of conditionals but it’s going to get hard to manage fast, and I’m also afraid of the performance components of that. Looks like I’ll have to go the fully manual route.

This sounds to me more like a database issue.

While conditionals would work, if the database fields were saved as text in one giant field as a text array, then you could search them dynamically much easier. But it does depend on the nature of each one field type so that may or may not be possible.

1 Like

That’s interesting. Most fields are text or number, I could handle the other fields manually fairly easily. I could have a workflow to automatically populate this concatenated field every time the Thing is created or updated. It still requires some manual upkeep, but it’s a lot easier. I will try that. Thanks for the idea!