1
votes

I'm trying to filter a list that contains data like...

MyList:

[
  {
    id: 1,
    title: "item 1"
    description: "some description here"
  },
  {
    id: 2,
    title: "item 2"
    description: "some description here"
  },
  {
    id: 3,
    title: "item 3"
  }
]

...with the desire to show the "description" value on a dropdown component. So this works, but the item #3 for example does not contain any description key object there and the dropdown is only showing and empty space on its own list. How can I filter this in order to show only 2 items here?

What did I try...

> RemoveIf(MyList, description=false )));
> Filter(MyList, description=false )));
> Filter(MyList, Not IsBlank(First(MyList).description));

without any luck, any ideas?

2

2 Answers

3
votes

@RicardoGonzales, you must have an error in your code somewhere. Look closer. (there are two missing "," in the collection above)

@CarlosFigueira's solution is correct.

Here it is in action: enter image description here

1
votes

You can try

Filter(MyList, Not IsBlank(description))

The expression in the second argument of the Filter function will be executed for every row of the table given as the first argument.