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

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
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.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,057)