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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Creating a Button on p...
Power Apps
Unanswered

Creating a Button on power app to email share point list findings by power apps screen that is filtered.

(0) ShareShare
ReportReport
Posted on by 78

Creating a button that will send a email using power automate flow. I have the button working  by selected filters. but if you don't select all combo boxes the results are 0. I would like the result to show filters that are selected even if one is blank. here is what I have in the onselect field of the button is there a better way to write this ?

 

RoBE_0-1709488784433.png

 

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at

    Hello, @RoB-E, for the combo boxes that are inside a Filter function criteria, add this for all combo boxes:

     

    Filter(DataSource, 
    Column=ComboBox1.Selected.Value || IsBlank(ComboBox1.Selected) || IsEmpty(ComboBox1.SelectedItems)
    )

     


    If my reply helped you, please give a 👍 If it solved your issue, please give a 👍 & accept it as the Solution to help other community members find it more.

    Visit my Blog: ahmedsalih.blog

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

    Microsoft Business Application MVP

  • iClarkSi Profile Picture
    117 on at

    Hey @RoB-E,

     

    If I understood correctly, you have a button that calls for a Power Automate flow with a oData query as parameter. This oData filter is the one that returns 0 results if one of the two dropdown filters are not selected.

    If this is the case, what you will want to do is build up the odata query string before the email.Run() function.

    It would be something like this:

     

    UpdateContext(
     {
     varODataString: Concatenate(
     If(
     Type_Combobox.Selected.Value <> "",
     "startswith(InspectionType10,'" & Type_Combobox.Selected.Value & "')",
     ""
     ),
     If(
     Block_Combobox.Selected.Value <> "",
     "and field_3 eq '" & Block_Combobox.Selected.Value & "' and Remediated eq false '",
     ""
     )
     )
     }
    )
    
    email.Run(
     varODataString,
     User().Email
    )

     

     

    I hope this helps you!

  • RoB-E Profile Picture
    78 on at

    I have all that already in my gallery other then empty ? copied code below of my gallery 

     

     

    Sort(
    Sort(
    Sort(
    Sort(
    Filter(
    'BOX CANYON 1063 PUNCH-LIST',
    'Remediation Verified' = false,
    'Inspection Type'.Value = Type_ComboBox.Selected.Value || Type_ComboBox.Selected.Value = Blank(),
    Block.Value = Block_ComboBox.Selected.Value || Block_ComboBox.Selected.Value = Blank(),
    'Item Is Remediated' = Checkbox9.Value || 'Item Is Remediated' And
    'Remediation Verified'= Checkbox9_1.Value || 'Remediation Verified'



    ),
    Row
    ),
    'Pile ID'
    ),
    'Tracker/Section'.Value
    ),
    Block.Value
    )

  • AhmedSalih Profile Picture
    6,678 Moderator on at

    @RoB-E, try this:

     

    Sort(
     Sort(
     Sort(
     Sort(
     Filter(
     'BOX CANYON 1063 PUNCH-LIST',
     'Remediation Verified' = false,
     'Inspection Type'.Value = Type_ComboBox.Selected.Value || Type_ComboBox.Selected.Value = Blank() || IsEmpty(Type_ComboBox.SelectedItems),
     Block.Value = Block_ComboBox.Selected.Value || Block_ComboBox.Selected.Value = Blank() || IsEmpty(Block_ComboBox.SelectedItems),
     'Item Is Remediated' = Checkbox9.Value || 'Item Is Remediated' And
     'Remediation Verified' = Checkbox9_1.Value || 'Remediation Verified'
    
    
    
     ),
     Row
     ),
     'Pile ID'
     ),
     'Tracker/Section'.Value
     ),
     Block.Value
    )

     


    If my reply helped you, please give a 👍 If it solved your issue, please give a 👍 & accept it as the Solution to help other community members find it more.

    Visit my Blog: ahmedsalih.blog

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

    Microsoft Business Application MVP

  • RoB-E Profile Picture
    78 on at

    the email is still showing as 0 items when sent with only one combo box filtered 

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @RoB-E,

     

    You will have to add conditional logic to the OData query in order to handle the empty combobox values. @iClarkSi's approach should solve that issue - I would recommend the following 2 improvements to the code: Avoid 1-time variables via the With function & remove empty false parameters within If statements.

     

    With(
     {
     //Each individual filter is stored in a function scope variable
     //Inspection & Field3 will only contain a odata query value if the combobox has a selected value
     wInspectionType10Filter: If(
     !IsBlank(Type_ComboBox.Selected.Value),
     $"startswith(InspectionType10, '{Type_Combobox.Selected.Value}') and "
     ),
     wField3Filter: If(
     !IsBlank(Block_ComboBox.Selected.Value),
     $"field_3 eq '{Block_Combobox.Selected.Value}' and "
     ),
     wRemediatedFilter: "Remediated eq false"
     },
     email.Run(
     //Pass through OData query
     $"{wInspectionType10Filter}{wField3Filter}{wRemediatedFilter}",
     User().Email
     )
    );
    //Notify function below

     

    As alternatives, (a) you could pass through the combobox values and move the OData building logic to your flow or (b) should you already display the records within the app, you can pass them to your flow instead of using a separate List Rows action within the flow.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • RoB-E Profile Picture
    78 on at

    Thank you this worked perfectly!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard