Тёмный
No video :(

Power Apps Global Variables - Stop using them! 

Chino Does Stuff
Подписаться 5 тыс.
Просмотров 5 тыс.
50% 1

In this video, we will explore the benefits of using the With function in Power Apps over using global variables and the Set function. The With function is a powerful tool that allows you to make multiple changes to your app in a single function, rather than making each change individually. By using the With function, you can improve the performance of your app and make your code easier to read and understand. We'll also discuss the limitations of global variables and the Set function, and how the With function can help you avoid these pitfalls. So join us as we learn about the benefits of using the With function in Power Apps. #powerapps #powerplatform #office365

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 13   
@77ryan0341
@77ryan0341 7 месяцев назад
Very good information and I appreciate the effort to share. I would personally like it better without the background music. Others may feel differently. Thanks again!
@ChinoDoesStuff
@ChinoDoesStuff 6 месяцев назад
Yep..I don't really use the background music anymore... unfortunately I can't do anything about it now so hopefully you were still able to get everything you needed from the video.
@geralddahl9159
@geralddahl9159 Год назад
I thought the focus might be limited to ‘update context’ but ‘with’ was used and explained well. Thank you.
@ChinoDoesStuff
@ChinoDoesStuff Год назад
Glad you liked it...
@EpicBizHero
@EpicBizHero Год назад
GREAT! I Appreciate You Chino… THANK YOU!!!
@ChinoDoesStuff
@ChinoDoesStuff Год назад
I appreciate you too!
@valentineelias7299
@valentineelias7299 Год назад
Awesome video, I just learned something new. 👍
@ChinoDoesStuff
@ChinoDoesStuff Год назад
Glad it helped! Watch more of my videos and you might learn even more!
@artkarp
@artkarp Год назад
Don't stop using global VARs. Here's why... The first global VAR you created was a new one. When creating the second SET() function using the same VAR name, the designer SHOWED YOU the name you were typing already exists. It was on the list below where you were typing. So now you have a choice. Use the existing VAR or create a new one with a different name. To find where a VAR has been used across the app, use the SEARCH FUNCTION on the left NAV bar. It will let you see and navigate to every place in code , across the entire app, that the VAR has been used. Also, if you don't like the "varName" you used, you can use the designer "Search and Replace" functionality to update the VAR everywhere with a new and improved name. When you talk about a large app with 100s of VARS, it is only a problem if you don't have a good VAR naming convention. VARs need a name that has meaning when you read it six months later or that someone else will understand without requiring documentation. In your example you used "recID". A better name would have been "varCreatedIssueID_record" since that is what is returned from a Patch statement. Also you used "varStatus" a very generic and unhelpful name. "varIssueStatus" would be meaningful and easier to understand. Make a VAR name as long as it needs to be so that it is understood by all who read it. There is no reason for a short meaningless VAR name. This isn't programming Power Apps 1979. In your status example your code referred to what item was selected in the control. A better way would be to use the OnChange property of the control to SET a global VAR that you use in your Patch code. It is a bad habit to use a reference to a control property. If the control is not on the current screen, your app has to keep every other screen you have referred to in memory which is a performance hit. Early on, I made this mistake based on seeing the same idea shown in canvas app videos I watched on YT, now I am having to revisit every line of code to "fix" this issue. Also, this issue gets more complex when you set a default value for the control. The user may or may not select anything. So now, nothing is selected but your code isn't using the default value. Also, Microsoft in their docs say don't do this and the App Checker will issue warnings about the issue. In the last three years of developing Canvas apps, I have yet to have anyone explain why I should ever use a context var. IMO, just a waste of test and complicates refactoring of an app. For example, when you move some, but not all controls from one screen to another. for a better user experience. The With() function has it place, and can be a big help, in more complex Patch code. Personally, I wouldn't use it with the code you showed, it just creates more lines of code to read. Hope this is helpful to others.
@ChinoDoesStuff
@ChinoDoesStuff Год назад
I appreciate your perspective and I understand your concerns about using global variables and the With() function in Power Apps. However, I would like to offer an alternative perspective on these topics. First, global variables can be useful in certain situations where it is necessary to store and access data across different screens or components of an app. While it is important to have a clear naming convention and to choose descriptive variable names, there are cases where the use of a global variable may still be appropriate. For example, if an app has multiple screens that need to share data, using a global variable can be a convenient way to do this without having to pass data between screens using parameters or other methods. As for the With() function, it can be helpful in situations where you need to make multiple updates to a record using the Patch() function. Using the With() function, you can avoid repeating the same record reference multiple times in your Patch() statements, making the code easier to read and understand. While it may add a few extra lines of code, in my opinion, the benefits of improved readability and clarity outweigh the potential drawback of having slightly longer code. Finally, I disagree that context variables are a waste of time or that they complicate code refactoring. Context variables can be a useful tool for storing and accessing data that is relevant to a specific screen or component of an app. In addition, they can be helpful when moving controls between screens, as they allow you to store and access data that is specific to a particular screen or component rather than relying on global variables. I hope this helps provide a different perspective on these topics and is helpful to others as well.
@user-me8xb1wi5g
@user-me8xb1wi5g 4 месяца назад
Thank you, you two, for taking the time to explain.
@1InComa
@1InComa Год назад
Great video! I have a question. When should you use With and when should you use a local variable?
@ChinoDoesStuff
@ChinoDoesStuff Год назад
When you are creating a variable for a specific function i.e. during save or for some other event, always use With().
Далее
Using the Dataverse with Microsoft Power Apps
34:01
Просмотров 7 тыс.
Средневековый киборг
00:39
Просмотров 532 тыс.
Build Apps for Power Pages - The Best Way!
1:17:31
Просмотров 10 тыс.
Named Formulas & User Defined Functions in Power Apps
13:41
Power Apps formula Reference + 5 uncommon functions
21:37
We Had a UX Designer Fix Our Power App Part 1
22:10
Просмотров 56 тыс.
Don't put your types in .d.ts files
3:54
Просмотров 135 тыс.