How to match a drop down list with a single value from another column

Sir,
I have 2 tables: ‘DA11’ table with a list of 6 entries under [cat1] and 6 corresponding reference values in col 2 named [da1].
Other table"Pension"has 5 columns. In col named [category ] user has to select one of the items under [cat1]. I did this by valid if = DA11[cat1]. In the 2nd col of table “Pension” the user is automatically shown the value pertaining to his selection in [category]. by using valid if = DA11[da1]. this selects one of the 6 values matching with selected[category].
However, when I use SELECT(da11[da1],([_THISROW].[category] = [category]),TRUE), the user gets all the six values as given under da1 instead of single value . all the six values are shown even when I use SELECT(da11[da], [category]=[_THISROW].[category]) AND OTHER Select uses that I learnt.
I want to know whether use of select does not produce a single value that matches [category]?What other expressions are required to be used in such a scenario.
I am a learner and sorry for putting my query in a complicated manner.
thanks
vk

Solved Solved
0 3 142
  • UX
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

Instead of this:

SELECT(da11[da1],([_THISROW].[category] = [category]),TRUE)

Try this:

SELECT(da11[da1],([_THISROW].[category] = [cat1]),TRUE)

View solution in original post

3 REPLIES 3

Steve
Platinum 4
Platinum 4

Instead of this:

SELECT(da11[da1],([_THISROW].[category] = [category]),TRUE)

Try this:

SELECT(da11[da1],([_THISROW].[category] = [cat1]),TRUE)

Thanks a lot. It worked.
However, prior to your solution I tried SELECT(da11[da1], ([category]=[cat1]),True) and it also worked.
Whether it is required/more proficient to prefix the column [category] with [_THISROW] and what is the difference between the two and what damage if [_THISROW] is not used .
thanks again .

[_THISROW] is explained here:

The reason ([_THISROW].[category] = [category]) does’t work is because [category] isn’t a column in the da11 table. if AppSheet can’t find the column in the table, it looks for it in the row of the table performing the expression. As a result, this:

([_THISROW].[category] = [category])

was evaluated as though written like this:

([_THISROW].[category] = [_THISROW].[category])

which is always true.

It is because AppSheet tries to find the column when it isn’t sure that your attempt to use this worked:

SELECT(da11[da1], ([category]=[cat1]),True)

Because da11 doesn’t have [category], AppSheet evaluated the expression as if it were instead written like this:

SELECT(da11[da1], ([_THISROW].[category]=[cat1]),True)

So the use of [_THISROW] is optional when there’s no possibility of confusion over which column you mean.

Top Labels in this Space