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)

 

How to send a 1:1 message via flow in teams with your account

Photo by Erik Mclean on Pexels.com

In this article I will show you how to send direct messages easily.

For a long time it was not possible to send a direct message via PowerAutomate to a user where I am the sender. It was only possible to communicate with someone as a flow bot.

Spoiler: According to my tests, this only works with Tenant users.

Step 1
Here we simply create a ‘Create a chat’ using the Teams connector. Under ‘Members to add’ you just need to enter the desired recipient.

Attention: As soon as you add more than one person, you will open a group chat -> where you can enter a name in the lower column.

Step 2
Select ‘Post message in a chat or channel‘ from the Teams connector here.

Then select as in the picture ‘Post as‘ -> User
and ‘Post in‘ -> ‘Group chat’ (Yes this is confusing, however this works)
Then in the ‘Group chat‘ field just refer to the conversation id from the previous step and you can enter your desired text under Message.

UseCases

  1. On the one hand, support accounts can send a message directly (via PowerAutomate) from a PowerApp (Canvas, ModelDriven) and you thus have a contact person right away.
  2. During on-boarding, for example, it also works better if you are received and greeted ‘personally’.

SharePoint Approval Timeline | Power Automate Approvals + Column Formatting + Approval History from Reza Dorrani

A really great video. Here you will learn how to create dynamic statuses in a SharePoint list, which include an approval process including history. I already think the idea is great, although of course I would much rather implement this in a PowerApp – but I have to admit that I could never implement this so quickly with a 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.

PowerApps Performance Boosting Tips from Paul O’Flaherty

This is one of the best videos I’ve seen about PowerApps Performance Boosting. Here you get a summary of many small rules in a short time, which will increase your app speed enormously.

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: Refresh Is Killing Your App Performance! Here’s an alternative method. from Paul O’Flaherty

Great demo start, how to refresh used data, which have been updated, best. In such a way that the performance of the app runs optimally.

Above all, I found the idea with the UpdateContext exciting, but also that PowerApps query which are identical, only perform every 30 seconds and block all identical queries until then. But to bypass this with a variable is just awesome.

Important: You only need Refresh() if the data is changed from outside the PowerApp OR you are using one of the tricks from this video.

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 UpdateIf – How to use and how to deal with it NOT being delegable from Shane Young

The good thing is that so far I did not have UpdateIf always ready in my memory. For “updating” datasets on resource level this will probably still not be in my memory. But for updating a collection this is quite helpful. ATTENTION small note: UpdateIf is NOT delegable.

In addition, the monitoring is shown, which often gives very exciting insights, especially if you want or need to optimize the performance.

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.

PowerApps Coalesce Function – Return non blank values from Shane Young

Coalesce replaces if(isblank()) and you only need to use this one for several checks and don’t need to nest it.

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.

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.