Power Apps Patch Record Variable + Trim, Len, and Troubleshooting

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024
  • In this video, you will learn how to patch a Record Variable in PowerApps. And along the way you will get to see the data problem that caused me to figure how to do this and the usage of Trim and Len functions. Lots of Fun!
    Power Apps Training at training.Power...

ความคิดเห็น • 77

  • @davidnelson579
    @davidnelson579 หลายเดือนก่อน +1

    You are a life saver!!! I just spent more hours than I care to admit trying to figure this out. You have been such a tremendous help to me on so many occasions. Thank you, Shane!

    • @ShanesCows
      @ShanesCows  หลายเดือนก่อน

      Glad to help. This video was an odd, so glad it was the piece you needed.

  • @ImranAmiKh4n
    @ImranAmiKh4n 2 ปีที่แล้ว +1

    Genius. Was about to spend likely 4 hours figuring out a solution to a specific problem but then wisely checked if you had cracked it already. Thank you!

    • @ShanesCows
      @ShanesCows  2 ปีที่แล้ว

      Glad to help. 😀

  • @samaritanlucas8680
    @samaritanlucas8680 4 ปีที่แล้ว +1

    When I applied the patch variable method in this video, my apps started freaking out and saying the variable now was an incompatible type. Every time I set the variable from a gallery with ThisItem, Power apps recognized it as a record type variable. When I tried to patch the record with Set(Variable, Patch(Variable... , Power Apps recognized it as an Error type, which broke everything.
    After a little testing, I think I found a different way to patch a variable. With this method, you aren't actually "patching" the variable, but rather resetting the variable with the updated value that was edited. the formula is:
    Set(Variable, Lookup(Source, UniqueIDField = Variable.UniqueIDField))
    This seems to work for me and PA doesn't get all freaked out.
    Thanks Shane for your great videos, tips, and troubleshooting! You are a great teacher.

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Glad you got it. We use this a lot and it works but one of my customers had a similar error. 😕 Still not sure why.

  • @jray1429
    @jray1429 3 ปีที่แล้ว +1

    Thank you very much…Showing is how you troubleshoot is very helpful!
    As you know, we spend a LOT of time doing that. It’s good to see how others do that. Thanks!

  • @patrickcooley9708
    @patrickcooley9708 4 ปีที่แล้ว +1

    Shane, so many good quotes in this video "it's okay to blame PowerApps" was one that made me laugh...also the one about getting out your abacus to come up with a solution. You have a gift of teaching this stuff to the frustrated and struggling. I appreciate how real you make it!

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Glad you enjoy my goofiness Patrick. Thanks 🙏

  • @tommyhamilton1520
    @tommyhamilton1520 4 ปีที่แล้ว +5

    Love these types of videos, real world problems. Great fix.

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว +3

      Thanks Tommy. Showing my pain seems to help a lot of people. 😀

  • @headflask
    @headflask 3 ปีที่แล้ว

    The reminder that the patch needs to get set saved me a bit of time. Luckily I stumbled on it when I needed it. Thanks.

    • @headflask
      @headflask 3 ปีที่แล้ว

      And I do use these function nitty griity videos a lot. Just need to make sure my weird search matches your metadata.

  • @puppydood
    @puppydood 3 ปีที่แล้ว +1

    Thanks Shane. Everyone needs a nerdy friend. 😊. Troubleshooting tips are so helpful.

    • @ShanesCows
      @ShanesCows  3 ปีที่แล้ว

      Absolutely! 🐶

  • @troybarrett235
    @troybarrett235 4 ปีที่แล้ว +1

    Thanks Shane! I had a similar problem when sending info to power automate where the convert file type didn't like the space. The trim function has just solved that! Life saver :)

  • @ronbakker1300
    @ronbakker1300 ปีที่แล้ว +1

    14:15 Oh the misery you have saved me Shane, thanks again.

    • @ShanesCows
      @ShanesCows  ปีที่แล้ว

      Happy to help 😎

  • @leonelbraga5427
    @leonelbraga5427 4 ปีที่แล้ว +1

    You are the best, Shane!

  • @HenriqueSilvestre
    @HenriqueSilvestre 4 ปีที่แล้ว +1

    Thanks a million Shane for showing me that I'm not the only one blessed with those weird power apps behavior! :)

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      It is a fun game for sure!

  • @jray1429
    @jray1429 3 ปีที่แล้ว

    PowerApps seems to have more difficulty with it working correctly when developing things. I too, have found something that doesn’t work and then I wait a minute, or take the code out and put it back in, or reboot it…. Then amazingly it might work!
    Considering it’s basically all web based and no local application, like having Visual Basic, power apps works amazingly well. I’m surprised it doesn’t have more hiccups or attitudes. I like it a lot!

  • @MrJonbuoy
    @MrJonbuoy ปีที่แล้ว +1

    Hi Shane, odd question on Patching. Can you use a variable column name in a Patch function so you can Copy/Paste the same function to all fields on an edit form? Something like onchange UpdateContext({ctxCurrentColumnName: Parent.DataField});
    Patch(
    Data source,
    Record to update,
    {ctxCurrentColumnName: Value(Self.Text)}
    );
    Or is this a step too far?

    • @ShanesCows
      @ShanesCows  ปีที่แล้ว

      Doesn't work Jon :( There is a lot of that clever stuff I have tried with not luck. Sorry

  • @mblherry
    @mblherry ปีที่แล้ว +1

    Thank you sooooo much I have being pull my hair out with this.

    • @ShanesCows
      @ShanesCows  ปีที่แล้ว

      You are so welcome!

  • @asifkhawaja
    @asifkhawaja 4 ปีที่แล้ว +1

    Another nice one Shane!

  • @WhatIsThis.WhyDoINeedIt
    @WhatIsThis.WhyDoINeedIt 3 ปีที่แล้ว +1

    Love your videos Shane, it's helped me on many occasions.
    I have a strange issue with patch...
    I have used a hybrid editform and submit form and the patch function on different button selects.
    I select a item from a combox, I then press a button that creates a new record in SharePoint with the item name and current date time. I then get taken to a form with multiple controls and toggles etc. I have an update button that patch's the form when the user needs to update the record but can continue completing the form until they press the submit button.
    Basically the patch sometimes works and sometimes does not.
    I'm guessing it's an issue with the lookup of the record title that is the problem.

    • @ShanesCows
      @ShanesCows  3 ปีที่แล้ว

      I would also guess you have a lookup issue. 😑 With SharePoint I like to use ID for the lookups

  • @ziadhamandi3595
    @ziadhamandi3595 4 ปีที่แล้ว +1

    That is fantastic Shane! I use the unique ID in the SQL tables, set to a variable of course, to define my selected Gallery. Your solution seems to be a better option. Thank you. Can you please address the SQL DateTime issue with PowerApps? That is one that I continue to have issues with. Thanks again.

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      I do need to cover that one. I will put it back on my list.

    • @ziadhamandi3595
      @ziadhamandi3595 4 ปีที่แล้ว

      @@ShanesCows Thank you.

  • @arupjt
    @arupjt 4 ปีที่แล้ว +1

    Hey Shane! This doesn't work for me. I am setting a context variable on the 1st screen and passing it to the 2nd screen on navigate. Here the attributes of the record variable serves as my default selected items for some controls . On "OnChange" of one control, I need to patch one of the record variable attributes to blank. I tried out the formula that you showed here , but it doesn't work. Did you do any settings changes for it??

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      I did not change anything. Try to recreate my exact demo and see if it works.

    • @arupjt
      @arupjt 4 ปีที่แล้ว +1

      I see its creating a different column in the record. My source is sharepoint and the column name in sharepoint has a space in between. I guess powerapps do not recognize the space and hence treated it as a different column..thinking of doing an addcolum to the variable where i can set the column name and use the new column instead of the sharepoint one..

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Use ‘column with space’ single quote helps

  • @ToddWheeler253
    @ToddWheeler253 ปีที่แล้ว +1

    OMG YES!!!! Thank you!

    • @ShanesCows
      @ShanesCows  ปีที่แล้ว

      You are so welcome!

  • @gabrielbraz9669
    @gabrielbraz9669 2 ปีที่แล้ว

    I am having a problem with something similar to this. I have a variable that stores the record from a dataverse table, so the column is named after the dataverse column id (ex: "cr590_title"). When I patch to the dataverse like this { Title: "This is a title" }, it works, the correct column is updated. But I am trying to patch to the variable, in this same way, and when I checked, the variable had a new column, (ex: "cr590_title" and "Title"). So it is not updating the right column, it does not even let me use the id name for the column. DO you have any ideia how to fix this?

  • @williampurcell606
    @williampurcell606 2 ปีที่แล้ว

    Hi Shane,
    First want to start by thanking your for all that you do. I have learned so much from your videos. I was wondering if you can help me with a Patch question. I have a form that I am using for people to view information on products. I have set the data cards to be visible only if there is a value and is not blank. I want to be able to patch into the data card only if that data card is blank, if it is not blank I want a different data card to get the patch. Is this possible?

    • @williampurcell606
      @williampurcell606 2 ปีที่แล้ว

      Hi Shane,
      I wanted to say thank you again. I was actually able to figure out the code I needed to make this work. It took a few hours of giving up and coming back and trying again. I had a few codes that worked, but did not give me the result I was looking for. I saw in another video of yours, you mentioned if a code works, but isn’t 100% what you want you can just add the // and revisit it later if necessary. Well, this is exactly what happened I changed a few things to a pending code and it worked out perfectly. Thank you

  • @jyothisrinivas6637
    @jyothisrinivas6637 4 ปีที่แล้ว +1

    Nice video and also learn new things from it.

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Glad to hear that

  • @magdialameen7960
    @magdialameen7960 4 ปีที่แล้ว +1

    Can you please add a video about running total in PowerApps. Thank you!

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Look for my video on Sum. th-cam.com/video/DF4KX1oSrVI/w-d-xo.html

  • @gerfer6261
    @gerfer6261 4 ปีที่แล้ว +1

    Cool , keep coming

  • @franciscolopes8337
    @franciscolopes8337 4 ปีที่แล้ว +1

    Hello Shane! I'm from Brazil and I developed an application on power apps for my research program in my University, can I register the code of the application?
    Wich programing language does the powerapps use?

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      I am not sure what you mean by register. Power Apps don’t run stand-alone outside of Power Apps.

  • @rivernet62
    @rivernet62 4 ปีที่แล้ว +3

    "Four hours in and that's where the madness starts." I'm way ahead of you. I can get to madness in minutes.

    • @rivernet62
      @rivernet62 4 ปีที่แล้ว

      Most recently I was scooping up some data fields that were not behaving at all right, and came to find that each one had a CRLF at the end :(

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Crazy how a little bad data can drive us crazy :)

  • @beatecno
    @beatecno 4 ปีที่แล้ว +1

    Hi Shane, I need help.
    I am creating a collection from a connection to a view of my SQL. However, this view has an invoice filter where I look for the products in the table. When I'm creating the collection, I don't know how to search for my invoice.
    I did it as follows
    I created a button, and on that button I made the following formula
    Collect(ExibeProd; Filter('[dbo].[PA_PROD_NOTA]';DataCardValue1.Text = NOTA ))
    DataCardValue1.Text is the field where the user places the note number
    [dbo]. [PA_PROD_NOTA] is the name of my view in the database
    ExibeProd is the name of my collection.
    The problem is that not all fields in my search are filled in the collection. [NOTE] column only

    • @MrXankiller
      @MrXankiller 4 ปีที่แล้ว

      You can't filter results with text inputs
      If your invoices are all integer, you should use
      Collect(ExibeProd; Filter('[dbo].[PA_PROD_NOTA]';Value(DataCardValue1.Text) = NOTA ))

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว +1

      Thanks for the assist 😻

  • @paolovr1970
    @paolovr1970 2 ปีที่แล้ว +1

    Yes 🙏🙏🙏 thanks I need this trick today 😎😎😎 cool

    • @ShanesCows
      @ShanesCows  2 ปีที่แล้ว

      Glad to help. 😀

  • @danielbell9192
    @danielbell9192 4 ปีที่แล้ว

    Hi Shane,
    I have a gallery where I’m using groupby. When the gallery item is clicked it takes you to another gallery where I am then showing the ‘DATA’. I am wanting to have a trash can so that I can remove an item from the ‘DATA’ and the data source which I have managed to do, however I can’t get the VarRecord to update so that the gallery resets itself and doesn’t show the item I have just deleted. I have tried what you do in this video by setting the VarRecord to a Set(VarRecord (Remove(VarRecord.DATA,thisitem)) but no joy. Any thoughts. When I run the above without the Set it does successfully remove the item from Data, but I can’t get the gallery to update. Any thoughts? Ta

  • @sundrapillay6668
    @sundrapillay6668 4 ปีที่แล้ว +1

    Thanks Shane much appreciated can you create a Covid 19 App return to work and and desk allocation

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Desk allocation is interesting. I did do a form covid solution th-cam.com/video/462l8JuJ9xM/w-d-xo.html

  • @mappingman
    @mappingman ปีที่แล้ว

    They aren't spaces that are being passed by SQL. I have this problem with an export I receive. I look at it in NP++ and the character is hidden not a space. I still don't know what the character is. So this may be why you can't reproduce the incorrect data. What ever application they are using to enter the SQL data is injecting these hidden characters.

  • @mvos1980
    @mvos1980 4 ปีที่แล้ว +1

    Hi Shane, Create video!
    The real problem is the application that writes the data in SQL. Before writing the data to the database they must trim the data.

  • @charlesjohnston1575
    @charlesjohnston1575 4 ปีที่แล้ว +1

    Hi Shane, Is there a way to access a local network file from a powerapp?

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว

      Yes via the on-premises data gateway. I have never done it but I know others have.

  • @yutikapatel5995
    @yutikapatel5995 3 ปีที่แล้ว +1

    How do you patch a record if new or upate a record if it is already in sharepoint?

    • @ShanesCows
      @ShanesCows  3 ปีที่แล้ว

      Use this video to see if a Duplicate exists. th-cam.com/video/Ap3_Ea9H8b0/w-d-xo.html

  • @rodrik90
    @rodrik90 ปีที่แล้ว

    i think that the Set patch does not work anymore... now it just adds a new line in the record with the same name and different data

    • @ShanesCows
      @ShanesCows  ปีที่แล้ว

      I just did a test and it worked the same for me. :(
      Set(varRecord, Patch(varRecord, {Department: "Test"}))

  • @dimaignatiev6370
    @dimaignatiev6370 4 ปีที่แล้ว +1

    Did Bold Zebras have become PowerApps?...

    • @ShanesCows
      @ShanesCows  4 ปีที่แล้ว +1

      Kind of. More PowerApps911 spun out of Bold Zebras when we decided to become more focused on the Power Platform.