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 / Scan or Write a text t...
Power Apps
Unanswered

Scan or Write a text to Search

(0) ShareShare
ReportReport
Posted on by 63

Hi, please help. I need to set within a text entry so I can have 2 ways of entering and searching data. Through scanning and manual entry.

At this moment with this formula if it allows me to search manually at the text input.

Search(
 AddColumns(
 Contratistanew;
 "CedulaTxt";
 Text(Cedula)
 );
 TextSearchBox1.Text;
 "CedulaTxt"
)

MazingerZ_68_1-1708293956435.png


I placed the scan button linked to another text entry box that was for default ScannedValue.

UpdateContext({ScannedValue:First(Scan.Barcodes).Value})

MazingerZ_68_0-1708293895650.png

 

I dont want 2 text input, only 1 that allowed me to write or scan. Please tell me how to combine the formula at the Item of the gallery

 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @MazingerZ_68,

     

    Below I have provided a couple of possible options.

     

    If you want to allow both Text and Scan search (return record if it contains either) you could use the Filter function with the in operator:

    Filter(
     Contratistanew;
     TextSearchBox1.Text in Cedula || ScannedValue in Cedula
    )

     

    Should you want one to take precedence over the other, you could use the Coalesce function:

    With(
     //TextInput takes priority over scanned value
     //Use Coalesce(ScannedValue; TextSearchBox1.Text) instead should the scanned value take priority
     {wCondition: Coalesce(TextSearchBox1.Text; ScannedValue)};
     Filter(
     Contratistanew;
     wCondition in Cedula
     )
    )

     

    Alternatively, you could visualize the scanned code in TextSearchBox1 and only use the searchbox as filter condition.

     

    (1) Place the scan button on the same screen as TextSearchBox1

     

    (2) Set the BarcodeReader OnScan property to:

    //Save code to a local variable used in search box default property
    UpdateContext({ScannedValue:First(Self.Barcodes).Value});;
    //Reset searchbox back to default value (variable)
    Reset(TextSearchBox1)

     

    (3) Set TextSearchBox1 Default property to:

    ScannedValue

     

    (4) Set the gallery items property to:

    Filter(
     Contratistanew;
     TextSearchBox1.Text in Cedula
    )

     

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

    Thanks!

  • MazingerZ_68 Profile Picture
    63 on at

    Hi, When I write this in the gallery field, I do the test and it does not find the number that i need to find.

    although it does not detect any error but when writing the number in the field it does not find it

    Filter(
     Contratistanew;
     TextSearchBox1.Text in Cedula
    )

     

    MazingerZ_68_0-1708299842164.png

    The format of the column calles CEDULA is text

     

    When I use this configuration, the manual entry search works when testing, but a warning appears.

    The message indicates that this connector does not support the OR operation

    Filter(
     Contratistanew;
     TextSearchBox1_1.Text in Cedula || ScannedValue in Cedula
    )

    MazingerZ_68_1-1708300448737.png  

    MazingerZ_68_3-1708300674225.png

     

     

     

     

  • MazingerZ_68 Profile Picture
    63 on at

    @WarrenBelz maybe can you help me?

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @MazingerZ_68,

     

    Thank you for the info. What datasource (connector) are you using for the gallery?

  • MazingerZ_68 Profile Picture
    63 on at

    Excel

  • LaurensM Profile Picture
    12,516 Moderator on at

    @MazingerZ_68,

     

    I would not recommend using Excel as a datasource for Power Apps. For production apps that need to remain Standard, you may want to opt for SharePoint instead.

     

    That said after some testing, the Excel filtering indeed seems to behave rather weird when doing a 'contains' query on text columns containing only numbers. As a possible workaround you can fetch the records in memory (e.g. via With() or a Collection) and apply the filter afterwards:

     

    With(
     {wRecords: Contratistanew};
     Filter(
     wRecords;
     TextSearchBox1.Text in Cedula
     )
    )

    This method expects my alternative solution approach. Please note that your Excel rows should not exceed the Data Row Limit of your app. (See app settings, default 500 - max 2000)

     

     I hope this helps!

     

    @WarrenBelz@timl I am aware of the single column query/sorting limitations of Excel the Online connector. Are you aware of a limitation that could cause the 'in' operator (or Search, or StartsWith) to not return any results when dealing with column values containing only numbers?

  • WarrenBelz Profile Picture
    156,386 Most Valuable Professional on at

    @LaurensM ,

    Your approach is good with Excel - grab the whole list and do the query client-side (assuming it is under the Data Row Limit). There are too many queries that simply do not work as expected with Excel. Also here AddColumns will restrict the output numbers to the DRL and Search simply is not Delegable, so your With() approach is really the only effective one.

  • timl Profile Picture
    37,283 Super User 2026 Season 2 on at

    Hi @LaurensM 

    It's been a while since I've used the Excel connector but at the time, I don't remember seeing the problem of the in/search/startswith operators not returning correct results with column values containing only numbers.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard