cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
snipesnab
Helper II
Helper II

Problem running Count Function with filters when patching Sharepoint list with Lookup values

Hi Pros,

I am designing a new starter app and one one screen I would like to collate some analytics. This includes counting row with filters.

 

What I am doing on analytics screen load is running the following code which creates a collection from my sharepoint list.

 

ClearCollect(NewStarterFormCollection, ShowColumns(New_Starter_Form,"Office_x0020_Name","Region"))

ClearCollect(NewStarterFormCollection, New_Starter_Form)

 

This issue I am experiencing is that when the collection is created, it seems to create tables within the collection when the fields relate to Lookup fields from the sharepoint list. An example of a lookup field in SharePoint is 'Office Location' which gets its value from another SharePoint list in the same site.

 

Here is a screenshot of the Collection that is created:

 

snipesnab_0-1605993356994.png

As you can see there appears to be tables embedded within the collection (NewStarterFormCollection).

 

When I try and run the following, it does not pickup the values within the lookup fields in the collection:

CountRows(Filter(NewStarterFormCollection,'Form Status'="Submitted" && 'Office Location' = "London"))

 

Does anyone know how to reference the actual values in the lookup table within the collection so that I can filter on the values?

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @snipesnab ,

The syntax you need is below - your column name may not be exactly what I have.

ClearCollect(
   NewStarterFormCollection, 
   ShowColumns(
      AddColumns(
         New_Starter_Form,
         "LocationOffice",
         Office_x0020_Location.Value
      )
      "Office_x0020_Name",
      "Region",
      "LocationOffice"
   )
)

You can call the added field name whatever you want and this will be the reference for the lookups.
As a footnote, please have a look at this video by Shane Young @Shanescows regarding SharePoint field types and Power Apps and ask yourself do you really need Lookup columns. I have not used them for a very long time.

 

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @snipesnab ,

The syntax you need is below - your column name may not be exactly what I have.

ClearCollect(
   NewStarterFormCollection, 
   ShowColumns(
      AddColumns(
         New_Starter_Form,
         "LocationOffice",
         Office_x0020_Location.Value
      )
      "Office_x0020_Name",
      "Region",
      "LocationOffice"
   )
)

You can call the added field name whatever you want and this will be the reference for the lookups.
As a footnote, please have a look at this video by Shane Young @Shanescows regarding SharePoint field types and Power Apps and ask yourself do you really need Lookup columns. I have not used them for a very long time.

 

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.

WarrenBelz
Super User
Super User

Hi @snipesnab ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Thanks Warren, and the video from Shane explained perfectly!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,256)