Using Linktofilteredview() by checking value/values in list based on user input

Hi there!

Iยดm using Linktofilteredview().

I have a table (Table A) I want to filter based on a specific column [Meso] through user input (Form A).
Column [Meso] is an EnumList with the following possible values (M1,M2,M3,M4), with โ€œcommaโ€ as the separator.
User can select one or all those values using Form A.

The idea is to filter all rows in Table A where the value or values inputted by the user are present. I have tried to use an expression with โ€œINโ€, but Linktofilteredview() only gives back the exact pattern (For example: If the user select โ€œAโ€, we doesnยดt obtain any result.This is wrong because we have rows in Table A with [meso] = โ€œA,Cโ€. The desired output for that input would be all rows where โ€œAโ€ is present.

What can I do? Thank you very much in advance,
Diego

Solved Solved
0 8 811
1 ACCEPTED SOLUTION

Try this:

LINKTOFILTEREDVIEW(
  "Table A",
  (
    COUNT([meso] - LIST())
    <> COUNT([meso] - [_THISROW].[meso])
  )
)
  1. COUNT([meso] - LIST()) counts the distinct items of [meso]. Subtracting one list from another has the side-effect of removing duplicate list items.

  2. COUNT([meso] - [_THISROW].[meso]) counts the distinct items of [meso] that are not also present in [_THISROW].[meso].

  3. (COUNT(...) <> COUNT(...)) asks whether the count of (distinct) items in [meso] changes if items also in [_THISROW].[meso] are removed. If [_THISROW].[meso] contains items also in [meso], the counts will be different.

View solution in original post

8 REPLIES 8

What is the formula you have tried to use?

Hi Aleksi:

This is the formula:

LINKTOFILTEREDVIEW(โ€œTable Aโ€,IN([meso],[_THISROW].[meso]))

What is your โ€œmesoโ€ column type in table A?

[meso] in Table A is EnumList and [meso] in Form A is also an EnumList

Initially, I tried [meso] in Table A to be Textโ€ฆbuy I had some problems with LINKTOFILTEREDVIEW() comparing with the input from the form (List). So I assigned both columns to be EnumList. Now LINKTOFILTEREDVIEW() worksโ€ฆbut not the way I want.

Is there any other way to filter Table A based on this column? I have seen something about Slicesโ€ฆbut I started with this option.

The problem is your filter. You are trying to compare list against list and IN expression is not meant for that. Letโ€™s say you have options 1,2,3 selected in both columns. IN formula will make three different comparingsโ€ฆ 1,2,3=1, 1,2,3=2 or 1,2,3=3. As you can see the answer is always false.

Thank you Aleksi.

So, what are the available alternatives for this case?

Try this:

LINKTOFILTEREDVIEW(
  "Table A",
  (
    COUNT([meso] - LIST())
    <> COUNT([meso] - [_THISROW].[meso])
  )
)
  1. COUNT([meso] - LIST()) counts the distinct items of [meso]. Subtracting one list from another has the side-effect of removing duplicate list items.

  2. COUNT([meso] - [_THISROW].[meso]) counts the distinct items of [meso] that are not also present in [_THISROW].[meso].

  3. (COUNT(...) <> COUNT(...)) asks whether the count of (distinct) items in [meso] changes if items also in [_THISROW].[meso] are removed. If [_THISROW].[meso] contains items also in [meso], the counts will be different.

Fantastic Steve, it works! Thank you very much and have a nice day

Top Labels in this Space