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

Filtering out Gallery items based on another Gallery.

Hi,

 

I am new to PowerApps and want to know if something is possible and get a steer on how to do it...

 

I have an Orders table which contains orders up to 10,000 rows.  I want to show key order data in this 'Order Header Gallery' such as Order Number, Order Date, Customer number and then for the user to drill into a row and navigate to an 'Order Detail' page.  This all works fine except I have found that my gallery is limited to 500 rows.

 

I would therefore like to create a summary page prior to seeing the Order Header Gallery which contains one row per Year and Month, with a count of orders for each.  So something like:

 

Jan 2019:   350 Orders, 348 Shipped, 2 Outstanding.

Feb 2019:   260 Orders, 240 Shipped, 20 Outstanding.

Mar 2019:   400 Orders, 320 Shipped, 80 Outstanding.

 

I have created a simple Order_Summary view of my Orders table in SQL which provides this summarised order info.

 

1, How do I link the selected Year and Month from the Order Summary Gallery to that of my Order Header Gallery?  I am sure this must be possible, is there a term for such functionality or a video I can watch to help me?

 

2, Is there a way around the 500 row limitation?  Due to the nature of our business, I don't think we would exceed 500 orders per month, but it would be good to know that there was an option if neccessary.

 

Many thanks in advance.

 

Mark

 

 

1 ACCEPTED SOLUTION
15 REPLIES 15
wyotim
Resident Rockstar
Resident Rockstar

As far as linking two galleries together, what I would recommend is using a filter based on the selection from the first gallery. In your case, something like the below in the OnSelect propery of your Order Header Gallery:

ClearCollect(
    colOrderSummaryItems,
    Filter(
        'Order Summary',
        Date >= ThisItem.Date,
        Date < DateAdd(ThisItem.Date, 1, Month)
    ) 
)

What is happening above is that, based on what is selected in the Order Header Gallery, a collection is made of Order Summary items filtered by dates between the Date value of the Order Header Gallery and the start of the following month. This is assuming you have a Date value to compare against, like the first date of the respective month, which you may have in your view already. If not, you could probably use the date and month to contruct a date value to compare against.

 

This is a lot to take in, so feel free to ping me back if I can help work out the specifics. Also, searching YouTube for 'PowerApps Gallery' should net some good results. Shane Young is a great person to check out on YouTube in general but I bet he has a video or two that would be helpful.

 

On the second point, there are ways around the 500 item limit. The easiest would be to bump up the 'Data row limit for non-delegable queries' to the max value of 2000. This is found under File -> App Settings -> Advanced Settings and then at the top. Otherwise, you could construct ways to pull data in in groups of the max value or pull in filtered groups by a defined range, like month and year. How to do this is a bit of a large topic but if you search the forums for 'delegation' you will get some great topics. I will track down a couple good threads and post them here later tonight.

 

Hopefully that gets you started and, as I said, I'm happy to help further if needed.

MarkSL
Frequent Visitor

Hi @wyotim 

 

Many thanks for the reply and for the kind assistance of help!

 

I found this video from Shane which gave me exactly what I wanted: https://www.youtube.com/watch?v=nlhWQg03TL0&t=239s

 

I created a new gallery1 in my existing app, pointed it to my view and then filtered the datasource of my gallery2 by the selected items in gallery1 (eg Year and Month).

 

Slightly frustrated though, I had it working, but then it stopped - my Gallery1 just wasn't responding to my selecting of the different rows?  I mapped a label to Gallery1.Selected.Year but it just remained empty as I clicked in different rows?  I created a new blank page in the app, added a new gallery, pointed it to the view which loaded the gallery, but again nothing was being returned by Gallery1.Selected.Year?  I deleted the datasource, recreated it, closed the app, re-opened etc, but no matter what it just wouldn't populate Gallery1.Selected.Year.  Yet if I start a brand new app it works perfectly?!   Perhaps its a bug?

 

