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 / Filtering depending on...
Power Apps
Unanswered

Filtering depending on amount and Cost Centre and then adding they details to a form to be submitted.

(0) ShareShare
ReportReport
Posted on by 1,176

Hi,
First, let me apologise for the length of this request..  I have tried to condense it and hopefully it makes sense 😊

I have various apps that use the approval process in Flow.  

The issue that has cropped up, there are multiple approvers for the same Cost Centre and amount.

I've have a gallery which currently retrieves all the approvers for the cost Centre that has been selected...There is also a TextBox where the amount is entered.

Currently the app retrieves the 'First' approver but I would like just those that full for the values.  The amounts are the ceiling of their approvals

So in example 499.00 is below the 500.00 ceiling for 4 approvers.  I would like just these 4 approvers to appear and then the user can select the correct one.  If it is 500.00 or above then there are another four approvers and then these should appear..

Once the Check box is selected for the appropriate approver then the name and their email, is it possible for these to appear in the fields 'Approver Name' and 'Approver Email'

ClarkyPA365_0-1708011000054.png

ClarkyPA365_2-1708011321624.png

 



ClarkyPA365_1-1708011257035.png

 

ClarkyPA365_4-1708011611069.png

OnSelect for Click for Approver button

Set(gblApprover, First(SortByColumns(Filter('SAP - Approvers Flow', Amount > Value(AmountReqd_Value.Text) && CostCentre = CostCentre_Value.Text), "Amount")));

ClarkyPA365_3-1708011517480.png

 

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @ClarkyPA365 -

     

    As I understand it.

     

    Your have a SharePoint list (List 1) which is submitting data via an Edit Form control.

     

    You have another SharePoint list (List 2) which contains several Single Line Text columns. These columns display details associated to People (approvers). Each person is associated to a Cost Centre and each person's delegated approval threshold is displayed in another number column (Amount).

     

    In your App. You have a screen which contains the Edit Form control and a Gallery control (on the same screen).

     

    Depending on the entered Amount Required value and the selected Cost Centre on the Edit Form, you want to Filter the Gallery control to display all Approvers who fall within those parameters.

     

    Users should then select a record from that Gallery, and once a selection has been made, the Approver Name and Approver Email fields in your Form should be automatically populated with the Approver Name and Approver Email attributes from that selected Gallery record.

     

    Is that understanding correct?

  • Chris1968 Profile Picture
    1,176 on at

    Hi @Amik 

    That is basically the requirement...

    I have the Gallery on another screen currently but would, if possible to have it on the same screen and be static as the edit form as a scroll bar

  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @ClarkyPA365 - one method below. Note this solution does not include a checkbox embedded into the Gallery, as I no see purpose in using one. I assume you’re populating your Edit Form with a Gallery selection. Let’s call it "Gallery_Data" for this example.

     

    If Gallery_Data and the Form are on the same screen:

     

    1. Add another Gallery (we call it this Gallery_Approvers) into your Form Screen

    2. Set the Items property to:

     

    Filter(
     'Sap - Approvers Flow',
     CostCentre = CostCentre_Value.Text,
     Amount <= Value(AmountReqd_Value.Text)
    )

     

    3. On the OnSelect property of Gallery_Approvers, enter:

     

    UpdateContext({ctx_name_displayname: ThisItem.'Full Name'});
    UpdateContext({ctx_name_email: ThisItem.Email})
    

     

    4. On OnSelect property of Gallery_Data, enter:

     

    UpdateContext({ctx_name_displayname: ThisItem.'Your Approver Name Field'});
    UpdateContext({ctx_name_email: ThisItem.'Your Approver Email Field'})

     

    5. On the Default property of the Text Input control inside the DataCard for the Approver Name field, enter:

     

    ctx_name_displayname

     

    6. On the Default property of the Text Input control inside the DataCard for the Approver Email field, enter:

     

    ctx_name_email

     

    If Gallery_Data and the Form are on different screens:

     

    1. Follow steps 1 and 3 above

    2. On the OnSelect property of Gallery_Data (which is on another screen), keep whatever you already have (e.g. any variables you’re declaring) but also enter:

     

    Navigate(
     'Your Form Screen',
     ScreenTransition.Fade,
     {
     ctx_name_displayname: Blank(),
     ctx_name_email: Blank()
     }
    )
    

     

    3. On the Default property of the Text Input control inside the DataCard for the Approver Name field, enter:

     

    Coalesce(
     ctx_name_displayname,
     Parent.Default
    )
    

     

    4. On the Default property of the Text Input control inside the DataCard for the Approver Email field, enter:

     

    Coalesce(
     ctx_name_displayname,
     Parent.Default
    )

     

  • Chris1968 Profile Picture
    1,176 on at

    Hi @Amik 

    Thank you for these solutions...
    I'm so sorry but it doesn't seem to be working, and it's probably something I've done or not done 😔

    I've added the Gallery (Gallery4_1) to another screen.

    I have a button to navigate to Gallery 4_1 once all the fields have been completed on the Form (VirtualCardReq_frm)
    The OnSelect for this button is Navigate(Gallery4_1, Fade)

    OnSelect for Gallery4_1

    Navigate(
    VirtualCardReq_frm,
    ScreenTransition.Fade,
    {
    ctx_name_displayname: Blank(),
    ctx_name_email: Blank()
    }
    )

    Items for Gallery 4_1

    Filter(
    'SAP - Approvers Flow',
    'Cost Centre' = CostCentre_Value.Text,
    Amount <= Value(AmountReqd_Value.Text)
    )

    Default for Approver Name field (ApproveName_txt).  Same for Approver Email (ApproveEamil_txt) but with ctx_name_email)

    Coalesce(
    ctx_name_displayname,
    Parent.Default
    )

    Same for Approver Email (ApproveEamil_txt) but with ctx_name_email)

    I'm a bit confused with 

    ClarkyPA365_0-1708345344579.png

     

    ClarkyPA365_1-1708345393964.png

     as there are two formulas for the OnSelect for the Gallery _Data  which I'm assuming relates to what I've called Gallery4_1.

  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @ClarkyPA365 - could you clarify what is causing confusion?

     

    • The purpose of Step 3 is to populate two variables (ctx_name_displayname & ctx_name_email) with the selected approver name and approver email from "Gallery_Approvers"
    • The purpose of Step 4 is to clear these variables whenever we select a different record from Gallery_Data.

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard