Tips & Tricks: 4 Formula Bar Tips Worth Investigating

Tips and Tricks: sharing a few quick tips on using the formula bar in PowerApps.

Tip #1: Use the FX icon to browse or select functions by group or type.

If you click on the fx to the left of the formula bar, you can review formula functions by group type. Use the dropdown to change between all nine (9) groups (as of February 2017: Text, Logical, Table, Action, DateTime, Math, Information, Color, and REST)

Suggested action item: Take a minute to flip through the different groups to understand how the functions relate to varioius objects and goals.

Unfortunately, the "Learn more...." link on the bottom of this dialog is not contextual. In every case, clicking on "learn more..." will open a new browser tab and display the entire formula reference page. On the other hand, the good news is that functions are alphabetized there so you can easily locate the one you're interested in to learn more about it.

Tip #2: Syntax Guides

If you select one of the functions from Tip #1, or simply start typing the function, a pop-up will appear in grey above the formula bar that will help you with the syntax. It provides a sample look at the syntax and parameters, with definitions below that.

Suggested action item: Add a textbox to a screen, start typing Concatenate( in the text property of the textbox. Notice the syntax help that appears. Also notice that there is a squiggy red line under the open paren....which indicates that the formula is incomplete. As you continue typing, once the formula is complete the red squiggy line will go away. This particular function has as many parameters as necessary for the concatenation, but each must be separated by a comma, and there needs to be a closed paren at the end.

Tip #3: Color Indication for Related Objects

If you reference another control in one of the properties of a control, you'll notice that the control name shows in a particular color, and the same color used will also be leveraged to highlight the control being referenced. This enables you to visually validate that the control you are referencing is the correct one. In complex formulas which reference multiple controls, you'll notice that the control colors will vary, but the color in the formula will always match the color of the highlight on the screen.

Notice this in the screen shot below. The bottom text box references the width of the one bordered in red.

Tip #4: Naming Matters

It may not seem like a big thing, but well-structured control names can be very helpful when you are building your formulas. When it comes to forms generated automatically by SharePoint, the consistentcy on the naming is most important (and it is well handled by app generation). However, whenever you build an app from scratch this is easy to overlook.

Suggested Action Item: Whenever you build an app from scratch, try to name things in a logical manner. Noun_Purpose formats can be helpful, where noun is the type of control, and the purpose represents what you'll be doing with the data stored there. This way they will naturally show up together in the intellisense auto-complete. It will be much easier to type 'just enough' of the name before hitting 'tab' and then letting the PowerApp auto-complete the rest for you!

In the picture below I typed "gallery" to get a full list of all controls that are galleries (since I named all my galleries with a prefix of "Gallery". Next, I would type a "C" then hit tab for "GalleryContributions" to be filled in for me. Finally, I would finish up with .Selected to complete the Item property of my form. I find this most helpful when my apps have multiple galleries and forms, but I bet you can think of many other situations where this would be helpful!

P.S. Did you notice that when you select a control, the name of it also displays on a breadcrumb navigation bar on the lower left of the screen? In fact, it actually exposes the hierarchy of the control you selected. In this case, I have selected DataCardValue5, which is in DataCard8, which is on Form1, which is on Screen3 (...and yes, you can click on each breadcrumb name to select the objects as well!)

Cool beans!

I hope these 4 tips help you speed up and optimize your formula builds for your next PowerApp! Be sure to give us feedback and comments below.