web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using the results of F...
Power Apps
Unanswered

Using the results of Filter

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Good Morning

I am dealing with a SharePoint list called accomplishments.

I want to filter the list where the Date column == Today() (I know how to do this)

Now I have a 'record' or a list of 'records' that the filter has found. (I am fighting terminology. What are the results of my filter called?) I don't want to display it, but I want to run this filtered set through some if statements.

 

If(<The Result of the Filter>, there are no results, do this;

else If(<The Result of the Filter>, all of column x contains a null or a zero, do this;

else If(<The Result of the Filter>, any of column x contains a number above 0 and the current user is the same as column user_name, do this;

else If(<The Result of the Filter>, any of column x contains a number above 0 and the current user is NOT the same as column user_name, do this

 

How do I refer to the results of the filter? Do I have to run the results through a for loop, or do another filter on the results?

 

Am I making any sense?

Frank D. Puthuff
Dell Technology

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    PowerApps does not have a For Loop in it (don't confuse the ForAll with a for loop!).  But I am not sure what you mean by "do this" in your description.  

    The results of your filter is a Table of records that match the criteria of your statement.

     

    It seems to me that you are more interested in getting the initial set of records (in a Gallery perhaps) and then having the ability to then act on those results.

     

    Not really sure of your design or exactly what you mean by "do this"...so, if you can elaborate a bit, that would be helpful.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey Randy,

     

    Here is a better example of the code I am trying to write:

     

    If (User().FullName=Filter(Accomplishments, IsToday(Date) && !IsBlank(GSEP_CHG_Storage_Failed Or GSEP_CHG_Storage_Complete),User_Name),DisplayMode.Edit,DisplayMode.View)

     

    The only complaint I get is about the equal sign, because it says I am trying to compare equality between text and a table. All I want to know, is if there is a row in my SharePoint list that has:

    • Date = Today's Date
    • User_Name = current user of the app
    • either GSEP_CHG_Storage_Failed or GSEP_CHG_Storage_Complete is NOT blank

     

    I am hoping this answers your questions.

    Frank D. Puthuff
    Dell Technology

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Yes...User().FullName is going to be a Text value.  The Filter function is going to return a table, so PowerApps cannot evaluate/compare Text and Table.

     

    What you want is to lookup your record and get the value.  ("All I want to know, is if there is a row in my SharePoint list that has:")  So, in your sentence - "a row" is the key, you want a Record, not a List/Table.  Lookup will give you a record.  Filter will give you a table.

     

    This formula would do what you need:

     

    If(
     LookUp(Accomplishments, 
     IsToday(Date),
     !IsBlank(GSEP_CHG_Storage_Failed) || !IsBlank(GSEP_CHG_Storage_Complete),
     User_Name = User().FullName,
     true
     ),
     DisplayMode.Edit,
     DisplayMode.View
    )

     

    LookUp will find the first (any) record that matches your criteria and then return the value you want (typically a column, but it can be a column, multiple columns combined or calculated, or a completely abstract value).

     

    In the above, we really don't need a value to be returned, we just need to know that there is a record...so we ask LookUp to return "true" if there is a record (an abstract value).  That is then used in the If statement to determine the DisplayMode.

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I do not believe LookUp will work for me because it stops at the first record that meets any of these requirements. This was only one of three tests that I need to perform for every row in my Power Apps form.

     

    In no particular order, here is the explanation of these tests:

     

    Test 1: There are two options for this test.

    Option 1. If there is no record with today's date, DisplayMode.Edit

    Option 2. I can make a dummy record be there with today's date and the user_name of TEST. If this is the only record with today's date, DisplayMode.Edit

     

    Test 2: This row meets the criteria if:

    • Date Is today’s date
    • Either box is not blank
    • User_Name = User().FullName

     

     

     

    If(
     LookUp(Accomplishments, 
     IsToday(Date),
     !IsBlank(GSEP_CHG_Storage_Failed) || !IsBlank(GSEP_CHG_Storage_Complete),
     User_Name = User().FullName,
     true
     ),
     DisplayMode.Edit,
     DisplayMode.View
    )

     

     

    • then DisplayMode.Edit

     

    Test 3: 

    • Date Is today’s date
    • Either box is not blank
    • User_Name != User().FullName
    • then DisplayMode.View

    If the dummy row was first in the list and we ran the below code, (assuming all my syntax is correct) it would stop on the row with the User_Name of TEST and not make it to the other checks.

     

    If(
     LookUp(Accomplishments, 
     IsToday(Date),
     !IsBlank(GSEP_CHG_Storage_Failed) || !IsBlank(GSEP_CHG_Storage_Complete),
     User_Name = User().FullName,
     true
     ),
     DisplayMode.Edit,
     If(
     LookUp(Accomplishments, 
     IsToday(Date),
     !IsBlank(GSEP_CHG_Storage_Failed) || !IsBlank(GSEP_CHG_Storage_Complete),
     User_Name != User().FullName,
     true
     ),
     DisplayMode.View,
     If(
     LookUp(Accomplishments, 
     IsToday(Date),
     IsBlank(GSEP_CHG_Storage_Failed) && IsBlank(GSEP_CHG_Storage_Complete),
     User_Name = TEST,
     true
     ),
     DisplayMode.Edit,
     DisplayMode.View
    ))

     

     

    Thus the reason I was wanting to learn Filter.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard