Power Apps Reset a Gallery and varRecord instead of Selected
Вставка
- Опубліковано 5 вер 2024
- Do you ever need to "reset" your gallery but you then get confused by the selected item or how that affects the data in forms and other related controls? I bet you do. Good news I explain how to make it all better using varRecord and a couple of little changes to the way you normally build things. Pure gold here. 🥇
Power Apps Consulting and training at www.PowerApps9...
^Thinks about everywhere he uses gallery.Selected... Starts to cry...
Don't feel like you ahve to fix them all now. Just think of it as a troubleshooting step in the future. 😁
@@ShanesCows I don’t think I’ll fix anything. If it ain’t fixed, don’t broke it, is my motto.
Time, and time, and time AGAIN, I have found Shane describes things in common-sense ways that really "get the job done"! This video was a "life saver" for me this weekend!
Thank you! I was almost losing my mind until Copilot recommended watching this video to resolve my problem! AI says Shane Young 😃
Glad it helped and glad AI got it right 😉
If you have been struggling with this like me, the above video saved my current app and all future ones.
There was an issue I was getting. I had a different screen for viewing the results. All you need to do is add Navigate after the set varRecord, this will then pass the results to the view screen: Set(varRecord, ThisItem); Navigate(View)
[View is the name of my view screen]
Awesome David! Thanks for sharing. :)
One other way this helped is I have 2 galleries on one screen (respectively filtered by 1 of 2 status types) and they alternate their visibility based on a toggle switch, THEN the selected gallery item shows on a connected form on that same screen. With this solution, the form shows varRecord from whichever form with no issues! Thanks again Shane... VERY, VERY HELPFUL!!!
Glad this helped Shawn. It is nice to be in control with the variable. 🤩
Realized my morning before work has become learning something new from you Shane!
Awesome Ryan and cute pup!
Thanks Shane, varRecord fixed an issue I had that meant the edit form wasn't populating. Brilliant, as usual. Thanks mate.
Glad it helped!
Started using varRecord a bit over a year ago because of you, absolutely love it. Thanks for spreading the knowledge out there Sensei
Good job! 👍
I've been setting a variable on select for some time, but I never even thought of using it like that. Way awesome idea!
Thanks 😊 It is a great pattern to use.
I wish you would do a video showing a fully featured app that you build. Even if it has to be several different parts due to the length. I would love to see a really in depth building of an app. Sometimes it’s hard to grasp some of these concepts when they are done in pieces.
For my own selfish reasons I would like to see you build an app to OCR documents but I’ll take what I can get.
There is a 3 part series here ua-cam.com/video/xgznk4XlPCo/v-deo.html that actually has 3 more related videos afterwards. 😎
i had watched this a few weeks ago and ended up storing only the email instead of the record, because the display its pointing at is from a different table - but i DID run across a problem where you could add a record to the child table for the first person in the first gallery even tho they hadnt been selected - this caused problems with calculations after the update. The only thing I had to fix was to hide the 2nd gallery if nothing was stored in my variable - and also the 'add' button, and change the title. but thank you!
Glad you got it Cara! Thanks for sharing.
Hello Shane, again thank you for another great lesson on working with Gallery. You are right on the point to solve my question on how to reset the TemplateFill for selected item. A very smart solution.
Great to hear!
You can just set the default of the gallery to {} which is a blank record then when it resets then nothing is selected. 🙂
Cool trick!
how can i do that? im trying to do that but there is always an error
Thanks a lot, i am always watching those Videos and immediately trying it on my existing apps .
Awesome :)
Gidday Shane. I've been watching your video for about a year now - love your work but I missed this tip somehow. Lookkng forward to tidying up my OnSucces email variables! Cheers mate.
Awesome 🤩
This was great! Yeah, I had gallery.Selected EVERYWHERE which kinda' made me nervous that something would break somewhere. Thanks so much Shane!
Hi Shane! I did a universal replace of gal selected with var record. Worked great-thank you! The problem now is that when I patch something and my items go back into view mode, they are not reflecting the change anymore. Before, after a moment, my record items (I don’t use a form, but a free-form canvas linked to a gallery) would reflect the updated data after my patch. They don’t do that anymore, and I have to return to my gallery, reselect the item and then the record will show the updated information. I have my attachments in a form and it is not updating to show my saved attachment changes patch either. I’ve been at a loss for a few days on how to get that back.
Love your work Shane!
Thanks, I am happy it helps.
That’s genius and opens up many other ideas. Thanks, Shane.
Thanks. I should have covered this a long time ago.
I was trying to do this yesterday. Thanks Shane.
No problem!
Great way of thinking every day is a school day!
Thanks. I agree we always have to be learning 🐶
Thank You Shane , you are the max..! I can build a Gallery Menu using the same technique! Thank you again!
Awesome 😎
Exactly what I needed - thank you SO much Shane - you are amazing!
Awesome :)
Thank you, Shane!
Happy to help 😎
Hi Shane,
The video was very helpful.
How do i set the app to select the first record in the Galley by default when the screen opens? Thanks
Great tips and tricks indeed!! Many thanks Shane!!!
Glad you enjoyed it!
These tips were awesome and exactly what I need for my next project!!
Awesome 😎
Thank you so much Shane!
Glad to help.
Thanks a lot. That varRecord is gold.
I agree Paul, one of my favorites. :) 🐶😎
Just what i was looking for!!! Thanks so much!!!
Awesome 😎
Easy Pizy.. Japanizi.. Thank You Shane for Sharing.
You got it!
Thanks Shane...another great video!
Glad you enjoyed it
Great videos! Thanks for sharing!!!❤
You are so welcome!
Another top tip, thanks Shane !
You are welcome William. This was a solid one for sure. 😀
Hello Shane, you have a video on how to apply currency format, for example I need to use C$ with comma for thousands and point for decimals, thanks I have learned a lot in your channel.
Text(1235, "$#,##0.00") will output $1,235.00 ☺ Not sure I have a video specifically on it though. I will add it to the list. Good idea!
Shane, you rock! Can you do one on simulating a Pivot Table? Struggling with grouping by certain choice columns to summarize info from a Sharepoint list. Maybe I just needed to embed a powerBI. Trying to summarize by 3 “levels”.
Duplicate. 😊
Cool tutorial and tips. Many thanks for sharing them!
My pleasure!
Wonderful video, thank you Shane. I loved it.
So glad!
This was very helpful. Thanks Shane
No problem 🐶
What in the world would I do without you?
Fab! understand variables better... how can you use Search Text field using variables to search for items in the Gallery by two criteria? For example, I have a list of the projects with PM name and Region in a Gallery and I want a search field to select just these projects that are in US. Or search for projects that are assigned to Sam Smith as a PM
Smooth, very smooth. Thank you.
You bet!
Hi Shane! As always thank you for your awesome videos.
What if on your home page you had a button that said meet our Nap Taker - Is there a way to onselect navigate to your gallery an automatically select Chewy?
You can. You need to use Deep Linking ua-cam.com/video/A5Pi5P2YKds/v-deo.html They have changed one setting you will need from this video also ua-cam.com/video/7MxXmGOkeLQ/v-deo.html
Love the video and will definitely implement the varRecord idea. What are some of the pitfalls of using .IsSelected or .Selected? I'm just curious. Thanks for all you do!
Rashan the fear of IsSelected or Selected is if the data source is refreshed by any action it will reset to the top record. 😐 Not a common problem but does happen enough I don't use them.
Shane, you rock! Can you do one on simulating a Pivot Table? Struggling with grouping by certain choice columns to summarize info from a Sharepoint list. Maybe I just needed to embed a powerBI. Trying to summarize by 3 “levels”. Thanks!
Yikes. I have never done that. I will ponder on it.
Dam I wish was aware of this a year ago, Thanks Shane.
Hi Shane. Awesome video. One quick question: Why "Gallery.Selected" does not work for an edit form if both the data sources are pointed to a same collection? Can you please prepare a video on this?
Forms don't work with Collections.
Love your videos, informative and very easy to follow. Have a gallery based on a dataverse table that has lookups. I set the on select value of the gallery to Set(varRecordSelected,ThisItem) and get error msg "This formula has side effects and cannot be evaluated". Broken in Step 1 :-( I was using gallery.selected and it worked. Why does the variable not work for ThisItem?
I should add that I have the variable displayed in a text box (Text = varTSSelected.TSheet). If I set the variable to Set(varTSRecord,galTSHeader.Selected) the text box shoes the correct value. If I set the variable to ThisItem the text box is blank.
Hey Shane, I've followed your video's for a couple of years now and they've helped so much. I wanted to ask with the new price plans coming up a lot of large premium user apps are going to be completely unaffordable. We have one that would soon cost $250k per year which isn't sustainable. Do you have any thoughts on Microsofts cash grab and what impact you think it will have on the PA community?
I don’t Matt. What price changes have you heard about? I don’t think I hear of any?
The price plans for premium apps going to be $10 per user per month for use up to 2 apps. So any company using sale force or SQL etc will have to pay that. Or something like $40 per month for access to unlimited premium apps.
Change comes in October 2021.
There may be a few people like myself who are going to have to try and revert back to SP lists but worried about limitations with no alternative available.
Shane, the OnSelect() in the Gallery gets triggered only when the user clicks on it. But there are senarios where we select a item in the gallery dynamically (using the defaults property). In such cases using the varSelected approach will not work.
The same button that sets the defaults back could also populate the variable 😊
Nice trick. Think I need to make som changes here and there in my solutions ;-)
Thanks!
Hi Shane awesome video...
Thanks Stephen 😊
I just stumbled on this! I have a Records list screen (which has the gallery), a Record Detail screen to display the selected record on a View form and also it's child items, and a Record Entry screen for adding new record, or editing the selected record.
When I selected a record for edit, after successful submit, I want to navigate to the Record Detail screen and have it show the updated record.
But because it's Item property is Gallery.Selected, it always shows the first item, as the submit causes the gallery to refresh.
So I tried to use Set(varRecord, ThisItem) in the OnSelect property of the gallery, then have the View Form's Item property set to varRecord.
However, after submiting the changes, the View form remains showing the selected record, but values are before the submit.
So, in the OnSuccess event of the edit form, I do a Set(varRecord, frmEdit.LastSubmit).
This seems to finally achieved what I want. But I'm not sure if this is the best way of doing it. 😄
Ideally I wish there is a way to set the selected item of the gallery to the the one that was selected before, after the gallery is refreshed.
Thanks Shane this is great! Any idea how you would make the gallery item disappear after successful form submission?
You would need a field that tracks it has been submitted and then filter out all of the records in the gallery that have been submitted.
Hi Shane, again a great session ! What I'm struggling with is to force select the first item in a gallery after a filter condition has updated the items.
Maybe use the First function. If VarRecord is blank then set it to First(Gallery.AllItems) ?
@@ShanesCows The issue for me is that the gallery doesn't have an OnChange, where I could select the first item.
Excelent Tip, thank you so much
Glad it was helpful!
Hi Shane... Great video.
I am facing an issue with in PowerApps gallery about refresh after deletion of record. I am using an API as a custom connector and built a gallery with the data from it, deleted record is displaying on gallery until we refresh it manually.
Share me if you have any solution for it... Thank you
great video
Thanks!
Hi Shane, Thank you very much for all the tips!
I have a question for you , i have a gallery based on a data source and inside that gallery i added a dropdown on each item based on a different data provider and i want to use the reset function but i get and error "Name isn't valid. '{0}' isn't recognized." so i'm lost ahah
39 minute mark of this video I show you how to do it with a varialbe, which will work in your gallery. ua-cam.com/video/24A1h64vbgc/v-deo.html
Hi Shane, That was very helpful. The one thing I haven't been able to figure out is that I'm using a radio button choice list with my gallery and form. The gallery is an FAQ List and the form displays the answer. When a user selects the question and then chooses another category, it continues to display the answer for the previous question rather than the text label. How can I get the gallery to also initially just show the text label message when the user selects a radio button? I imagine I have to change the OnSelect property with the radio button.
Just found it! Change the OnSelect property of the radio button to Set(varRecord,Blank())
I've been trying to figure this solution out for MONTHS. This video was a life saver - thank you!!!
Glad you got it Lisa! 🐶
So handy! Thanks 😊
Yep. 😂
Man... I had my jaw dropped with so many things to explore and you say.. easy peasy lemon squeezy.. Thanks for this super awesme tricks
I have a snall request though. I hav a flow which reads excel and updates the sharepoint list.
The challenge is to show alias instead of email id ot lastname, first name for a person column. It says..."required info" even though the content is present. Did I confuse you?
This one ua-cam.com/video/QcWjAt7QVn4/v-deo.html
Hey Shane. Wonderful video. I am trying something and its not going well. I want to send an MS form via email on power Apps and get responses on Sharepoint. (Super Easy). However, I want to show the progress of whether a flagged form has being filled by having a gallery showing the status of either filled or not. I know automate can help here but a little bit stuck.A video would be awesome. Thanks in advance.
Interesting I have not done that scenario
@@ShanesCows looking forward.😊
@@ShanesCows Anything so far about this?
Shane, as always great info. Just started to use this way and I noticed some of the Templatefills are glitchy, might be due to large amount of data in the record, still working through this. One question though, if navigating from another Screen and I want it to select a record on load should I set the Record in the Onselect from the screen I am navigating from? - I may have answered my question while typing Thx anyway.
Yep that did it. Keep the videos coming. Thanks Heaps
Exxxxcelente!!!! The best!!! By Brazil
Thanks! :)
Hi Shane, I have Checkbox control in the Gallery control and would like to display all "uncheck" items when selecting a "Reset" button control. My Sharepoint list is Choices column with multiple selections. Any advise?
Hi Shane, this video is a life saver... I started to have several issues with the Selected techinque. Right now I am having an issue trying to use it with attachments though... it seems you cant access to the attachment using varRecord as you would in Gallery.Selected. Do you have any solution in that direction.
Thanks for your awesome videos!
What if we're not using Forms, but rather using Patch with fields on a canvas? How to load that Screen with those fields blank until a gallery item is selected?
When ever we create a new record that new record should only visible remaining records should not visible in gallery grid how to do it
You will need to find a criteria to filter on. Then filter the gallery.
Hi Shane! Does reset also in the background refresh the datasource?
It depends. Refresh is the function for forcing a datasource to update
Hi Shane, as always, great video. Is there any difference between setting varRecord the way you have done it in the video and setting it like this: Set(varRecord, Gallery1.Selected), i.e. for navigating to a form on a different screen?
Nope. Both are valid and will get you the same thing stored in the variable which is what matters most.
@@ShanesCows Good news! Thanks for the reply.
Thank you so muchhhh..
You're welcome!
Hello Shane, I am updating a SP List with updateif command with OnChange of a text input control, the issue I have is that the gallery (connected this SP in question) of the selected item resets and displays the 1st item in the gallery. All I want is to keep selected the item I originally 'selected'. Do you have a suggestion to achieve this?
If you use the varRecord concept we talk about in the video to replace gallery.selected then you don't have to worry at all :)
Shane I need your help. I made a barcode scanner app.. I have 2 text inputs in this app, To change focus from TextInput 1 to TextInput2 I am using SetFocus function, But after a scan I always have to press return/Done on the RF Gun to set focus on next TextInput field. How can I do it without pressing a button, When the TextInput1 gets any data then it should set focus to TextInput2. This will really increase the speed of scanning.
OnChange of the TextInput you could set the focus I would think. Haven’t confirmed b
@@ShanesCows Yes I have tried that. Added SetFocus function OnChange, But I still have to press Enter/Return after every scan, I wanted it to work like - Beep (Scan1)..Focus on Scan2 field without pressing any button.. This will save a lot of time as I usually have 50+ items to scan.
Really really appreciate you replying to my comment!!
I need to set my gallery default item.
lookup(datasource, status.value = "approved") does not work
how do i fix this?
Should be fine. Store the results of the lookup in varRecord and then do as shown in this video.
Hi sir , How can I hide empty data rows in "Gallary control "?
Filter(yourdatasource, field = "") would work for a text field for an example.
Hi, Shane Great videos as always. One question when you select a record in your gallery your selection does not move .... I have set up my gallery with the same setting, but when I select a record it moves the records up in the gallery window. For example, when you select yourself in the gallery, you can still see Nicola and Greg's records. When I select a record it will move the gallery up so that would have to scroll up to see Nicola and Greg's records. Other than that very works just you have in your video.
Hi I am using variable but data is not coming ,in gallery created on variable and calling in next screen display form in item property varriable no error but still no data
Hi shane, i've got the challenge. 2 different lists, List A with column Vnr en List B with column WBS, both containing a accountnumber. I want to use list A : projectname and from list B: the finance informatie for that project in a form, by compare Vnr=WBS.Maybe its simpel, but I dont get it done. Hope you can help me. Regards, Arthur from The Netherlands.
Gallery of List A - label:Lookup(listB, accountnumber = ThisItem.account number).WBS
@@ShanesCows with label you mean Onselect: LookUp(ProjectFinancien, WBS.Value = ThisItem.Vnr.Value).WBS
Select(Parent);
Set(varuang,LookUp(ProjectFinancien, WBS= ThisItem.Vnr).WBS)
But what do I do with the form. Item=???
@@mr.arthur5776 A form cannot modify two different lists. So you form Item needs to return a record that matches the table the Data Source for the form is set to.
@@ShanesCows yes I know, I've got a gallery listA and a form listB. Onselect ListA with a LookUp should return a record, but how can I match it with the form ListB. In ListA Vnr has the same values as in ListB WBS. So a Lookup Vnr=WBS should give me record with result a view from ListB in the form. But I can not link the gallery to the form. I'm missing something.
Hi Shane! Need your help! I'm using a variable to select the item from a gallery which routes a user to another screen displaying the form. When the user submits the form, it will update the record and retain the selected item. I'm using lookup on the items property of the form to capture the variable ID. However, if they click to edit the form again and resubmit, the item becomes deselected.
Any ideas on why this might be happening? I've combed forums for nearly a week now looking for a solution with no luck.
Thank you Shane san 😍😍
I got you! 😎
Does the varRecord approach also work if a SharePoint List item has an attachment?
It should but I don't do a lot with attachments so I can't say I ever checked.
Hey Shane, great video! I have one wrinkle that you didn’t cover and I’m hoping you can help.
I set my form visible properties to !isblank(varRecord) and my label visible to isblank(varRecord). When I click on my button that is set to create a new blank form to enter a new record, the new form isn’t visible. What am I missing to get the new form to be visible?
Thank you!
What are you setting varRecord to, if anything, when you are creating a new record?
Set(varRecord, Patch(…)) puts the newly created record in the variable.
@@ShanesCows thank you! Sorry for a dumb follow up question, but here it goes. What am I putting in the Patch function? I realize you don't know anything about my app, but I'm essentially trying to mimic Laura Roger's dynamic approval travel app, but for purchase requests in my Air Force squadron.
Thank you so much for sharing Shane! I have a question... Im working with collections to be displayed in a gallery to collect different milestones. but once the user has finished working on it and click on submit i want the gallery to reset to blank so that other user can work on it. is that possible ? Im still learning :), thank you again!
Clear(collectionName) would set it back to blank.
In gallery label , can we take variable which hv some calculated values?...I hv tried but it's giving err n I m not able to do..pls suggest
Shane, how can you set the first item in the gallery to varRecord when you select the reset button? That way Nicola's record would be displayed on the right?
Set(varRecord, First(Employees)) Would work for my data source. :)
@@ShanesCows you rock!
Shane, really enjoy your videos. One issue that I am seeing is that varRecord does not consistently change when I select another record in the gallery.
Try setting OnSelect of the gallery to the Set formula.
Hi Shane.. I tried this approach.. where One screen I have a gallery..when I click on edit button present as gallery Item.. I follow your steps as mentioned in this video...then I navigate to another screen.. which opens the form.. now letter when I come back.. using side navigation bar to navigate to gallery screen.. On Screen Visible I Reset Gallery & Set Record to Blank.. But somehow this is breaking.. can you please share insights on why this behaviour might not be working? I also tried adding a button which does the same as Reset Gallery & Set Record to Blank.. and On Screen Visible.. I select the button.. yet this is also not working..
Hi Shane, i am struggling with the simplest of tasks. I have a data source that is a stock list and over a period of time the value of the stock reduces. Then i would like to reset all the stocks to a start number (eg 100). I have a gallery of the data source with the item and the stock, i can change these stocks manually. How then do i patch ALL the new stock values back to the data source. I have tried ForAlll and i am failing miserably? Thanks
Hi, what formula will be for save, back and new item please? Thank you
Robert not sure what you mean?
@@ShanesCows Hi, I made a save button as “submitform(form1) but doesn’t work. Thanks for your reply
Shane, do you know of a way to go back to the first item in a gallery by selecting an icon (like a to top in a website?)
Follow this video and have the button set(varRecord, first(list)) 😎
@@ShanesCows Thank you. I knew it would have to be easier than I was making it. Usually is. Sigh.
Hi Shane. How do you deal with Form Submission? After submitting the form, how do you "refresh" the varRecord to have the new changes submitted? (Working with Sharepoint as a database)
Form OnSuccess Set(varRecrod, FormName.LastSubmit) 😀
@@ShanesCows Great!! this was exactly what I was looking for but my save button does not reset my gallery, my form is the last submitted but my gallery shows first record with template fill instead of keeping the varRecord
Thanks so much! I have two galleries from the same list. The 1st gallery is in the main screen, I needed to group the gallery by division (department) but since department is a choice I needed to set the group and I used this on the ITEMs in the gallery to get it working GroupBy(AddColumns('Department of Pediatrics Team List', "DivisionGroup", Division.Value), "DivisionGroup", "DG". On my second screen, the gallery shows the name of team members when Items is Gallery1.Selected.DG. Also, on my second screen I have the form control to toggle between view, edit and new form mode buttons. The problem is that when I go back to screen 1 and select a different division/department, the form view shows the information of the previously selected record in another division/department but it changes as soon as I click in a new name from another division/department. How can I have the form reset or not show up for view but only after i select the name? I tried doing what you showed with !isblank()...but i can't seem to hide the view mode. Also, my save button in edit mode onsuccess shows lastsubmit record on viewmode but my gallery goes back to the first record in the first department and for some reason they are not linking to be the same. Any help?
Hey Shane, very helpful videos! I have a question here. I'm trying to make a button visible to managers only (and we have 100+ managers in the company( ° △ °|||). I know from your previous video that I can make a button visible to a specific person by setting up "visible = If(User().email = "this person's email address", true, false)". Is there anyway that allows me to make a button visible to a group of people without having to add their email addresses one by one? Thank you!
I think it is this app I show how to do it also by doing a lookup against a list of people. ua-cam.com/video/0MB-z9cyFCQ/v-deo.html
I switched my design to varRecord .. now i cant upload my attachments any longer 😅 .. the upload is broken
Boo. Hope you figure out why.
It was an easy fix.. return to the old state till i fully understand the attachment upload 😁
Thats a tricky homework :).. first i found nothing was wrong with the upload . The only thing whats not happening is the refresh of the edit fields .. when using gallery.selected it gets triggered automatic . When using varRecord the Data in the Attachment field don’t gets refreshed after the upload. It seems putting the gallery.selected in a variable creates more problems than it solves
Isn't easier is to set default to {}
It sets default to empty and no need to call another variable...
I love qtt
Thanks! They love you back. 🥰
6:14 🤣👌🚀
I love that saying! 🍋
👍
🙏 🐶