cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efeewfew
Resolver I
Resolver I

Looking if a collection is inside of a column and filter on that

I have a collection of products that I put in a gallery, that looks like this;

efeewfew_1-1634987434904.png

efeewfew_2-1634987527436.png

I added a label in the gallery named lblProduct

 

That collection is basically an array of products. Now I need to filter a gallery based on those values in that collection.

 

I am currently doing it like this, but it only takes the first product, and not the other products. I want to filter Checklist_Vragen_OpleverApp based on the values in the collection

Filter(Checklist_Vragen_OpleverApp; lblProduct.Text in Product_Type)

 

5 REPLIES 5
Ethan_R
Continued Contributor
Continued Contributor

Hi @efeewfew ,

Well didn't quite get entire detail but I've created something similar which might help you.

I assume you want to filter all record based on the product type.

Ethan_R_0-1634995435075.png

//I created 2 collection. 1 collection has products to find.
// 2nd collection is list of all products

ClearCollect(
    colProducts,
    {
        'Product Name': "Stalen Hek"     
    },
    {
        'Product Name': "Baluster"
    }
);

ClearCollect(
    colListProducts,
    {
        Name: "Product A",
        Type: "Stalen Hek"
    },
    {
        Name: "Product B",
        Type: "Stalen Hek"
    },
    {
        Name: "Product C",
        Type: "Baluster"
    },
    {
        Name: "Product D",
        Type: "Baluster"
    },
    {
        Name: "Product M",
        Type: "BlueHill"
    },
    {
        Name: "Product N",
        Type: "BlueHill"
    }
);

Now I filtered 2 products from all product list.

Ungroup(ForAll(colProducts,
    Filter(
        colListProducts,
        'Product Name' in Type
    )
),"Value")

This is the Output

Ethan_R_1-1634995547430.png

 

 

Hope this helps

Hey @Ethan_R 

Thank you for your reply and sorry for my late response!

I've been trying to replicate how you made it but I've ran into some issues.

The database for all products with their questions (in your test, this is the collection with all the producttypes & names

efeewfew_0-1636185014627.png

I then have a column where I have all of the products that I need to get the questions from;
(This is your colProducts)

efeewfew_1-1636185127336.png
I am splitting this column to turn it into a collection;

 

ClearCollect(
    collectieProducten; 
      Split(varProducten; ",")
);;

 

I split the values on "," and put them in a collection, result:

efeewfew_2-1636185450562.png

efeewfew_3-1636185607535.png

 

Now we need to check if these values are in the database;    Checklist_Vragen_Opties (the database with the questions & products)
I tried to do it how you had it, but it shows some questions more than one time & the product name is the same for every label;

 

Ungroup(
    ForAll(collectieProducten;
        Filter(
            Checklist_Vragen_OpleverApp;
            Product_Type in collectieProducten
        )
    ); 
"Value")

 

 

efeewfew_4-1636185709380.png
I was expecting 6 questions, but I get 9. And the product names are all the same and don't have their actual product name

 

What am I doing wrong / do I have to add/change?

Thank you in advance! @Ethan_R 

Even if I filter it only on "Baluster", I'd expect to get 2 rows of questions, but I get 6 questions instead.. So weird

efeewfew_0-1636186288548.png


If I do it like this, I do get the expected result;

efeewfew_1-1636187259270.png

 

Anyone able to help me out? 

@Ethan_R  you maybe? 🙂

In your ungroup function, I get the error that I can't use a table in there @Ethan_R 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,358)