Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Unanswered

Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage

Posted on 30 Nov 2024 20:06:55 by 63

Hello Power Platform Community,

 

I am currently working on implementing pagination in a gallery using Power Apps, but I am encountering an issue when I try to display data in pages. I am using the following formula on Items Property of Gallery:

 

LastN(
    FirstN(
        Filter(
            'Purchase Requisition', // Your data source
            // Approval Status Filter:
            (
                (CheckboxApproved.Checked && Status.Value = "Approved") ||
                (CheckboxPending_1.Checked && Status.Value = "Pending") ||
                (CheckboxRejected_2.Checked && Status.Value = "Rejected") ||
                (!CheckboxApproved.Checked && !CheckboxPending_1.Checked && !CheckboxRejected_2.Checked)
            ) &&
            // Status Filter
            (IsBlank(varStatusFilter) || Status.Value = varStatusFilter) &&
            // DateRange Filter:
            (
                (IsBlank(DatePickerCanvas1_1.SelectedDate) || 'Date of Requisition' >= DatePickerCanvas1_1.SelectedDate) &&
                (IsBlank(DatePickerCanvas2_2.SelectedDate) || 'Date of Requisition' <= DatePickerCanvas2_2.SelectedDate)
            ) &&
            // Price Range Filter
            (
                (IsBlank(txtInput_MinPrice.Value) || 'Price' >= Value(txtInput_MinPrice.Value)) &&
                (IsBlank(txtInput_MaxPrice.Value) || 'Price' <= Value(txtInput_MaxPrice.Value))
            ) &&
            // Search Box Filter
            (
                txtInput_Search_2.Value in ID ||
                txtInput_Search_2.Value in 'Date of Requisition' ||
                txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
                txtInput_Search_2.Value in Location.Value ||
                txtInput_Search_2.Value in Department.Value ||
                txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
                txtInput_Search_2.Value in Status.Value ||
                txtInput_Search_2.Value in 'Approved by'.DisplayName ||
                IsBlank(txtInput_Search_2.Value)
            )
        ),
        varRowsPerPage * varPage // Get the first N records based on page and rows per page
    ),
    varRowsPerPage // Only show rows for the current page (limit to 10 per page)
)
 

Issue:

Whenever I try to use this formula, I get an error message: "We didn't find any data." The data source appears to be correct, and I have set up the context variables on "OnVisible" property of Screen

UpdateContext({varPage: 1, varRowsPerPage: 10});

 but I still cannot display the data as expected.

 

What I’ve Tried:

 

  1. Double-checked the context variables (varRowsPerPage and varPage).

  2. Verified the filter conditions to make sure they aren't causing the issue.

  3. Tested the data source without pagination to ensure data is being loaded correctly.

  4. Ensured that varRowsPerPage and varPage are correctly initialized and updated.
 

Any help or suggestions would be greatly appreciated!

 
 

