web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to search 2 column...
Power Apps
Unanswered

How to search 2 columns in a gallery?

(0) ShareShare
ReportReport
Posted on by 117

I have a gallery and an input component. I want to search the gallery with the input component for records by their ID

 AND who created them.

Currently I have it working with just searching on the record ID, but I don't know how to add a second column to search for who created them in the formula. Anyone knows?

 

Da9_0-1692170855934.png

 

Categories:
I have the same question (0)
  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @Da9 ,

    May I ask what data source you have used?

    Let us assume it is the SharePoint List.

     

    Please try this:

     

     

    Search(
     Search(
     Filter(AddColumns('DataSource',"CreatedName",'Created By'.DisplayName),
     YourConditions)
     Control1Name.Text,"CreatedName"),
     Control2Name.Text,"Title"
    )

     

     

    vhanytianmsft_0-1692171524580.png

     

     

    Hope this will help you,

    Best Regards,
    Tina

  • Da9 Profile Picture
    117 on at

    Hi, I'm using Dataverse as the data source. This function is only for searching the gallery, not for adding anything. 

    See this screenshot of how I imagined it working. Red is what I have now, orange is what I wanted to add, but its not working.

     

    Da9_0-1692173046022.png

     

     

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @Da9 ,

    In fact, "Created By" is the LookUp Column in the Dataverse, but  the Search function is only used to search for text. The Addcolumn() function helps you create a temporary table without making any changes to the data source.

    Search:

     

    Search(
     AddColumns('0711AS',"CreatedName",'Created By'.'Full Name'),
     Control1Name.Text,
     "ColumnName",
     "CreatedName")

     

     

    if you do not want to use AddColumn Function, we suggest you try Filter:

     

    Filter('0711AS',Control1Name.Text in 'Created By'.'Full Name' || Control1Name.Text in 'ColumnName')

     

     

    Hope this will help you,

    Best Regards,
    Tina

  • Da9 Profile Picture
    117 on at

    How can I add the AddColumn function in my current formula? I already use the Filter function to sort the gallery by creation date. 

     

    Is this a variable or is it connected to something?

    '0711AS',Control1Name.Text

     

    My current formula:

     

    SortByColumns(
    Search(
    Filter(
    'Challenging Wells',
    'Created By'.'Primary Email' = User().Email || 'Sector Level Responsible'.'Primary Email' = User().Email || 'BU Level Responsible'.'Primary Email' = User().Email || 'BC Level Responsible'.'Primary Email' = User().Email
    ),
    'Search Input'.Text,
    "dwcw_wellid"
    ),
    "createdon",
    SortOrder.Descending
    )

     

  • v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @Da9 ,

     

    '0711AS' is my Data Source form dataverse.

     

    SortByColumns(
    Search(
    Filter(
    AddColumn('Challenging Wells',"CreatedName",'Created By'.'Full Name'),
    'Created By'.'Primary Email' = User().Email || 'Sector Level Responsible'.'Primary Email' = User().Email || 'BU Level Responsible'.'Primary Email' = User().Email || 'BC Level Responsible'.'Primary Email' = User().Email
    ),
    'Search Input'.Text,
    "dwcw_wellid",
    "CreatedName"
    ),
    "createdon",
    SortOrder.Descending
    )

     

    Hope this will help you,

    Best Regards,
    Tina

  • Da9 Profile Picture
    117 on at

    Sadly its still giving me an error with the above formula. It looks like it should work, but doesn't.

    Da9_0-1692182172546.png

     

  • Verified answer
    v-hanytian-msft Profile Picture
    Microsoft Employee on at

    Hi @Da9 ,

     

    Sorry it is my bad.

    Please try this:

     AddColumn->AddColumns

    SortByColumns(
    Search(
    Filter(
    AddColumns('Challenging Wells',"CreatedName",'Created By'.'Full Name'),
    'Created By'.'Primary Email' = User().Email || 'Sector Level Responsible'.'Primary Email' = User().Email || 'BU Level Responsible'.'Primary Email' = User().Email || 'BC Level Responsible'.'Primary Email' = User().Email
    ),
    'Search Input'.Text,
    "dwcw_wellid",
    "CreatedName"
    ),
    "createdon",
    SortOrder.Descending
    )


    Best Regards,
    Tina

  • Da9 Profile Picture
    117 on at

    Thank you! Works now 🙂

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard