cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Power Automate
Power Automate

Search Function

I'm trying to follow the instructions on this page:

https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/#examples

search.PNG

 

In my case I'm searching a sharepoint list for all items with the same ID number as the GalleryList1 selection. So I translated the example to be this and put it in the "Items" property of a new gallery (GalleryList2):

 

Search( SharePointDataSourceList, GalleryList1.Selected.ID, "RefID" )

 

Can anyone tell why it's not returning the rows in the list?

 

I also tried:

Filter(SharePointDataSourceList,RefID = Gallerylist1.Selected.ID)

and

Filter(PlanTreatmentComponents,GalleryList1.Selected.ID in "RefID") (this one removed the error, but didn't display the items for RefID 1)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Here is what I tried. Let me know if I got the repro wrong.

 

1. Created "Customers" list with Name and ID field

2. Created "Orders" list with a LookUp field that pointed to Customers' ID field AND "RefID" field that would contain the ID from Customers list

3. Created Gallery "Gallery1" with Items = Customers

4. Created Gallery "Gallery2" with Items = Filter(Orders, RefID = Gallery1.Selected.ID)

5. Also tried doing Gallery2 with Items = Filter(Orders, ccLookUp.Id = Gallery1.Selected.ID). In the case of lookup fields, they are represented using records in PowerApps. Hence doing ccLookUp.Id works.

 

They both worked.

View solution in original post

15 REPLIES 15
Highlighted
Continued Contributor
Continued Contributor

powerapps.png

 

In the above PowerApps, I am connecting a SPO List with the below schema

1.StudentID[Number]

2.Name[String]

 

Gallery1 displays the items where StudentID equals the value entered in TextInput1. Here I am using "in" comparison operator for string comparison. And this works fine as shown below.

 

powerapps.png

 

 

Highlighted

Thank you so much for responding. Here is the point that concerns me I am not using strings, I'm using ID numbers since we have to ensure unique identifier for search as the list grows. I also got it to work with strings late last night, and I had a moment of shock, as it appears that Power Apps has it's own data type. I don't know about others, but I don't want to set up a SharePoint list with all the right data types, and just because I connected to it from power apps, those data types change.

 

In SharePoint, by the very nature of the internal "ID" value, it is always an integer. I don't configure that, it's not something I can (or would want to) change either. When I realized that my ID number, was passing from a gallery reading sharepoint data 'as text', well, let's just say I turned off my computer and went to bed. LOL

 

How can I get this to work with ID numbers? or is this funtionality not supported? If it isn't supported I will have to pick a different text field and force it to be unique value in the list.

 

P.S. I tried everything I could find online regarding converting text to a number (which frustrates me cause I should not have to convert a number to a number), but they didn't work. (for exampe: text(GalleryList1.Selected.ID, "#")

 

Thank you again for your help! It is very appreciated, this was an unexpected challenge.

 

 

 

Highlighted

Hello - Can you tell us what the type of "RefID" is? is it a string or a number?

 

Murali

Highlighted
Power Automate
Power Automate

the refid is also an integer that is intended to pick up the id number of the parent item (both integers).

thank you so much
Highlighted

Have you tried:

Filter(SharePointDataSourceList, Value(RefID) = Value(Gallerylist1.Selected.ID))

 

Yes, PowerApps is statically- and strongly-typed. Users may not realize, but SharePoint lists are also typed. The column types do not typically change after they are created, and they are respected by PowerApps. (for example numeric columns in SP are imported as numbers, text in SP as text values, etc.) 

 

Radu Gruian [MSFT] ** PowerApps Staff
Highlighted
Power Automate
Power Automate

i will try that.

What I am saying about the type is they should match. If the data source is an integer, then it should be read as an integer in Power Apps. I shouldn't need to use a function to convert it to what it inherently is. (consider how bound fields worked in InfoPath, with the exception of sharepoint date time fields which have always been a pain point).

Does that make sense?
Highlighted

Can you tell us what the schema of SharePointDataSourceList is?

 

All SharePoint lists have an ID. Did you create another ID named "RefID" for SharePointDataSourceList?

 

Here is what I tried that worked:

1. Created a gallery with Items bound to a sharepointlist with column named RefID

2. Created a slider to provide the ID to search for

3. Created another galery with Items = Filter(SPList, RefID = Slider1.Value)

 

This worked for me.

 

Murali

Highlighted

 

accidential duplicate entry

Highlighted

Ok. let me explain because this power app will have two edit forms.

 

1. Create a SharePoint List for Customers (add the built in ID number which is an integer to the default view)

2. Create another SharePoint List for Customer Orders, which has a single lookup column from the Customers list, so that you can select the appropriate customer, AND a RefID integer column where you will push the Customer ID (add RefID to the default view).

 

When patching data back to SharePoint the EditFormCustomers will submit Customer name, but when using EditFormOrders you'll be submitting to the Customer Order list (where you'll have to query from the DisplayFormCustomers.Selected.ID value to get the number for the REFID field). DisplayFormCustomers is the gallery where you will select which customer applies to the order, it has the ID field in it as read only (which is correct). [FYI: If this works out I can have SharePoint Designer set the Lookup Value based on the RefID change done by Power Apps.

 

Let me know if that makes more sense that what I explained order. This is probably going to make more sense to you now.

 

Thank you again.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,878)