This type of post provides context for your error, details about what you’ve tried so far, and specific questions that can guide others in the community to help you troubleshoot.

  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 15 Dec 2024 at 04:41:10
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 02 Dec 2024 at 09:24:00
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    The bottom filter is on _Data (the output of the top one)
     
  • SR-02111122-0 Profile Picture
    SR-02111122-0 63 on 02 Dec 2024 at 08:32:15
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    Right now I have 17 records 
     
  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 02 Dec 2024 at 08:17:09
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    So the filter works on its own (as per what I posted last) and the pagination and search also work on their own ? How many records do you have ?
    LastN(
       FirstN(
          Filter(
             'Purchase Requisition',
             Len(txtInput_Search_2.Value) = 0 ||
             txtInput_Search_2.Value in Text(ID) ||
             txtInput_Search_2.Value in 'Date of Requisition' ||
             txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
             txtInput_Search_2.Value in Location.Value ||
             txtInput_Search_2.Value in Department.Value ||
             txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
             txtInput_Search_2.Value in Status.Value ||
             txtInput_Search_2.Value in 'Approved by'.DisplayName
          ),
          varRowsPerPage * varPage
       ),
       varRowsPerPage
    )
     
  • SR-02111122-0 Profile Picture
    SR-02111122-0 63 on 02 Dec 2024 at 08:02:13
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    After applying the formula it's not showing any error but before pagination filters were working fine.
  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 02 Dec 2024 at 07:29:06
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    They are your filters - I simply copied them and split out the Delegable portion at the top. What happens if you put this in a Gallery Items
    Filter(
       'Purchase Requisition', 
       (
          (
             CheckboxApproved.Checked && 
             Status.Value = "Approved"
          ) ||
          (
             CheckboxPending_1.Checked && 
             Status.Value = "Pending"
          ) ||
          (
             CheckboxRejected_2.Checked && 
             Status.Value = "Rejected"
          ) ||
          (
             !CheckboxApproved.Checked && 
             !CheckboxPending_1.Checked && 
             !CheckboxRejected_2.Checked
          )
       ) &&
       (
          IsBlank(varStatusFilter) || 
          Status.Value = varStatusFilter
       ) &&
       (
          IsBlank(DatePickerCanvas1_1.SelectedDate) || 
          'Date of Requisition' >= DatePickerCanvas1_1.SelectedDate
       ) &&
       (
          IsBlank(DatePickerCanvas2_2.SelectedDate) || 
          'Date of Requisition' <= DatePickerCanvas2_2.SelectedDate) &&
       (
          IsBlank(txtInput_MinPrice.Value) || 
          'Price' >= Value(txtInput_MinPrice.Value)
       ) &&
       (
          IsBlank(txtInput_MaxPrice.Value) || 
          'Price' <= Value(txtInput_MaxPrice.Value)
       )
    )​​​​​​​
  • SR-02111122-0 Profile Picture
    SR-02111122-0 63 on 02 Dec 2024 at 05:06:42
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    After applying this formula my Pagination is working but my filters are not working only search is working
  • WarrenBelz Profile Picture
    WarrenBelz 143,595 on 30 Nov 2024 at 22:23:04
    Error 'We Didn't Find Any Data' for Formula Using varRowsPerPage * varPage
    You are correct that the pagination basic structure is the proper format, so
    LastN(
       FirstN(
          'Purchase Requisition',
          varRowsPerPage * varPage 
       ),
       varRowsPerPage
    )
    will work fine, however (assuming you are using SharePoint here), you will only retrieve content from the first rows set by your Data Row Limit. Firstly, try this
    With(
       {
          _Data:
          Filter(
             'Purchase Requisition', 
             (
                (
                   CheckboxApproved.Checked && 
                   Status.Value = "Approved"
                ) ||
                (
                   CheckboxPending_1.Checked && 
                   Status.Value = "Pending"
                ) ||
                (
                   CheckboxRejected_2.Checked && 
                   Status.Value = "Rejected"
                ) ||
                (
                   !CheckboxApproved.Checked && 
                   !CheckboxPending_1.Checked && 
                   !CheckboxRejected_2.Checked
                )
             ) &&
             (
                IsBlank(varStatusFilter) || 
                Status.Value = varStatusFilter
             ) &&
             (
                IsBlank(DatePickerCanvas1_1.SelectedDate) || 
                'Date of Requisition' >= DatePickerCanvas1_1.SelectedDate
             ) &&
             (
                IsBlank(DatePickerCanvas2_2.SelectedDate) || 
                'Date of Requisition' <= DatePickerCanvas2_2.SelectedDate) &&
             (
                IsBlank(txtInput_MinPrice.Value) || 
                'Price' >= Value(txtInput_MinPrice.Value)
             ) &&
             (
                IsBlank(txtInput_MaxPrice.Value) || 
                'Price' <= Value(txtInput_MaxPrice.Value)
             )
          )
       },
       LastN(
          FirstN(
             Filter(
                _Data,
                Len(txtInput_Search_2.Value) = 0 ||
                txtInput_Search_2.Value in Text(ID) ||
                txtInput_Search_2.Value in 'Date of Requisition' ||
                txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
                txtInput_Search_2.Value in Location.Value ||
                txtInput_Search_2.Value in Department.Value ||
                txtInput_Search_2.Value in 'Requisitioned by'.DisplayName ||
                txtInput_Search_2.Value in Status.Value ||
                txtInput_Search_2.Value in 'Approved by'.DisplayName
             ),
             varRowsPerPage * varPage
          ),
          varRowsPerPage
       )
    )
    Next, if that does not work, delete the filters and then add them back in one at a time until it breaks - you should then find the culprit. Lastly if that all fails change your controls back to Classic controls and see if that fixes the issue.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,595

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,098

Leaderboard