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.
@benmichels19778 ай бұрын
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.
@ShanesCows8 ай бұрын
Awesome. Thanks for sharing. 😀
@JasonAngWeiLung8 ай бұрын
I remember that’s what I wanna do previously (even before the named formula becomes generally available). Thanks for sharing Shane Young!
@toanbui38108 ай бұрын
As i know, there are delegation limits with formula. How do you create large collections with more than 2000 rows by formula ?
@GroverParkGeorge8 ай бұрын
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.
@s6boi6668 ай бұрын
Hang on Shane I get your busy but wheeerrrrrrsssss your intro 😉 lol Another great helpful vid thank you from over the pond.
@ShanesCows8 ай бұрын
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 😹
@oluwatobiyusuf7 ай бұрын
Power Apps Named Formulas will really improve performance. Thank you Shane
@StevePhilp798 ай бұрын
Superb video as always. Can’t wait to try this out. Thanks Shane.
@ShanesCows8 ай бұрын
Happy to help. Have a great day. 🐶
@iektech8 ай бұрын
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 🎄
@ShanesCows8 ай бұрын
Merry Christmas. There is a setting where you can tell it to make sure it waits. 😎
@CybermatikАй бұрын
Thx Shane, perfect video ;)
@ShanesCowsАй бұрын
You're welcome!
@GroverParkGeorge8 ай бұрын
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.
@ShanesCows8 ай бұрын
I like it.
@TracyWork8 ай бұрын
Very helpful!!!
@ShanesCows8 ай бұрын
Happy to help. Have a great day. 🐶
@appen-pq6sq8 ай бұрын
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.
@ShanesCows8 ай бұрын
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 kzfaq.info/get/bejne/faeUobiD3ZvLaJs.html
@windytubeful8 ай бұрын
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!
@ShanesCows8 ай бұрын
Sounds like a great use to me. 🤩
@jaredt.40487 ай бұрын
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!
@kellyliu42257 ай бұрын
Thanks for the very useful video!
@ShanesCows7 ай бұрын
You're welcome!
@antoniobranderas8 ай бұрын
I like how you use “nf” for the formulas. I use “gvar” for global variable and “cvar” for context variable.
@ShanesCows8 ай бұрын
Nice. Having some way to distinguish is so nice.
@starmole50007 ай бұрын
Me too! Exactly the same. Works a treat
@giorgiosurian21908 ай бұрын
Does it work with SQL view, would they be automatically refreshed? Also, does it make multiple calls if I use the NamedFormula many time?
@GroverParkGeorge8 ай бұрын
Yes, subject to the problem I encountered (described above), when the app runs on a mobile device. I would love feedback on this.
@stefancochrane27238 ай бұрын
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)?
@ShanesCows8 ай бұрын
A lot of times yes. I prefer maintaining the relationships myself and not using LookUp columns normally because that gives me more control.
@stefancochrane27238 ай бұрын
@@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!
@sahrchitect7 ай бұрын
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?
@sahrchitect7 ай бұрын
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 🐉
@ShanesCows7 ай бұрын
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 kzfaq.info/get/bejne/ndOJn616z663YoE.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. 😎
@TheKermit21107 ай бұрын
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!
@JormaRousseau8 ай бұрын
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.
@AndyHewco8 ай бұрын
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.
@JormaRousseau8 ай бұрын
@@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.
@ShanesCows8 ай бұрын
Nope. Nothing is going to out fox non-delegable functions. Sorry
@ShanesCows8 ай бұрын
The data is cached but only up to the delegation limit.
@randomgoose8 ай бұрын
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!
@ShanesCows8 ай бұрын
Yeah, per user for now.
@nacx128 ай бұрын
@@ShanesCowsfor now??
@dawnpeacock95484 ай бұрын
Can you use the "//" to add comments to those?
@hellopsp1805 ай бұрын
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.
@ShanesCows5 ай бұрын
Correct.
@geralddahl91598 ай бұрын
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.
@ShanesCows8 ай бұрын
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.
@big_cheese21622 ай бұрын
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
@ShanesCows2 ай бұрын
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_cheese21622 ай бұрын
@@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!
@michelhegeraat54308 ай бұрын
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?
@LindseyKyle8 ай бұрын
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.
@michelhegeraat54308 ай бұрын
@@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.
@ShanesCows8 ай бұрын
It does not know about things done by other users. Sorry. Each NF is only applicable to that user in that session.
@michelhegeraat54308 ай бұрын
@@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.
@GroverParkGeorge8 ай бұрын
@@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?
@jenskemeijs7 ай бұрын
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 😉😉
@ShanesCows7 ай бұрын
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.
@jenskemeijs7 ай бұрын
@@ShanesCows Thank you in advance for your time! 😄
@ShanesCows7 ай бұрын
Is this what you are looking for? ClearCollect(CombinedTable, Table1); Collect(CombinedTable, Table2);
@jenskemeijs7 ай бұрын
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?
@TheBatis107 ай бұрын
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?
@ShanesCows7 ай бұрын
No, that hasn't happened to me.
@glennbullion90698 ай бұрын
This is a "live" feature, right? Not a preview? No need to go into app settings and toggle a slider to turn it on?
@ShanesCows8 ай бұрын
Correct 👍
@GroverParkGeorge8 ай бұрын
Nice! Thanks.
@ShanesCows8 ай бұрын
You bet!w
@NecroWorld3 ай бұрын
Leave it to Microsoft to have two syntax systems in the same environment. Outside of that, thanks for the video.
@kurtbarber51178 ай бұрын
would that new executive record showed up instantaneously if it was added in sharepoint? or dataverse
@ShanesCows8 ай бұрын
No, Power Apps caches that info until you cause it to be refreshed. Typically by changing another record.
@roelmarten39698 ай бұрын
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.
@ShanesCows8 ай бұрын
I would be looking at Power BI. It is the best for reporting.
@user-vz2zi1nl8g8 ай бұрын
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?
@ShanesCows8 ай бұрын
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. :)
@ericgeeeee3 ай бұрын
@@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.
@davidoliveira84128 ай бұрын
Toma aqui esse like seu lindo
@ShanesCows8 ай бұрын
🤩
@raindenverraindenver7178 ай бұрын
But, if you will set "items" of gallery Filter(Emploees, Department="Executive") , the gallery will be refreshed also as without make a formula
@ShanesCows8 ай бұрын
True
@DanielWu-rh8ki8 ай бұрын
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?
@raindenverraindenver7178 ай бұрын
@@DanielWu-rh8ki No need to Refresh
@innov8iv8 ай бұрын
Hi, Haylee
@ShanesCows8 ай бұрын
She will be so happy! Thanks
@richardfarland8 ай бұрын
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...
@BigLeafDropper868 ай бұрын
No need for onstart I feel, use a splash screen and perform logic post app load
@ShanesCows8 ай бұрын
That works. 🤩
@jpgdesign8 ай бұрын
I have an experience that named formulas sometimes doesn't update when using longer more complicated formulas.
@ShanesCows8 ай бұрын
Yuck. I haven’t ran into that.
@toanbui38108 ай бұрын
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 :(
8 ай бұрын
I moved all my dropdown values to fx Named Formulas