Don't use PowerApps Gallery Selected Item

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 69

  • @beatgruring7519
    @beatgruring7519 Місяць тому +1

    Thank you. As always, a great video. Instead of showing "Please select an Item to continue" I prefer to save the previously selected item and revert back to it if the user cancels the form.

  • @stevenned23
    @stevenned23 2 місяці тому +1

    What a superb video again Shane. I'm so happy with this info!! I changed a view apps I created lately.
    Thanks a lot, from a rainy and grey Netherlands.
    Regards, Steven

    • @ShanesCows
      @ShanesCows  Місяць тому

      Fantastic! Have a great weekend 😎

  • @craig.galbraith
    @craig.galbraith 2 місяці тому +5

    "Evil trash can" gave me a much needed Monday morning chuckle :)

    • @ShanesCows
      @ShanesCows  2 місяці тому

      That is the fun, you never know the dumb things I will say 😂

  • @jeromemartin8830
    @jeromemartin8830 Місяць тому +1

    Thank you for the video. Excellent as always. Sometimes I use your method for my needs. But why don't you use the Default property of the gallery? If you set it to '{}', you just have to use 'Reset()', and that works. Using a variable is better when you change screens, but that's not the case here.

    • @ShanesCows
      @ShanesCows  Місяць тому

      Totally could do that. Just wasn't were my head was when I was building this one. 😎 That is the fun of Power Apps different ways to do different things.

  • @SJo-ss6yr
    @SJo-ss6yr 2 місяці тому +1

    Thank you for this valuable information, same recommendation as Wonder Laura is doing in one of here Power Hour Sessions. Sharing is caring and Community Rocks!

    • @ShanesCows
      @ShanesCows  2 місяці тому

      Laura is awesome. Didn’t know she showed it in power hour recently. My first video with it was 3 years ago. 😎

  • @lowcodedev
    @lowcodedev 2 місяці тому +1

    This is insightful! Thanks for the tutorial

  • @nyrrik1337
    @nyrrik1337 2 місяці тому +1

    Hi love your vids! Could I maybe suggest making a video on how to implement a two sided swipe to confirm/delete an item in a vertical gallery? Im interested what you could come up with your insight :)

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      I have never really thought about it. In my head there isn't a great way to do it. But if I come up with something I will be sure to share. 😎 Thanks for the idea

  • @generice3398
    @generice3398 20 днів тому +1

    Hey @ShanesCows, thanks again for a great lesson. One question. What if i'm using a Table control instead of a gallery? If I try to assign varRecord: ThisItem on the Table OnSelect, I get "ThisItem isn't recognized" error.

    • @ShanesCows
      @ShanesCows  18 днів тому +1

      I am not sure. I rarely use Data Tables. :( They have a bunch of weirdness, like what you are describing. :( Sorry, I got no help.

    • @generice3398
      @generice3398 8 днів тому

      @@ShanesCows No worries, I figured as much, but wanted to make sure I wasn't missing something. Thanks again!

  • @a1t0rmenta
    @a1t0rmenta 2 місяці тому +8

    Just when I thought I had 1% of Power Apps under control...

    • @ShanesCows
      @ShanesCows  2 місяці тому

      At least .9%? 🤩 Keep working, so much cool stuff to learn.

  • @AdiCristea
    @AdiCristea 2 місяці тому +2

    Best way to deal with Gallery.Selected! Thanks, Shane!
    PS. Have you noticed the removal of Fill property in modern buttons? :)

    • @ShanesCows
      @ShanesCows  2 місяці тому

      I have, it makes me sad. 🥲 DelayOutput missing on Text Inputs was one someone pointed out this morning. He asked me for a work around and I had no idea 🥲

  • @gaeb-365.online5
    @gaeb-365.online5 Місяць тому +1

    Hi, Thanks four your great videos, Shane. I want to point out that in a scenario, where you e.g. have buttons to perhaps trigger a workflow which is updating the items in the SharePoint List directly I might need to call Refresh(list) to update the data. Then your approach does not work because the locRecord variable does not update to the new data. I cannot find any hook where to update that. If you manually switch items then everything is okay, but that is not what I want to see. If the user clicks the button, the workflow runs successfully I want the user to immediately see the updated data.
    Any Ideas to that?

    • @ShanesCows
      @ShanesCows  Місяць тому

      After you do the Refresh then Set(varRecord, Lookup(datasource, ID = varRecord.ID)) this will get the refreshed version of the record in your variable.

  • @antonlohmayr1719
    @antonlohmayr1719 2 місяці тому +1

    Love your videos. I was wondering why you dont set the gallery default to {} and add a reset Gallery command to the new and unselect button. Is there a specific reason?

    • @ShanesCows
      @ShanesCows  2 місяці тому

      Nope, I have never tried that way. Interesting. I still enjoy my variable control and using it across multiple screens but I will try your way next time and give it a look. Thanks

  • @TheKermit2110
    @TheKermit2110 2 місяці тому +1

    love it! As i've watched you over the years, i've seen you advocate for this method but was never clear why. Now i am !! BTW, how would you default to the 1st record in Gal (in view mode) instead of the option your students opted for with the instruction to select an item? Cheers from the friendly frog!

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      Glad to help my green friend. UpdateContext({varRecord: First(Gallery1.AllItems)}) on your cancel/view actions. 🤩

    • @TheKermit2110
      @TheKermit2110 2 місяці тому

      @ cheers buddy

  • @StephanOnisick
    @StephanOnisick 2 місяці тому +1

    Another key solution. Thanks!

  • @MrHeadbytes
    @MrHeadbytes Місяць тому

    Hi Shane. Love your videos. I am new to PowerApps and working on implementing a lot of your suggestions in my first couple of apps. This one is great and has helped a lot. I am confused with a delete button. I have this function on my Delete button. After the record is deleted, the form still shows the remnants of the deleted record. How do I fix this?
    UpdateContext(
    {
    deleteMode: true,
    deleteCancelled: false,
    selectedRecord: RecordsGallery1.Selected
    }
    )
    I have tried changing RecordsGallery1.Selected to varRecord and it still seems to delete the record but still has the remnants of the deleted record.

  • @shawnsiegrist3632
    @shawnsiegrist3632 4 дні тому

    I'm not using a form, I prefer individual controls and Patching the records. One of my controls is a modern drop down, the SharePoint column is a single line of text, when I add varSelectedRecord."Column Name" to DefaultSelectedItems I'm getting an error. If I use a choice column in SharePoint then everything works, but I recall you recommending using single line of text columns whenever possible in SharePoint. Is there a way to use your varSelectedRecord technique with a drop down control and single line of text column in SharePoint? Thank you!

  • @Bekesam
    @Bekesam 2 місяці тому +1

    Well done, thanks Shane. "IsSelected", pulled out a lot of hair on that one.

    • @ShanesCows
      @ShanesCows  2 місяці тому

      Glad this helped. Got to save that hair, as we get older it falls out enough on its own. 🤣

  • @muhannednidal3647
    @muhannednidal3647 2 місяці тому +1

    Excellent method 👏🏻👏🏻👏🏻

    • @ShanesCows
      @ShanesCows  2 місяці тому

      Thank you! 🙂 It makes Power Apps a lot easier when you control everything. 🙂

  • @muhammadzikrilhakim200
    @muhammadzikrilhakim200 20 днів тому +1

    HI Shane. I am new with Power Apps and I want to ask. Can I use this method to replace table.selected method?

    • @ShanesCows
      @ShanesCows  18 днів тому

      Maybe. I don't use Data Tables very often, so I have never tried BUT I think the pieces are there.

  • @christianberger6390
    @christianberger6390 Місяць тому +1

    Très intéressant

  • @paolovr1970
    @paolovr1970 2 місяці тому +1

    Great Shane thanks

    • @ShanesCows
      @ShanesCows  2 місяці тому

      You are welcome, have a great weekend.

  • @andrewhess123
    @andrewhess123 2 місяці тому

    Good points Shane! Nice!

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      Thanks Andrew! Have a good week dude.

  • @alexcamilleri3997
    @alexcamilleri3997 2 місяці тому +1

    Would you recommend to use a Gallery Control inside a Component? If so, would this make things easier with dynamically retrieving fields?

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      It depends on the scenario. If a gallery is going to be reused exactly the same then yes a component makes sense. But if each one is unuqie then it would be more trouble than it was worth.

    • @alexcamilleri3997
      @alexcamilleri3997 Місяць тому

      @@ShanesCows Thanks for your perspective!

  • @EMiller500
    @EMiller500 2 місяці тому +1

    By the way, what's up with those "extra rectangle things" that they add in to gallery templates? Do they serve some special purpose, or have some kind of different functionality? Do I lose anything by deleting them?

    • @ShanesCows
      @ShanesCows  2 місяці тому +2

      They are just visual markers. You can delete them with no ill effects.

  • @automan25
    @automan25 Місяць тому +1

    When I try adding the UpdateContext code to the OnSelect event on a gallery it does not store the record in the varRecord variable. I followed the tutorial to the letter. Any idea why this might be happening? Is there a app level setting I need to enable?

    • @automan25
      @automan25 Місяць тому

      It seems I was using a "Vertical gallery" component instead of a "Blank vertical gallery" component. Not sure why the former doesn't work with this method, but switching it solved the problem. If anyone knows the point of using a "Vertical gallery", I'm all ears.

    • @ShanesCows
      @ShanesCows  Місяць тому +1

      That is really weird. I don't know why the first wouldn't have worked 🥲

  • @oluwatobiyusuf
    @oluwatobiyusuf Місяць тому +1

    Thank you Shane

    • @ShanesCows
      @ShanesCows  Місяць тому

      Thanks. Have a great day.

  • @rrtornado
    @rrtornado 2 місяці тому +1

    Game changer once again

  • @aaronsleezer2589
    @aaronsleezer2589 Місяць тому +1

    What is the formula for Edit Record?

  • @tomrichardson7792
    @tomrichardson7792 2 місяці тому +2

    Using the selected gallery can cause issues with resetting controls. Just doesnt seem to work with some apps. Variables are the way.

    • @ShanesCows
      @ShanesCows  2 місяці тому

      Agree Tom. More control is always better. 🤩

  • @ryankristofferliray8950
    @ryankristofferliray8950 Місяць тому +1

    I encountered a problem. When clicking on the gallery, the selection will not trigger the template fill when you click on components in the layout template, im using blank layout gallery and adds components on it. But when you click on the layout template outside those text box , image, The selection template fill color is okay .

    • @ShanesCows
      @ShanesCows  Місяць тому

      Set the Gallery OnSelect property to be Set(varRecord, ThisItem)

    • @ryankristofferliray8950
      @ryankristofferliray8950 Місяць тому

      Already did that.. idk the reason. What i did was that i put a container behind all components in the template of the gallery list

    • @shawnsiegrist3632
      @shawnsiegrist3632 4 дні тому

      @@ryankristofferliray8950 Add a button to the container, set the width to parent.width and height to parent.height, set the X / Y to 0, and under "Style and theme" for the button set Type to Transparent. Now set the buttons OnSelect property to Set(varSelectedRecord."Gallery Name".Selected). Hope that helps!

  • @maddiebeatz98
    @maddiebeatz98 2 місяці тому +1

    If I have multiple gallery's do I just name them different variables, but it will work the same or is this one use only?

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      Yes. I have plenty of varRecord2 in the world. The more the merrier 🤣

  • @syedhussain6393
    @syedhussain6393 2 місяці тому +1

    I am little confused regarding title of this video, title should be "Don't use PowerApps Gallery ISSelected Item" or "Don't use PowerApps Gallery Selected Item"? because you are still using gallery.selected to show selected item from gallery to form if I am getting you correctly.

    • @ShanesCows
      @ShanesCows  2 місяці тому +1

      No, the Item property of your Form should be varRecord when you switch everything over. 🤩

    • @syedhussain6393
      @syedhussain6393 2 місяці тому

      @@ShanesCows I missed that :) thanks