Anyway!  I've decided to restart my app from fresh and have another quesiton if I may:

 

I have built a UsersDetail view table in SQL, which returns fields like 'UserName, UserEmail, SiteName, LocationCode, Division, Company" etc.  When the app first starts, I load a collection LoggedInUsersDetails with the details from this view, where UserEmail is that of the logged on user:

Clear(LoggedInUsersDetails);
Set(LoggedInUserEmail, User().Email);
Collect(
    LoggedInUsersDetails,
    Filter(
        '[dbo].[View_UserDetails]',
        UserEmail = LoggedInUserEmail
    )
);

This works fine and my collection is populated with the 10 records (Sites) that I am allowed to access.  I have created a Combo box which displays the SiteNames from LoggedInUsersDetails and the user can select one of these and the rest of the app will be based upon this selection. 

 

Once the user has selected their site, I want to populate some variables with the values for the related row in the collection.

 

Populating UserSite works fine:

Set(UserSite, combo_SiteName.SelectedText);

But I am struggling to set UserLocationCode.  I am trying to use LOOKUP but it doesn't like it, complaining against the equals sign is an 'Invalid Argument Type':

Set(UserSite, combo_SiteName.SelectedText);
Set(UserLocationCode, LookUp(LoggedInUsersDetails, SiteName = UserSite)

I have also tried FIRST(FILTER... but again this doesn't work:

Set(UserLocationCode, First(Filter(LoggedInUsersDetails, SiteName = UserSite.Value)))

How can I simply set some variables from my collection, based on the SiteName?

 

Thanks 🙂

MarkSL
Frequent Visitor

Hi @wyotim 

 

Thanks for the very helpful reply.  I actually found this video by Shane which gave me exactly what I was looking for: https://www.youtube.com/watch?v=nlhWQg03TL0&t=239s.

 

I created a Gallery1, pointed it to my summarised view and then filtered my datasource of Gallery2, based on the Gallery1.Selected.Year and Gallery1.Selected.Month.

 

Annoyingly though, it was working just fine, but then simply stopped working.  My Gallery1 just didn't respond to any button clicks.  I created a label to display Gallery1.Selected.Month and it just remained blank.  I tied everything, deleting the page, re-creating everything, dropping the datasource etc but it just will not work with my existing app.  I've created a brand new app and it works just fine?!  Perhaps its a bug?

 

Thanks

 

Mark

wyotim
Resident Rockstar
Resident Rockstar

Glad you were able to get it working! I’m not sure on why it would just stop with the first app you made. If you run into that again, feel free to add me in to the topic and I’d be happy to try and troubleshoot.
MarkSL
Frequent Visitor

Hi @wyotim 

 

I've been progressing with my App and really enjoying this new discovery!

I wanted to check that my concept of using a summarised gallery to decide what to pull into the detail gallery will work over a larger dataset and so created a brand new app simply containing two galleries.  Gallery1 loads from from a view and Gallery2 uses a Filter in its Items, eg:

Filter('[dbo].[ViewOrders]', LocationCode = Gallery1.Selected.locationcode)

My SQL view will return 15k rows if no selections are passed, but between 150 and 800 per LocationCode and it responds very quickly.

I've gone to preview the App and whilst it loaded quickly and was responsive for the first two clicks of Gallery1, it then stopped. 

When I click on new records in Gallery1 nothing appears to happen and I can't see any of the dots along the top of

the app and I can't see any active processes on my SQL server?

Is there some way of finding out why its not being responsive?

One of my concerns about PowerApps is that I don't really know how well its going to scale or what tools are in place to help monitor it.  The plan is to roll this out to 250 users who will be accessing it a few times a day to view, add and edit records in our SQL database.  I'm a bit concerned now that it appears to stop without reason!

Thanks

Mark

wyotim
Resident Rockstar
Resident Rockstar

Hi Mark,

 

That is odd behavior. One question: are you using an on-premises SQL server or Azure? There could be an issue with your gateway if it is on-prem. Unfortunately, I don't have much experience with gateways but we could add some people to the conversation who do have more experience if needed. 

 

If it is Azure, you might check your DTUs and see if you are getting maxed out there. I wouldn't think this is the case but it could be worth a look. 

 

Another question: are both galleries on the same screen or are you navigating between screens? Either way, is there code in the OnVisible property of either screen that might be effecting how data is being pulled in?

 

Otherwise, I am a bit stumped as to why it would work for a couple times and then stop responding. I have a couple views that are in the 15k row range that I can make a similar test app in. I'll try replicating your scenario and see what I can find.

MarkSL
Frequent Visitor

Hi @wyotim 

 

Again, thank you for taking the time to look at my issue, it really is a pleasure to join a forum that is active and has such helpful people!

 

Looking at other posts from lthe last 24 hours, I wonder it was an issue with the PowerApps service.  My issues were exactly the same as those described here What happen with all gallerys and also here Gallery control broken?

 

My datasource is On Premise SQL and I was able to connect to my Power BI reports through the same gateway without issue.  My two galleries are both on the same screen and I am not doing anything with OnVisible of the screen in which they reside.

 

However everything seems fine today.  I went into my app earlier today and clicked through many rows in my summary gallery and the detail gallery was loading in no more than 1 second and I went through many rows!

 

One issue that I am seeing is that I wanted to have a label which displays the number of rows in my detail gallery.  A google suggested that the syntax CountRows(GalleryName.AllItems) should do it, and I am sure I tried this the other day without issue, but today it is generating the warning "The function CountRows has some invalid arguments".  I have checked that my Gallery name is correct and made sure I selected it from the intellisense offerings.  I've noticed in the threads quoted above that users are saying that this has stopped working for them as well as the reported unresponsive galleries.

 

As for Azure, I do hope to move my application DB into this, but its not something I have done before.  We currently have an extension to access onsite SQL until Jan 2020 using PowerApps For Office 365, but after this all my users will require a Plan 1.  Therefore I am hoping it will be more cost effective to spin up a DB in Azure that upgrade 250+ users to Plan 1!

 

Anyway, thanks again and fingers crossed it was a one-off.

 

Mark 

wyotim
Resident Rockstar
Resident Rockstar

Mark, 

 

Glad to hear things are working now! It must be a service issue as you said. All the syntax and scenarios you have described have worked in my tests, which means I must be coming in after the fact. So, sorry to not be much help but glad it is working! 

 

Concerning the gallery count, the syntax of CountRows(GalleryName.AllItems) is indeed correct, so that must be part of the gallery issue you and others are describing. And again, I made a test that worked for me, so I must be behind the times again. 

 

For what it's worth, I highly recommend Azure SQL. Depending on your location, the pricing can be quite nice especially compared to the Plan 1 cost. Plus, no servers to maintain! You also might check out Visual Studio Dev Essentials. One of the many perks they offer is a free year of select Azure services, including SQL DB. I used this to help get things started for the company I work for, which really helped me as I had zero SQL experience before this. We then transitioned the free plan into a pay-as-you-go plan and rolled things out seamlessly. Just something to tuck away as you get closer to 2020.

 

Anyway, hope the issues have faded out and that you can get back to building some sweet PowerApps!

 

Tim

Helpful resources

Announcements

Tuesday Tips: Getting Started in the Community

TUESDAY TIPS is back!   This weekly series of posts is our way of sharing helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! The original run of Tuesday Tips was a highlight of last year, and these all-new Tips will hopefully prove to be just as informative as helpful. We will cover some basics about the Community, a few "insider tips" to make your experience even better, and sharing best practices gleaned from our most active community members and Super Users. Make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   THIS WEEK: I'm Brand New! What Do I Do? The number of new community members we have each week is pretty amazing, and we are so glad to welcome all of you to the Community! You may be wondering. "What do I do? Where do I get started? Will anyone be willing to help me? What I have a question? Help!"   Let's start with this: Welcome to the low-code revolution, and more importantly, welcome to the Power Platform Community! This is a great place to start. Whether you're busy with Power Apps, getting familiar with Power Automate, engaging Copilot Studio, or building in Power Pages, there are a few key places you should check out as you begin your journey: FORUMS: The forums are THE place to ask questions, look at questions asked by other Community members—and see answers and solutions from our Super Users and other helpful people in the Community. Power Apps ForumsPower Automate ForumsCopilot Studio ForumsPower Pages Forums   NEWS & ANNOUNCEMENTS: Our News & Announcements section highlights the newest and greatest updates in the Community, news from the product team, and so much more. It’s updated a few times each week and will also help you find ways to connect with what’s going on in the ever-growing world of Power Platform. Power Apps News & AnnouncementsPower Automate News & AnnouncementsCopilot Studio News & AnnouncementsPower Pages News & Announcements   GALLERIES: The Galleries section of the Community features tons of tips and tricks, features and benefits, and more—through videos created by our Super Users, product teams, and other helpful members of the Community. Power Apps GalleriesPower Automate Galleries Copilot Studio GalleriesPower Pages Galleries BLOGS: The community blogs section is full of handy step-by-step tips from members of the Community—and some of them include detailed answers to some of the questions most frequently asked questions, as well as how they solved a problem they faced. Power Apps Community BlogPower Automate Community BlogCopilot Studio Community BlogPower Pages Community Blog POWER UP PROGRAM: If you’d like to really take a huge step forward in your journey, we recommend checking out the Power Up Program, a Microsoft-sponsored initiative that trains new Power Platform users and has been a huge success since it launched a little over a year ago. There’s a waiting list, so definitely apply soon if you’re interested! Find out more here: Microsoft Power Up Program for career switchers.   There's so much more you'll discover in your Power Platform experience, and this Community is here for YOU! We are glad you've discovered us and can't wait to see where you grow! If you're new to the Community and just getting started, make sure to give this post a kudo and introduce yourself so we can welcome you!

Super User of the Month | Drew Poggemann

As part of a new monthly feature in the Community, we are excited to share that Drew Poggemann is our featured Super User for the month of February 2024. If you've been in the Community for a while, we're sure Drew's name is familiar to you, as he is one of our most active contributors--he's been a Super User for five consecutive seasons!   Since authoring his first reply 5 years ago to his 514th solution authored, Drew has helped countless Community members with his insights and expertise. In addition to being a Super User, Drew is also a User Group leader and a Microsoft MVP. His contributions to our Super User sessions and to the new SUIT program are always welcome--as well as his sense of humor and fun-loving way of sharing what he knows with others.   When Drew is not solving problems and authoring solutions, he's busy overseeing the Solution Architecture team at HBS, specializing in application architecture and business solution strategy--something he's been doing for over 30 years. We are grateful for Drew and the amazing way he has used his talent and skills to help so many others in the Community. If you are part of the SUIT program, you got to hear some great tips from Drew at the first SUIT session--and we know he still has much more to share!You can find him in the Community and on LinkedIn. Thank you for all you do, Drew!

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Our team will be reviewing posts using the new "Copilot Studio" label to ensure we highlight and amplify the most relevant and recent content, so you're assured of high-quality content every time you visit. If you share a post that gets featured in the curated gallery, you'll get a PM in the Community to let you know!The curated gallery is ready for you to experience now, so visit the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community. We can't wait to see what you "cook" up!      

Celebrating a New Season of Super Users with Charles Lamanna, CVP Microsoft Business Applications

February 8 was the kickoff to the 2024 Season One Super User program for Power Platform Communities, and we are thrilled to welcome back so many returning Super Users--as well as so many brand new Super Users who started their journey last fall. Our Community Super Users are the true heroes, answering questions, providing solutions, filtering spam, and so much more. The impact they make on the Communities each day is significant, and we wanted to do something special to welcome them at our first kickoff meeting of the year.   Charles Lamanna, Microsoft CVP of Business Applications, has stressed frequently how valuable our Community is to the growth and potential of Power Platform, and we are honored to share this message from him to our 2024 Season One Super Users--as well as anyone who might be interested in joining this elite group of Community members.     If you want to know more about Super Users, check out these posts for more information today:    Power Apps: What is A Super User? - Power Platform CommunityPower Automate: What is A Super User? - Power Platform Community Copilot Studio: What is A Super User? - Power Platform Community Power Pages: What is A Super User? - Power Platform Community

February 2024 User Group Update: Welcoming New Groups and Highlighting Upcoming Events

It's a new month and a brand-new year, which means another opportunity to celebrate our amazing User Groups!Each month, we highlight the new User Groups that have joined the community. It's been a busy season for new groups, because we are thrilled to welcome 15 New User Groups! Take a look at the list below, shared by the different community categories. If your group is listed here, give this post a kudo so we can celebrate with you!   We love our User Groups and the difference they make in the lives of our Community! Thank you to all the new User Groups, new User Group leaders--we look forward to hearing about your successes and the impact you will leave!   In addition to our monthly New User Group spotlight, it's a great time to share some of the latest events happening in our User Group community! Take a look at the list below to find one that fits your schedule and need! There's a great combination of in-person and virtual events to choose from. It's a great time of year to connect and engage with User Groups both locally and online. Please Welcome Our NEW User Groups   Power Platform: Heathcare Power Platform User Group Power Platform Connect Hub Power Platform Usergroup Denmark Mexico Norte- Power Platform User Group Pune Power User Group Sudbury Power Platform User GroupMicrosoft User Group GhanaMPPBLR - Microsoft Power Platform Bengaluru User Group Power Apps:   Myrtle Beach Power Platform User GroupAnanseTechWB PowerApps Copilot Studio: Pathfinders Power Platform Community Dynamics365: Cairo, Egypt MSD 365 Business Central/NAV/F&O User GruopMS Dynamics 365 Business Central LatamCincinnati OH D365 F&O User Group February User Group Events February 2024 Cleveland Power Platform User GroupPortallunsj - Februar 2024Indiana D365/AX February User Group MeetingQ1 2024 KC Power Platform and Dynamics 365 CRM Users Group 

Super Users 2024 Season One is Here!

   We are excited to announce the first season of our 2024 Super Users is here! Our kickoff to the new year welcomes many returning Super Users and several new faces, and it's always exciting to see the impact these incredible individuals will have on the Community in 2024! We are so grateful for the daily difference they make in the Community already and know they will keep staying engaged and excited for all that will happen this year.   How to Spot a Super User in the Community:Have you ever written a post or asked for help in the Community and had it answered by a user with the Super User icon next to their name? It means you have found the actual, real-life superheroes of the Power Platform Community! Super Users are our heroes because of the way they consistently make a difference in the Community. Our amazing Super Users help keep the Community a safe place by flagging spam and letting the Community Managers know about issues. They also make the Community a great place to find answers, because they are often the first to offer solutions and get clarity on questions. Finally, Super Users share valuable insights on ways to keep the Community growing, engaging, and looking ahead!We are honored to reveal the new badges for this season of Super Users! Congratulations to all the new and returning Super Users!     To better answer the question "What is a Super User?" please check out this article: Power Apps: What is A Super User? - Power Platform CommunityPower Automate: What is A Super User? - Power Platform Community Copilot Studio: What is A Super User? - Power Platform Community Power Pages: What is A Super User? - Power Platform Community

Top Solution Authors
Top Kudoed Authors
Users online (5,063)