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

Use View instead of Table as Gallery item

I'm running into a lot of issues trying to build an app, but I'll start with this one: if I use Table1 in a gallery, it works fine, but the Filter() conditions I need to add (so people can filter it with dropdowns) means I run into delegation issues. I have a view of that table that has all those criteria built in, but I can't seem to use it for Gallery items - I get "Expected table value."

 

Edit: these are views built directly within PowerApps via going to Data > Tables > Views. Data source is Dynamics data via CDS.

 

Any help? Thanks! 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

HI @RMDNA 

When you are setting the datasource for your gallery, you can select a view here:

1.jpg

and PowerApps should supply the correct filter to your gallery Items property. If you are using option sets for your fields, check out Shane Young's video on them in CDS.  https://www.youtube.com/watch?v=1L633HIvNGE 

View solution in original post

9 REPLIES 9
RandyHayes
Super User
Super User

@RMDNA 

If you're referring to a SharePoint view, then no, you cannot use them.

If you can perhaps provide the formula you are getting warnings in, perhaps some help can be given on how to correct the issues.   Also, since you mention the dropdowns, also provide the Items properties for the dropdowns.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Drrickryp
Super User
Super User

@RMDNA 

Please provide more details.  Where is your table coming from,(Excel, SharePoint, Dataverse)?  How are you filtering your table.  Please show a screenshot with the controls and provide the problematic filtered items property for your gallery.

Hi @RandyHayes ,

 

Error is here, just "expected table result". I can't figure out if there's a way to reference the view like a table.

 

RMDNA_0-1616170865559.png

 

I'm just referring to views built within PowerApps, going Data > Tables > Views.

 

RMDNA_1-1616170291817.png

 

@Drrickryp - data via CDS, originally from Dynamics. The filters that get me delegation errors are because I'm trying to filter text. I looked, but wasn't able to find a way to filter by text other than using in. It's a valid formula and works fine, but runs up against the table load limits, so I don't get all the data I need. This version exists only because I can't get the view mentioned above to work.

 

Items = SortByColumns(Filter('Project Approval',Date > DatePickerStart.SelectedDate && Date < DatePickerEnd.SelectedDate && Status in StatusDropdown.Selected.Result && Project in ProjectDropdown.Selected.Result),"msdyn_date", Ascending)

RandyHayes
Super User
Super User

@RMDNA 

So, unfortunately you cannot use an associated view from CDS/Dataverse in your app.  They really only work in context of a record.

 

So, you mention that you have Dropdowns...are they really Dropdown controls or Comboboxes?  I am going to go with the assumption that they are Dropdown controls.

Your formula should be this:

SortByColumns(
    Filter('Project Approval',
        Date > DatePickerStart.SelectedDate && 
        Date < DatePickerEnd.SelectedDate && 
        Status = StatusDropdown.Selected.Result && 
        Project = ProjectDropdown.Selected.Result
    ),
    "msdyn_date"
)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Drrickryp
Super User
Super User

HI @RMDNA 

When you are setting the datasource for your gallery, you can select a view here:

1.jpg

and PowerApps should supply the correct filter to your gallery Items property. If you are using option sets for your fields, check out Shane Young's video on them in CDS.  https://www.youtube.com/watch?v=1L633HIvNGE 

@Drrickryp - I've seen that in other elements, but in my UI, I only get data source and fields, not views. That's partially why I was confused if it was possible.

 

RMDNA_0-1616173680950.png

 

 

RandyHayes
Super User
Super User

@Drrickryp 

Good to know!  I've not seen that in the Gallery before.  I see it ONLY appears if the Gallery datasource has not been changed to anything else once the Gallery is added.

I also see that it adds the proper Filter for it.

Sweet!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes + @Drrickryp - going off both of your findings, I created a new gallery from scratch and was able to select a view. Criteria is a bit confusing, but that solves the issue. Thanks!

Drrickryp
Super User
Super User

@RMDNA

First, refresh the datasource in your app.  Then, if that doesn't work, restart the app and check it again.  However, when I select the view in my app it provides the following formula for the Items in the Customer table. 

Filter(Customers, 'Customers (Views)'.'Active Customers')

 You may want to try it manually first and see if it works.  

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,445)