Why are some computed columns not available in the text component?

Hi everyone!

I’ve been working on a multi-page app and learning a lot - thank you to everyone who’s helped so far!

Right now I’m building a feature where a quote is displayed based on user’s selected mood (there are 5 moods in total) I’m using a rating component to represent mood, then using:

  • a relation column to match mood to a set of quotes
  • a single value column to pick one quote from that related list
  • a lookup column to pull the quote text

The logic seems to be working - in the Data view I can see that the relation, single value, and lookup columns all show the correct values.

But the problem is:
In the Layout / Component panel, when I try to display the quote using a Text or Rich Text component, none of those columns (relation/ single value/ lookup) show up as options to select. They are just missing.

Is this a context issue? Do I need to filter the screen differently, or restructure my setup? I’m currently using the Users table as the screen’s data source

Here’s a screenshot of the column names,
glide screenshot 5

Thanks in advance - I really appreciate your help :folded_hands:

Relations are links to a single or multiple related rows. They do not represent a single column in those related rows.

First question would be if your relation is a single relation or multiple relation.

Next question, why do you have both a Single Value column and a Lookup column? You should only need one or the other to pull a value from a relation. Usually a Lookup is the common choice.

If you have a multiple relation, then a lookup column would return an array, which could have multiple values. Arrays can’t be used in places that only accept a single value.

However, a Single Value column would always return a single value, except when you are using it to retrieve an existing array, or you are using it to return an entire row.

I think it would be a lot more useful to see how you configured each of those three columns. That will provide a whole lot more context.

1 Like

Here is what I did, I first use a relation column to relate the mood rate to a column with mood numbers, and there are multiple quotes with one mood number, and I want that, so the single value can pick one of the few quotes randomly from it each time:

And then I plug the single value column to the relation, but weirdly it returns all the quote instead of only display one random quote, here’s my configuration:

then because both the relation and the single value doesn’t show up as an option for the text I want to display, I used a lookup to try to display a quote, but sadly the lookup also didn’t show up:

This is what is happening, is there a way to fix this?

Ok, I see your logic now, although it’s a little bit of a roundabout way to get there. Based on a quick test it should work, unless your screen is not looking at the correct table. Or for some reason your lookup is returning an array, but your screenshots don’t show that, so I can’t say for sure.

Regardless, I think I would take a different approach and use a Query column with the appropriate filter, sorting, and set to return a single row. Then point a Lookup column at that query.

2 Likes

I used a Query, but it only lets me sort by A to Z, or Z to A instead of letting it sort by random, what should I select multiple for this one, and make another column?

Continue with the last post

So here is what I did, but I wanted it to be random

I think I’m so close to doing it but I don’t know how I can do it

what I did was I made another column to each mood rate, in the quote table:

And I made a query, but then it doesn’t pick from random, what should I do?

In this part, the From should say Related Quotes > Mood Quote, I believe.

It is solved! thank you everyone for your help! I solved it with a math column

Can you share the solution? I just want to make sure it doesn’t lead to any problems down the line and you’re using the right column.

Sure, Let me just solve a current problem I’m having,

The math column’s got it’s problem too, when I post it I’ll post the problem along with it, to see if the problem can be fixed

But now I have a bigger problem, I’ll come back to this hopefully tomorrow

thanks for the help !!

they are all really helpful, couldn’t do it without you guys

Yeah, because I’m not sure how a math column would have helped you in this scenario, so just asking for clarification.

Ok! I’m back! I’ve been quietly working on the project and just circled back to this

So here I’m going to explain what I did, see if anyone can completely solve this, I already solved it around 90%

So what I did is first I produce random numbers in a range with a math column

And then I made a few columns with different quotes in rows that’s according to mood rate, and then I use else if to assign each random number to a column

This almost works except that the random numbers don’t change unless we refresh the website, so how can we refresh the page more frequently? it won’t refresh just by clicking away to other pages, is there a way to set page a refresh everytime we click away?

If this cannot be solved I guess people will just keep on looking at the same quote

but I desire for them to see different quotes, hopefully there’s a way to refresh the page

You can do this with a Roll Dice column.

You can set the Roll Seed to a template column joining the current row’s rowID and the current time, so it will automatically change every 10 seconds or so.

Then, in your Quotes table, have a column that is a number (e.g: 1 for Quote 1, 2 for Quote 2).

Relate the Roll Dice value to that column, and use a lookup to retrieve the quote.

That’s the general idea, you can probably find a way to integrate the Mood Rate somewhere in there.