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.
@benmichels197711 ай бұрын
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.
@ShanesCows11 ай бұрын
Awesome. Thanks for sharing. 😀
@JasonAngWeiLung11 ай бұрын
I remember that’s what I wanna do previously (even before the named formula becomes generally available). Thanks for sharing Shane Young!
@toanbui381011 ай бұрын
As i know, there are delegation limits with formula. How do you create large collections with more than 2000 rows by formula ?
@GroverParkGeorge11 ай бұрын
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.
@iektech10 ай бұрын
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 🎄
@ShanesCows10 ай бұрын
Merry Christmas. There is a setting where you can tell it to make sure it waits. 😎
@GroverParkGeorge11 ай бұрын
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.
@ShanesCows11 ай бұрын
I like it.
@iswired4soundАй бұрын
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Ай бұрын
No, NF do not know about changes in the Data Source unless the change happens inside of Power Apps.
@oluwatobiyusuf10 ай бұрын
Power Apps Named Formulas will really improve performance. Thank you Shane
@antoniobranderas11 ай бұрын
I like how you use “nf” for the formulas. I use “gvar” for global variable and “cvar” for context variable.
@ShanesCows11 ай бұрын
Nice. Having some way to distinguish is so nice.
@starmole500010 ай бұрын
Me too! Exactly the same. Works a treat
@DaHooka23 күн бұрын
Thank you Shane, great video!
@ShanesCows23 күн бұрын
Happy to help 🤩
@louischamberland815213 күн бұрын
Very nice way to do Formulas... I'm using SVG's in my menus, would you consider loading them through formulas or through OnStart section? Great videos and thank you for your content!!!
@ShanesCows13 күн бұрын
Formulas 🤩
@appen-pq6sq11 ай бұрын
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.
@ShanesCows11 ай бұрын
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 kzbin.info/www/bejne/fXLHn4iIrZqabsk
@windytubeful11 ай бұрын
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!
@ShanesCows11 ай бұрын
Sounds like a great use to me. 🤩
@jaredt.40489 ай бұрын
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!
@StevePhilp7911 ай бұрын
Superb video as always. Can’t wait to try this out. Thanks Shane.
@ShanesCows11 ай бұрын
Happy to help. Have a great day. 🐶
@hellopsp1807 ай бұрын
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.
@ShanesCows7 ай бұрын
Correct.
@s6boi66611 ай бұрын
Hang on Shane I get your busy but wheeerrrrrrsssss your intro 😉 lol Another great helpful vid thank you from over the pond.
@ShanesCows11 ай бұрын
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 😹
@TracyWork10 ай бұрын
Very helpful!!!
@ShanesCows10 ай бұрын
Happy to help. Have a great day. 🐶
@stefancochrane272311 ай бұрын
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)?
@ShanesCows11 ай бұрын
A lot of times yes. I prefer maintaining the relationships myself and not using LookUp columns normally because that gives me more control.
@stefancochrane272311 ай бұрын
@@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!
@kellyliu422510 ай бұрын
Thanks for the very useful video!
@ShanesCows10 ай бұрын
You're welcome!
@sahrchitect10 ай бұрын
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?
@sahrchitect10 ай бұрын
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 🐉
@ShanesCows10 ай бұрын
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 kzbin.info/www/bejne/nZ68nX1_n62GaK8 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. 😎
@giorgiosurian219011 ай бұрын
Does it work with SQL view, would they be automatically refreshed? Also, does it make multiple calls if I use the NamedFormula many time?
@GroverParkGeorge11 ай бұрын
Yes, subject to the problem I encountered (described above), when the app runs on a mobile device. I would love feedback on this.
@paolovr19707 күн бұрын
Thanks Shane 😊
@ShanesCows6 күн бұрын
No problem. Have a great week!
@randomgoose11 ай бұрын
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!
@ShanesCows11 ай бұрын
Yeah, per user for now.
@nacx1211 ай бұрын
@@ShanesCowsfor now??
@Cybermatik4 ай бұрын
Thx Shane, perfect video ;)
@ShanesCows4 ай бұрын
You're welcome!
@TheBatis1010 ай бұрын
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?
@ShanesCows10 ай бұрын
No, that hasn't happened to me.
@jenskemeijs9 ай бұрын
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 😉😉
@ShanesCows9 ай бұрын
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.
@jenskemeijs9 ай бұрын
@@ShanesCows Thank you in advance for your time! 😄
@ShanesCows9 ай бұрын
Is this what you are looking for? ClearCollect(CombinedTable, Table1); Collect(CombinedTable, Table2);
@jenskemeijs9 ай бұрын
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?
@JormaRousseau11 ай бұрын
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.
@AndyHewco11 ай бұрын
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.
@JormaRousseau11 ай бұрын
@@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.
@ShanesCows11 ай бұрын
Nope. Nothing is going to out fox non-delegable functions. Sorry
@ShanesCows11 ай бұрын
The data is cached but only up to the delegation limit.
@michelhegeraat543011 ай бұрын
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?
@LindseyKyle11 ай бұрын
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.
@michelhegeraat543011 ай бұрын
@@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.
@ShanesCows11 ай бұрын
It does not know about things done by other users. Sorry. Each NF is only applicable to that user in that session.
@michelhegeraat543011 ай бұрын
@@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.
@GroverParkGeorge11 ай бұрын
@@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?
@TheKermit211010 ай бұрын
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!
@geralddahl915911 ай бұрын
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.
@ShanesCows11 ай бұрын
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.
@HeatherR-d6i11 ай бұрын
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?
@ShanesCows11 ай бұрын
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. :)
@ericgeeeee6 ай бұрын
@@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.
@big_cheese21625 ай бұрын
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
@ShanesCows5 ай бұрын
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_cheese21625 ай бұрын
@@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!
@richardfarland11 ай бұрын
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...
@roelmarten396911 ай бұрын
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.
@ShanesCows11 ай бұрын
I would be looking at Power BI. It is the best for reporting.
@glennbullion906911 ай бұрын
This is a "live" feature, right? Not a preview? No need to go into app settings and toggle a slider to turn it on?
@ShanesCows11 ай бұрын
Correct 👍
@NecroWorld6 ай бұрын
Leave it to Microsoft to have two syntax systems in the same environment. Outside of that, thanks for the video.
@kurtbarber511711 ай бұрын
would that new executive record showed up instantaneously if it was added in sharepoint? or dataverse
@ShanesCows11 ай бұрын
No, Power Apps caches that info until you cause it to be refreshed. Typically by changing another record.
@iamintractable1805Ай бұрын
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Ай бұрын
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Ай бұрын
@@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?
@raindenverraindenver71711 ай бұрын
But, if you will set "items" of gallery Filter(Emploees, Department="Executive") , the gallery will be refreshed also as without make a formula
@ShanesCows11 ай бұрын
True
@DanielWu-rh8ki11 ай бұрын
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?
@raindenverraindenver71711 ай бұрын
@@DanielWu-rh8ki No need to Refresh
@GroverParkGeorge11 ай бұрын
Nice! Thanks.
@ShanesCows11 ай бұрын
You bet!w
@jpgdesign11 ай бұрын
I have an experience that named formulas sometimes doesn't update when using longer more complicated formulas.
@ShanesCows11 ай бұрын
Yuck. I haven’t ran into that.
@toanbui381011 ай бұрын
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 :(
@dawnpeacock95487 ай бұрын
Can you use the "//" to add comments to those?
@davidoliveira841211 ай бұрын
Toma aqui esse like seu lindo
@ShanesCows11 ай бұрын
🤩
@BigLeafDropper8611 ай бұрын
No need for onstart I feel, use a splash screen and perform logic post app load
@ShanesCows11 ай бұрын
That works. 🤩
11 ай бұрын
I moved all my dropdown values to fx Named Formulas