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 / Search on gallery and ...
Power Apps
Answered

Search on gallery and pagination

(0) ShareShare
ReportReport
Posted on by 148

Hello guys, I have issue with the below code for a week I'm trying to solve it but it seems to need an expert guy to figure it out.

First code on Gallery item :

 

 

 

 

(Filter(AnaMlaak, StartsWith('Serial number', TextInput1.Text) || StartsWith('KU TAG', TextInput1.Text) || StartsWith(PO, TextInput1.Text)

 

 

 

 

The second code is :

 

 

 

 

If(varPageNumber=1,FirstN(AnaMlaak,ddPageSize.SelectedText.Value*varPageNumber),LastN(FirstN(AnaMlaak,ddPageSize.SelectedText.Value*varPageNumber), ddPageSize.SelectedText.Value*1))

 

 

 

 

The question is how to merge them I need these 2 functions to work on the same gallery 😞

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at

    Hi @Stylead ,

    Firstly, the below is syntax guidance only and using your code structure as I am unsure what you are doing in the second part, however try this idea

    With(
     {
     wList:
     Filter(
     AnaMlaak, 
     StartsWith(
     'Serial number', 
     TextInput1.Text
     ) || 
     StartsWith(
     'KU TAG', 
     TextInput1.Text
     ) || 
     StartsWith(
     PO, 
     TextInput1.Text
     )
     )
     },
     With(
     {wPage: Value(ddPageSize.Selected.Value) * varPageNumber},
     If(
     varPageNumber=1,
     FirstN(
     wList,
     wPage
     ),
     LastN(
     FirstN(
     wList,
     wPage
     ),
     Value(ddPageSize.Selected.Value)
     )
     )
     )
    )

     

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

  • Stylead Profile Picture
    148 on at

    Thanks for your fast response, still the same issue I'm getting an error.

     

    Screen Shot 2022-02-07 at 1.55.36 PM.png

  • WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at

    Hi @Stylead ,

    That is why I said it was syntax guidance as I simply used your values (the code was not meant to be simply pasted in, but understood and your values applied to it).
    It appears that one or more are not referenced correctly. Have a look at the error, the value posted it refers to and what it says is wrong. For instance

    {wPage: Value(ddPageSize.Selected.Value) * varPageNumber},

    assumes that your drop-down ddPageSize allows the choice of one numeric value and that varPageNumber is also Numeric.

     

    Please click Accept as solution 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 Thumbs Up.

    Visit my blog Practical Power Apps

     

  • Stylead Profile Picture
    148 on at

    Dear Mr.WarrenBelz the code works with no issue all value names are correct but the search function stopped working.

     

    With(
     {
     wList:
     Filter(
     AnaMlaak, 
     StartsWith(
     'Serial number', 
     TextInput1.Text
     ) || 
     StartsWith(
     'KU TAG', 
     TextInput1.Text
     ) || 
     StartsWith(
     PO, 
     TextInput1.Text
     )
     )
     },
     With(
     {wPage: Value(ddPageSize.Selected.Value) * varPageNumber},
     If(
     varPageNumber=1,
     FirstN(
     wList,
     wPage
     ),
     LastN(
     FirstN(
     wList,
     wPage
     ),
     Value(ddPageSize.Selected.Value)
     )
     )
     )
    )

     

     

  • Verified answer
    WarrenBelz Profile Picture
    155,279 Most Valuable Professional on at

    @Stylead ,

    Do you mean the StartsWith at the top ? How many records do you have in the List ? Also try this on its own in a gallery to see if it works 

    Filter(
     AnaMlaak, 
     StartsWith(
     'Serial number', 
     TextInput1.Text
     ) || 
     StartsWith(
     'KU TAG', 
     TextInput1.Text
     ) || 
     StartsWith(
     PO, 
     TextInput1.Text
     )
    )

    If so, your issue is at the bottom and I do not know what you are trying to achieve there.

     

  • Stylead Profile Picture
    148 on at

    Dear Mr. WarrenBelz below code has no issue but still, the search is not working.

     

    Filter(
     AnaMlaak, 
     StartsWith(
     'Serial number', 
     TextInput1.Text
     ) || 
     StartsWith(
     'KU TAG', 
     TextInput1.Text
     ) || 
     StartsWith(
     PO, 
     TextInput1.Text
     )
    )

     

    I'm building an asset inventory app for my organization with 16k records but for now, I'm testing 20 records only

     

    I appreciate your kind response and help.

     

    Thanks a lot 😊

  • Stylead Profile Picture
    148 on at

    Dear Mr.WarrenBlez this is to let you know that your code is working perfectly it was my mistake with the text input name. Thanks a lot, you fixed a big issue for me.

     

    below your code thanks again ^_^

     

    With(
     {
     wList:
     Filter(
     AnaMlaak, 
     StartsWith(
     'Serial number', 
     TextInput2.Text
     ) || 
     StartsWith(
     'KU TAG', 
     TextInput2.Text
     ) || 
     StartsWith(
     PO, 
     TextInput2.Text
     )
     )
     },
     With(
     {wPage: Value(ddPageSize.Selected.Value) * varPageNumber},
     If(
     varPageNumber=1,
     FirstN(
     wList,
     wPage
     ),
     LastN(
     FirstN(
     wList,
     wPage
     ),
     Value(ddPageSize.Selected.Value)
     )
     )
     )
    )

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,074

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 606

Last 30 days Overall leaderboard