Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Delegation Issues

(0) ShareShare
ReportReport
Posted on by 36

Hello, I have created an APP for checking & reporting of Car Milage twice a day by 50+ staff members. After running the app for almost 6 months, the number of rows of the SP List is now over 4,400.

I've set a delegation at my APP for retrieving only those records in the past 5 days with the formula below but it however doesn't work!!!

If(
    IsBlank( TextSearchBox1.Text),
    SortByColumns(
        Filter(
            'Company Vehicle Milage Records',
            'Technician Name' = Office365Users.MyProfileV2().displayName &&
            DateValue('Report Date') >= DateAdd(Today(), -5)
        ),
        "ID", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)
    ),
    SortByColumns(
        Filter(
            'Company Vehicle Milage Records',
            Switch(
                ComboBox1.Selected.Val,
                1, TextSearchBox1.Text in 'Technician Name',
                2, TextSearchBox1.Text in 'Car Plate Number',
                3, TextSearchBox1.Text in Area
            ) &&
            DateValue('Report Date') >= DateAdd(Today(), -5)
        ),
        "ID", If(SortDescending1, SortOrder.Descending, SortOrder.Ascending)
    )
)


Much appreciate your advice on making this formula functionable.

Thanks

Raymond

  • Ami K Profile Picture
    Ami K 15,650 on at
    Re: Delegation Issues

    @Raymondwkmok this topic is too broad for a forum post and there are many resources you can find online on this action (or alternatively use the Response action if you have premium).

     

    The basic steps are:

     

    1. Create a flow (such as an Instant Cloud Flow)

    2. Select a trigger, e.g. Power Apps v2

    3. Insert a Get Items action and configure the Site Address and List Name

    4. In the ODATA filter function, apply your filter parameters

    5. Add a "Respond to a Power App or flow action"

    6. Select Text for Output

    6. Enter a title

    7. For "enter a value to respond", select "value" from Dynamic Content from the Get Items action

    7. Run a manual test to ensure a valid response is being returned

    8. Return to your Canvas App and add the Power Automate flow into the App

    9. Trigger the Flow, for example by creating a Button control and on the OnSelect property of the Button, use:

     

    Set(
    powerautomate_response, 
    'Your Flow Name'.Run("some parameter")
    )

     

    10. The data will be returned back to your Canvas App as a JSON string. You will then need to leverage the Parse JSON function to obtain the table structure you need.

     

    Further reading:

     

    https://www.youtube.com/watch?v=FqfLiJDdC3Q&t=712s 

  • RM-06090351-0 Profile Picture
    RM-06090351-0 36 on at
    Re: Delegation Issues

    Thanks Amik for the advice.

    Btw, please can you provide further details or guidance on how I can apply filters in Power Automate and then return the filtered data back to your Power App using the Respond to a Power App or flow action.

    Many Thanks
    Raymond

  • timl Profile Picture
    timl 33,713 on at
    Re: Delegation Issues

    @Raymondwkmok - in addition to what @Amik says, I also note that Switch part of your formula applies the 'in' operator. This will be another reason why your formula isn't delegable. 

  • Verified answer
    Ami K Profile Picture
    Ami K 15,650 on at
    Re: Delegation Issues

    @Raymondwkmok - the key issue you have here is that your Filter operation is still not delegable because a cast operation like DateValue is a server side operation which can only be applied to the first 500 records in your data source (or max 2000 if changed via settings).

     

    Unless you have any other delegable criteria you can filter on, a fast and alternative option is apply your Filters in Power Automate and then return the filtered data back to your Power App using the Respond to a Power App or flow action.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard