Featured

The Big 5 (Variables / Parameters) in PowerApps

Photo by Ann H on Pexels.com

If you create a PowerApp and look around on the internet for solutions, you will come across the following functions from time to time.

  1. set()
  2. updateContext({})
  3. with()
  4. navigate(…,…,PARAMETER)
  5. param()

In the following I will show you briefly what I use them for and why you should think about using them too.


  1. set() function
    This is probably the best known function of all. It sets the value of a global variable. Global variables are useful when you want to store a value and use it on different screens. This can be used in the OnStart, where you set style variables, the logged in user or if you select an element from a gallery and want to use this element somewhere else.

Set(
varUser,
user()
)


  1. updateContext({})
    This is the little brother of the Set function. Sets the value of one or more context variables of the current screen. I mainly use this when I want to change a value (true,false) to show/hide something for example. Mostly a pop-up or another input window.

    Here I set the variable “locPopUp” first to “true” and then again to “false”.

UpdateContext({locPopUp: true});
UpdateContext({locPopUp: false})


  1. with({})-function
    This function I discovered some time ago and is again the little brother of UpdateContext. Here “variables” are stored exclusively for a function and can only be referenced in this function. I use this mainly within functions, as soon as I have to use a certain function several times.

    In this example I write the variable “locText”, to which I then reference 2x in the further course of the function. Important: the With function is closed only at the end of all functions.

With(
{locText: TextInput1.Text},
If(
IsBlank(locText),
“noText,
TextInput1.Text
)
)


  1. navigate(…,…,{PARAMETER})
    This parameter was unknown to me for a long time, because I usually stopped after the first comma and closed the parenthesis. But if you put two more commas after the Navigate, you can pass one or more parameters to the screen you want to navigate by using the curly braces. This parameter is then only available on the following screen. (unless you write it into another variable or pass this value again)

    In this example I pass to Screen1 the parameter “locVariableNextScreen” with the text “Yes we can use it”.

Navigate(
Screen1,
UnCover,
{locVariableNextScreen: “Yes we can use it”}
)


  1. param()
    This provides access to parameters passed to the app when the user has it open. This parameter is usually used less often, as this is exclusively appended to the app’s URL. Thus it is possible to navigate the user to a certain page or to pass certain values to the app.

    Here I pass the parameter “Admin” with the value “true” in the URL. In OnStart I then set the global variable “varAdmin” with the parameter “true”. So I can enable additional settings for an admin, using this parameter. (Visible: varAdmin)

https://apps.powerapps.com/play/543654354453543543?tenantId=dasfdgdsgsfsdfsdf&Admin=true

Set(varAdmin,Param(“Admin“))


Extra tip: If you use a variable and want to use it as a boolean, which is always the opposite of the current state, use the “!” in front of the variable. This reverses the value.

This example reverses the value every time it is executed. If is currently true, it will be changed to false and vice versa.

UpdateContext({locPopUp: !locPopUp})

Featured

Power Apps change the app owner with PowerAutomate

In the post of 2020-12-09 I showed the video of Shane Young, where it is shown how to change the AppOwner using PowerShell. However, there is another, perhaps even easier way to change the AppOwner. Using PowerAutomate.

Why should I change the owner of the app, which is the creator? One of the reasons that comes to mind is that the person has left the company, or you want to transfer all apps to one account.

Here is the short tutorial on how to change the AppOwner of PowerApps using PowerAutomate.

Here you can see the simple structure of a flow, which is triggered manually.

Next, the new AppOwner is searched for in the action “Search for user”. Make sure that this is unique and that only one user is found.

Then use the action “Set App Owner” and fill in the fields. Under Environment Name you can get the ID from the URL above. (2. on the picture below) The same applies to the PowerApp name. Just insert the App ID here. (1. on the picture below)

Finally insert the ID that comes from the action “Seach for user” and the AppOwner will be changed. (if you have the permissions)

 

PowerApps PDF Viewer SharePoint Document Library without flow from Reza Dorrani

A great video, which replaces all the cumbersome workarounds viia PowerAutomate. Here you learn how to simply “manipulate” data and thus directly view PDF fils in the PowerApp.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Create a simple multilingual app in 3 steps

Photo by Pixabay on Pexels.com

For me, it was important to find a simple way to build a multilingual app that is also easy to maintain. Because the most common examples require tons of work when adding a new language.

In my example you will learn how to build a multilingual app in just 3 steps and which 2 parameters you only need to adjust to implement your new language.

I have also included the code for you to copy & paste, so you can finish even faster.

Step 1: Create a datasource
Here in this example I have created a SharePoint list which have the columns for the languages (English, French and German). -> en, fr, de

It is important to have a reference column which contains a consecutive number. I use here the automatically generated ID. In addition, one could add columns here, where one enters a remark to the screen (where the text is) and if necessary with the name of the item (e.g. Label1).

Step 2: Define OnStart
In the OnStart of the app you should first read out the language of the respective user or his browser language. You can do this easily with ‘language()’.

In this example I only want the first two letters, because they are identical to the datasource and I can reference them more easily. For this I write this language in a global variable, because then I could easily change it later in the app. (see bonus content)

To make it easier to add a new language later on and to avoid having to adjust every text field, I have used ‘ShowColumns’ for the language to filter the language column and ‘RenameColumns’ so that the language column always has the same name. Here ‘Value’.

Here the formatted code:

Set(
    varLanguage,
    Left(
        Language(),
        2
    )
);
Switch(
    varLanguage,
    "en",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "en"
            ),
            "en",
            "Value"
        )
    ),
    "fr",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "fr"
            ),
            "fr",
            "Value"
        )
    ),
    "de",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "de"
            ),
            "de",
            "Value"
        )
    )
)

Step 3: insert text elements
Here I simply added labels. But this also works with any other text display elements.

By formatting the collection columns in the previous step, it is now very easy to reference the corresponding text here. And the best thing is, when a new language is added, you do NOT have to adjust every field.

Bonus-Step: Include a possibility to change the language
I simply added a dropdown here, which contains a hard-coded table with the language abbreviations. Of course, you can also generate this dynamically.

In the OnChange of this DropDown I have inserted a slightly modified form of the code from Step 2. For this I have simply changed the ‘Set’ of the global variable. So you have an easy way to change your language. This code you can also simply reduce to the minimum, put behind images of the country flags at ‘OnClick’.

Set(varLanguage,Self.SelectedText.Value);
Switch(
    varLanguage,
    "en",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "en"
            ),
            "en",
            "Value"
        )
    ),
    "fr",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "fr"
            ),
            "fr",
            "Value"
        )
    ),
    "de",
    ClearCollect(
        colTranslations,
        RenameColumns(
            ShowColumns(
                MultiLanguage,
                "ID",
                "de"
            ),
            "de",
            "Value"
        )
    )
)

Power Apps Combo Box DefaultSelectedItems from Shane Young

A great summary of how to deal with DefaultSelectedItems in a ComboBox and how to set them using a table/lookup or a manuel-created record.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Power Apps SharePoint List Security with Folders from Reza Dorrani

Above all, I have learned the permissions here. I also found the work-around exciting, how to get only the paths of the folders.

Using the functions of a form “OnSuccess” / “OnFailed” … should really be used more often, as it allows greater flexibility.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Implementing Role Based Security in Power Apps from Reza Dorrani

A great overview, but also some interesting tricks about permissions. I was also recently faced with the problem of how to find out if someone is a member of a particular AD group without the AD connector. If I had known this little workaround before, I would have done it exactly the same way. (Have it then solved via a flow query -> whether this person could query a specific list or not)

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Power Apps Performance Optimization Tips from Reza Dorrani

A very good summary of BestPractices about Perfomance optimization of a PowerApp. These things are usually only “learned” when you have already implemented some apps and especially only when there are larger data sets and performance is important. Variables are a great help, but also OnAppStart in combination with Concurrent. It is important to note that if you want to perform multiple Concurrent functions one at a time, when queries reference each other. z.B. -> A category list is first queried and then a different list is asked for.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

How To Use Environment Variables from Daniel Christian

A good demonstration for which you can use the Environment Variable in PowerAutomate and PowerApps, among other things.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Power Apps Custom Theme Generator with the COE from April Dunnam

Using COE (Center of Excellence), it is possible to create and share your own theme with the COE Theme Editor for PowerApps. This allows you to create simple business themes so that everyone has a consistent design.

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Top 25 Power Automate flow tips and tricks from Reza Dorrani

A great summary of Tips & Tricks in conjunction with PowerAutomate Flows. There are some nuggets, which certainly save some nerves and time.

Especially the trick of the compose to create the trigger condition saves you thinking.

This video is a must-have for all those who may be new to the powerautomate topic, but also to those who have been with us for a long time.

Topics:
– Add Comments
– Rename Actions
– Copy & Paste Actions
– Using Scope
– Variables vs. Compose
– Trigger Concitions
– Concurrency flow runs
– Format Text & numbers
– data operations
– error handling

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.

Working With Links In Power Automate Approvals from Daniel Christian

Oh, here Daniel shows how to pack indefinitely many links into an approval. Because the default connector only allows you to add a single value.

Here you will find more hints on how to use e.b. an approval more optimally. -> https://docs.microsoft.com/en-us/power-automate/approvals-markdown-support

You can see this video here on my blog because I have rated this video with 5 stars in my Youtube video library. This video was automatically posted using PowerAutomate.