Pull value within row from specific column based on column name

Hey guys,

absolutely fantastic framework that Glide has put together as well as a fantastic community. Appreciate it a lot, and am a happy customer.

I’m opening this topic to reach out to you for help on a specific matter.

In short, I would like to

  • show the value of a field within a row
  • based on a condition which is defined as
  • “if the header of a column contains “xyz”, show this column’s value for each entry (row)”

To give you a bit of context:
In a user’s profile, a unique value is attributed to him (“xyz”). Based on this value, I want to pull data from the database, whereby I have as many columns in the database as I have unique attribute variations in the user profile.

I created a simplification of my problem below:
If user profile attribute is “1”, then show for row 2 the value in cell A2, for row 3 the value in cell A3, … for attribute “2” show for row 2 the value in cell B2, etc.


Is there a way for me to configure the output of a field within glide so that it shows me the value of the specific row depending if the column’s header equals the user profile attribute?

Thank you guys in advance.

I can’t think of a way to do this with Glide computed columns, so you’ll probably need to resort to spreadsheet formulas.

But… from what I can glean from your problem description, I’d recommed reconsidering the way you have structured your tables. Instead of sticking all that in your User Profiles table, it might be better to split it out into an “Attributes” table. It’s hard to say - but any time I see a series of numbered columns it sets off a little red flag :wink:

Also, the fact that you’re trying to parse column headers is generally a good sign that something isn’t right with the data structure.

1 Like

What @Darren_Murphy said :point_up:

Better to have a sheet with two columns:
Column A = Attribute number
Column B = Value

You’ll basically stack your 4 sets of 4 values on top of each other in Column B and then designate an Attribute to each value in Column A (so each attribute will repeat 4x).

Now you can create a multiple relation from the user value to column A and pull all 4 values.

1 Like

Thank you both for answering this. I re-considered my datastructure after Darren hinted I do so. After working on it the whole day I found a different way to display the data (actually I now show data in an in-line view with visibility filter set to only show data if a certain profile attribute is met).

Thank you both for your support, I’m happy with the solution!