cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
tianaranjo
Level 8

Create collection when blanks exist

Greetings,

 

I am creating a master collection (collection1) pulling from my data source.  Let's say there are 4 columns, A,B,C,D.

I would like to collect all the values from the master table of Column C ONLY IF the values in Column D are Blank. (collection2).  
    ColumnA             ColumnB              ColumnC                ColumnD                  

1  Text                      Text                      1234                       Text

2  Text                      Text                      4567

3  Text                      Text                      8910                       Text

4  Text                      Text                      4321

 

In the example above, the collection would include ColumnC from rows 2 and 4 because the ColumnD fields for those two rows are blank.  Result should be:

Collection2 

Result

4567

4321

Any suggestions?   Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create collection when blanks exist

You can Filter the first collection based on the IsBlank function for the ColumnD, like in the expression below:

ClearCollect(
    Collection2,
    Filter(
        Collection1,
        IsBlank(ColumnD)))

If you want both blank (null) values and empty ("") values, then you can use an Or clause in your filter:

ClearCollect(
    Collection2,
    Filter(
        Collection1,
        IsBlank(ColumnD) Or ColumnD = ""))

Hope this helps!

View solution in original post

4 REPLIES 4
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create collection when blanks exist

You can Filter the first collection based on the IsBlank function for the ColumnD, like in the expression below:

ClearCollect(
    Collection2,
    Filter(
        Collection1,
        IsBlank(ColumnD)))

If you want both blank (null) values and empty ("") values, then you can use an Or clause in your filter:

ClearCollect(
    Collection2,
    Filter(
        Collection1,
        IsBlank(ColumnD) Or ColumnD = ""))

Hope this helps!

View solution in original post

tianaranjo
Level 8

Re: Create collection when blanks exist

@CarlosFigueira  Thank you; works perfectly!  

tianaranjo
Level 8

Re: Create collection when blanks exist

@CarlosFigueira Is it possible to also collect the unique ID in this same formula?

PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Create collection when blanks exist

What do you mean by the unique id? is it a column in the original data source? If so then yes - the result of the Filter function doesn't remove any columns from the filtered data source, only rows that don't match the filter expression.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,829)