cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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!

 

 

2 REPLIES 2
Highlighted
Super User III
Super User III

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.

Highlighted
Super User III
Super User III

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.

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 (2,485)