Better Performance with Less Effort! Use Power Apps Named Formulas

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ต.ค. 2024

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

  • @benmichels1977
    @benmichels1977 10 หลายเดือนก่อน +17

    I work with a lot of really big collections, 7 to 12 thousand rows, with 20 columns depending on the day and data. Named formulas is substantially faster handling such huge collections, applying filters, handling groups, performing calculations and in generally making everything smoother. It’s now become the “if I can put it in named formulas, it’s going in named formulas, if I can’t, can I change how I, doing things” it’s just an enormous performance improvement.

    • @benmichels1977
      @benmichels1977 10 หลายเดือนก่อน +5

      One I rather like is using it to search/filter/lookup as it can be used to return a row based on a value in a search box/form control settings then you just reference that tiny formula name with the column name to display the data or perform whatever. It ❤is substantially faster, especially developing screens.

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

      Awesome. Thanks for sharing. 😀

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

      I remember that’s what I wanna do previously (even before the named formula becomes generally available). Thanks for sharing Shane Young!

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

      As i know, there are delegation limits with formula. How do you create large collections with more than 2000 rows by formula ?

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

      I just learned he same thing after watching this video. Plus 1. And, in addition, using a named formula means not having to do a ClearCollect on a collection when the underlying data source changes. Plus 2.

  • @iektech
    @iektech 10 หลายเดือนก่อน +3

    Hi Shane, I think there is a mistake, OnStart event doesnt finish everything before loading your start screen, it is true that it fires at the beginning when opening the app, however if you have a significant numer of actions there or a few that take time to finish, like datasource refresh, you will notice that events from the OnVisible event of your first screen will run before the OnStart event is completed.
    PS. Merry Christmas 🎄

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

      Merry Christmas. There is a setting where you can tell it to make sure it waits. 😎

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

    Hang on Shane I get your busy but wheeerrrrrrsssss your intro 😉 lol Another great helpful vid thank you from over the pond.

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

      I loved that part but it got cut. :( Trying to get to the content faster. SOmetimes when I am recording I say it on accident and have to re do it 😹

  • @GroverParkGeorge
    @GroverParkGeorge 10 หลายเดือนก่อน +3

    In many programming languages, including VBA in Office apps, we have Public Constants, which is a role that formulas, such as nfUser, fill here.
    In my apps, for example, I set the App Title as a formula instead of typing it into the header of screens, and I designate an app logo formula.

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

      I like it.

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

    Power Apps Named Formulas will really improve performance. Thank you Shane

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

    Does it work with SQL view, would they be automatically refreshed? Also, does it make multiple calls if I use the NamedFormula many time?

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

      Yes, subject to the problem I encountered (described above), when the app runs on a mobile device. I would love feedback on this.

  • @windytubeful
    @windytubeful 10 หลายเดือนก่อน +2

    Awesome, I have a bunch of collections that are tables with columns added to expose related columns. It looks like if I make the collection a nf, and then change a variable that is used to filter the nf, the nf will automatically rebuild the table? This will mean I can have the definition for the table in one place only, whereas right now I am copying the code to build it between each screen that uses the same collections, and then if I were to change how it's structured, like now, when I am migrating from SharePoint lists to Dataverse, I have to edit every screen. I was thinking of embedding the code into a component that I make invisible on the screen and select when I need to refresh, but this is better!

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

      Sounds like a great use to me. 🤩

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

    Many thanks, Shane! Most of our PowerApps are in front of SPO lists. For lookups into other lists (which don't change while a user is updating one main list), would you recommend using named formulas in PowerApps and simple text fields in the main SPO list (instead of lookups in other lists)?

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

      A lot of times yes. I prefer maintaining the relationships myself and not using LookUp columns normally because that gives me more control.

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

      @@ShanesCows Many thanks! I just completed one PoweApps form with many lookups. In dev, I'll see if I can redo the list and form this way. I'll keep this in mind going forward, too. Take care & Happy Holidays!

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

    Superb video as always. Can’t wait to try this out. Thanks Shane.

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

      Happy to help. Have a great day. 🐶

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

    Hey Shane, thanks for this video and all the other helpful videos I've enjoyed over the past few years! Hope you're having a relaxing Christmas and New Year with Nicola and Chewie 🐶
    I've got a refresh issue: I've set a named formula (nf_mybookings) to pull filtered items from a SP list. When I make a change directly in the SP list, I can see by clicking in the formula bar that the nf has picked up the change, however I'm not seeing the change reflected in the gallery which has items set to nf_mybookings. Am I doing something wrong here?

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

      I got around the issue in a way that seems really dumb but it works (ain't it always the way). I set a timer to 5 seconds duration, autostart, reset and repeat to true. On timer end:
      If(refresh_1,UpdateContext({refresh_2: true, refresh_1: false}),UpdateContext({refresh_1: true, refresh_2: false}))
      Then I set the items property of the gallery to If(refresh_1,nf_mybookings,nf_mybookings).
      Weirdly this forces the gallery to pick up the change in the data which the nf knew all about but was hoarding like Smaug in the Lonely Mountain 🐉

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

      Happy Holidays to you and your family also. Another way you could do this with a bit less code would be use Refresh function on the data source. This video th-cam.com/video/gmYlJIjHS2M/w-d-xo.html talks about not using Refresh but in this case it would be the only way to get what you wanted. :) Good job finding a work around. 😎

  • @iswired4sound
    @iswired4sound 13 วันที่ผ่านมา +1

    NFs track collections changes automatically. Awesome time saver. Thanks for that tip. Also, can it track changes in any other data sources? Dataverse? Sharepoint? That would be super helpful as well.

    • @ShanesCows
      @ShanesCows  12 วันที่ผ่านมา

      No, NF do not know about changes in the Data Source unless the change happens inside of Power Apps.

  • @appen-pq6sq
    @appen-pq6sq 10 หลายเดือนก่อน +1

    Hello Shane, thank you for one more great video! You stressed the use of a semicolon at the end of the formula. In my environment (Norway), we have to add two (;;;)to make this work.

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

      That is correct. That is because in your language you use a , as the decimal separator where as I use a . for the decimal. In that case, where I use a ; you will always use a ;; and where I use a , you will use a ;
      I talk about it in this video th-cam.com/video/GAdnURx5g8g/w-d-xo.html

  • @TracyWork
    @TracyWork 9 หลายเดือนก่อน +2

    Very helpful!!!

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

      Happy to help. Have a great day. 🐶

  • @jaredt.4048
    @jaredt.4048 9 หลายเดือนก่อน

    Shane, do you have, or will you make, a video on how to mark gallery items as a favorite and then filter the gallery to just your favorites? This would be great for many apps, especially for my facility directory app. Thanks for all you do!

  • @antoniobranderas
    @antoniobranderas 10 หลายเดือนก่อน +2

    I like how you use “nf” for the formulas. I use “gvar” for global variable and “cvar” for context variable.

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

      Nice. Having some way to distinguish is so nice.

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

      Me too! Exactly the same. Works a treat

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

    hi buddy, watched my 1st vid of yours since new year. This seems to have enormous potential if delegable. Can i store a filtered table to subsequently ref in another named formula? I was always weary of doing this with collections because collections are apparently non-delegable? Especially powerful if it auto-updates the patching without having to add another clearcollect!

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

    Thanks for the very useful video!

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

      You're welcome!

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

    Thx Shane, perfect video ;)

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

      You're welcome!

  • @JormaRousseau
    @JormaRousseau 10 หลายเดือนก่อน +2

    Is this a valid way to work around delegation? Using your example, if your source executives was larger than your delegation limit, and you performed a non-delegable function on nfExecutives, would it work? Ill test this myself when I get home, but I am curious if you have any ideas here.

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

      I would not expect that to work. The issue with delegation is at the data source, eg: can SharePoint fulfill your filter query on the server, or otherwise delegation occurs and 5000 (or whatever your limit is set to) items are returned for the client to apply your filter query on.
      The data returned in nfExecutives would be the same and subject to the same limitations of delegation.

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

      @@AndyHewco You are probably right. Something from the description in the video made me think the source was being copied into memory, similar to a collection, but it is more likely being referenced. I was just watching the video while getting coffee and didnt fully think things through. Ill still mess with it at home later though, thank you for the response.

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

      Nope. Nothing is going to out fox non-delegable functions. Sorry

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

      The data is cached but only up to the delegation limit.

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

    Basically it does not replace collections at all, if the goal was to let the collection be a cache of data that you want to view offline.

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

      Correct.

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

    Hi Shane, in the Naed Formulas I have made two tables/collection with the Filter function. The have the same columnnames. How can I make a union of these two? So just stick table A and table B behind each other? I already tried the following:
    C = Table(A, B);
    C = A + B;
    C = A & B;
    C = Table({A}, {B});
    But unfortunately they all give errors. I understand that A + B and A & B aren't working, but I hoped Table(A, B) worked. I got the following error: Cannot use a non-record in this context.
    Could you please help me? Many thanks in advance! Greets, miss Meijs 😉
    Oh Ps. I asked ChatGPT, but unfortunately he was a bit stubborn and kept answering with functions that don't exist in Power Apps or with ClearCollect. Since that is not useable in the Name Formulas I thought Shane is smarter than ChatGPT anyways 😉😉

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

      I will try to play with this tomorrow and see what I come up with. I have never had to do Union in Power Apps before. If we don’t figure it out I do know how to do it in Automate.

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

      @@ShanesCows Thank you in advance for your time! 😄

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

      Is this what you are looking for?
      ClearCollect(CombinedTable, Table1);
      Collect(CombinedTable, Table2);

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

      Hi @@ShanesCows , sorry but no. I thought about that myself, but the goal actually was to use Name Formulas and a (Clear)Collect can't be used in the Named Formulas right?

  • @michelhegeraat5430
    @michelhegeraat5430 10 หลายเดือนก่อน +2

    So, when is the function that the named formula uses evaluated or reevaluated exactly? I can understand if you patch a data source in your app, that it knows the data source has been changed. But what if another user patched the data source?

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

      Great question ... I'm wondering the same thing. I'm thinking of using a timer that would run, for example a 30 second interval, and change a variable from true to false that would cause the formula to re-evaluate.

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

      @@LindseyKyle
      In an ideal world you would be able to get notified of a change in a data source with a trigger, like how this currently works in power automate. Annoying to know the “hard part” of making that is already done but Microsoft probably doesn’t see the point of providing such functionality.

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

      It does not know about things done by other users. Sorry. Each NF is only applicable to that user in that session.

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

      @@ShanesCows Thank you Shane, I have button that generates a new order number, based on the previous order + some rules. It worked fine since june 2021, until yesterday when 2 people hit the button at the exact same time. 🙂 NF won't save me, I will need to think of something else, where both people first generate a record, and then based on the ID generate a new order number.

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

      @@ShanesCows Can you work around this by adding a Refresh() on the data source before invoking the Named Formula? As is liberal use of Refresh a bad idea?

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

    Hey Shane. I can see the performance enhancement for individual app users, but is the PowerApp able to apply the caching across multiple users of the same app... I guess not, but imagine!

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

      Yeah, per user for now.

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

      @@ShanesCowsfor now??

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

    Hey Shane, where would you add variables that you do want to be able to change, if Formula's can't handle variables that change? Since OnStart is being depreciated

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

      You could put them OnVisible of the first screen if you wanted.
      I still use OnStart. I know they want to get rid of it, but there isn't a perfect replacement yet so I keep using it. They tell me they will not get rid of it until there is a perfect replacement. 🤷

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

      @@ShanesCows Thanks :) In the last 2 days I've been using a combo of OnVisible and Formulas, as well as components, which seems to be doing the trick!

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

    I'm trying to create a monthly report of an inventory management system. Any idea how to do that? I'm searching online for help but nothing.

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

      I would be looking at Power BI. It is the best for reporting.

  • @HeatherR-d6i
    @HeatherR-d6i 10 หลายเดือนก่อน +1

    If you have a named formula that gets used on a screen, it gets the data at that point. If you go to another screen that doesn't use the named formula, and then go back, is that a second request? So each time you access the screen with the named formula it's a new request?

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

      I do not believe so, I believe Power Apps will cache it from your first visit. I guess I should test it but pretty sure. :)

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

      @@ShanesCows following to get the answer 🤩 I was looking for this comment because I just wanted to be conscious of the api calls, especially if there are multiple records to be returned.

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

    would that new executive record showed up instantaneously if it was added in sharepoint? or dataverse

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

      No, Power Apps caches that info until you cause it to be refreshed. Typically by changing another record.

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

    This is a "live" feature, right? Not a preview? No need to go into app settings and toggle a slider to turn it on?

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

      Correct 👍

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

    Can a named formula include a ForAll? I’m hoping for more elegant code. (Shorter expressions inside buttons.) My citizen-developer brain gets lost when I’m thinking through the logic of long formulas and I’m wondering whether named formulas represent an effective way of compartmentalizing things.

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

      Nope. They are working on making reputable functions but not yet. Technically you can use ForApp to free a NF but not the way you are thinking I am pretty sure.

  • @TheBatis10
    @TheBatis10 9 หลายเดือนก่อน +2

    Has Anyone had any issues where the formulas will work one day and the next day just not work? I have had multiple apps that I had to rewrite the code because the formulas just stop producing the expected result?

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

      No, that hasn't happened to me.

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

    Can you use the "//" to add comments to those?

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

    Nice! Thanks.

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

      You bet!w

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

    But, if you will set "items" of gallery Filter(Emploees, Department="Executive") , the gallery will be refreshed also as without make a formula

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

      True

    • @DanielWu-rh8ki
      @DanielWu-rh8ki 10 หลายเดือนก่อน

      If you patch in app, don't you need to Refresh(Employees); in order for it to refresh? In my apps I had to do it as they don't refresh after the updates, but I don't know if MS had made an update of that, or my Filter() is more complex?

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

      @@DanielWu-rh8ki No need to Refresh

  • @iamintractable1805
    @iamintractable1805 12 วันที่ผ่านมา

    Changes to a dataset (SharePoint in my case) associated with a named formula are only automatically recognized by the named formula if the dataset is updated by the app making the change. Other users running the app or direct changes to the SharePoint list will NOT be seen by the named formula. Developers will have to explicitly refresh the named formula to see those changes, This is a major drawback. I attempted to replace a collection with a named formula and while I am sure it will work, the Named formula is subject to delegation (displaying triangles) where a collection is not. So, it does not seem practical to replace a collection with a Named Formula. If you disagree, tell me why?

    • @ShanesCows
      @ShanesCows  12 วันที่ผ่านมา

      Collect and ClearCollect are NEVER delegable, even though they don't warn you they are not. Same for NF they are never delegable. So they have that it common.
      You are correct that NF, nor collections, or any use of a data source know about changes outside of the app. :(
      So I would say you have the same challenges either way. NF with a table stored in it is really just a collection that is maintained by Power Apps instead of you. But all of the rules of what they know or can do are basically the same.
      I hope that helps.

    • @iamintractable1805
      @iamintractable1805 12 วันที่ผ่านมา

      ​@@ShanesCows A delegable function is one that can be executed server side. When a Filter action cannot be executed on the server, the app will get the first max number of rows it can (2000) and then apply the non-delegable function. If a filter is fully delegable, it will be applied to all rows server side and the first 2000 qualifying result rows will be returned. Most functions cannot be sent to the server (Dataverse or SharePoint). So there needs to be some creativity in what you push on the server and what you apply to a collection. Here is my issue. I have a 800 item list. When I pull all the list rows with a simply ClearCollect no delegation warnings are visible and I can then further filter the collection as I see fit. When I do the same thing where the list rows are assigned to a Named Formula, any subsequent filtering on the Named Formula shows a delegation error when the function is not delegable. So all a named formula is doing is creating a new name for a data source, nothing more. What am I missing?

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

    I have an experience that named formulas sometimes doesn't update when using longer more complicated formulas.

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

      Yuck. I haven’t ran into that.

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

      I face the same issue in Edit Mode, but after published the app to end user, not received any related feedback so far. Anyway i have another issue with named formula, I uses sharepoint list as data source. When doing filter like UserName = User(). Name, i got error bc actual name of UserName in SharePoint list is Title, everything fine when replacing UserName by Title. I saved the change and published the app. However, when i get back to Edit Mode, nothing changed :(

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

    Leave it to Microsoft to have two syntax systems in the same environment. Outside of that, thanks for the video.

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

    As per other users here, we've found named formulas to be unreliable in firing, mainly in Edit (not so much after publishing) but that makes testing a pain. Also, calling them Named Formulas is a bit of a misnomer, they are not - what I REALLY hoped they would have been - a means of encapsulating code reuse. So we can't call behaviour formulas from them. They are just dynamic variable references. Greg Lindhorst hints at this direction in his blog, but perhaps it's a step too far in the dreaded "imperative" direction for his liking. So it's the clunky canvas code components for now...

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

    Toma aqui esse like seu lindo

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

      🤩

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

    No need for onstart I feel, use a splash screen and perform logic post app load

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

      That works. 🤩

  •  10 หลายเดือนก่อน +2

    I moved all my dropdown values to fx Named Formulas

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

      Love it!

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

    Hi, Haylee

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

      She will be so happy! Thanks