Using Controls and Power FX In MS Teams Canvas Apps [Building Power Apps In Microsoft Teams Ep. 2]
Power Apps
24. Dez 2022 14:00

Using Controls and Power FX In MS Teams Canvas Apps [Building Power Apps In Microsoft Teams Ep. 2]

von HubSite 365 über Pragmatic Works

Citizen DeveloperPower AppsM365 Hot News

In this second video of Matt’s new series he shows how to start setting up your first screen of the check-in application. Aside, from showcasing how to use text

PowerApps Switch

In Power Apps, the Switch function allows you to evaluate a series of conditions and return a result based on the first condition that is true. It is similar to the IF function, but it can test multiple conditions and return a result for the first one that is true, rather than requiring you to nest multiple IF functions.

Here is an example of how to use the Switch function:

Switch( condition1, result1, condition2, result2, ... defaultresult )

The condition arguments are the conditions that you want to test, and the result arguments are the values that should be returned if the corresponding condition is true. The defaultresult argument is optional and is the value that should be returned if none of the conditions are true.

For example, the following formula uses the Switch function to test whether a score is greater than or equal to 90, 80, or 70, and returns a letter grade based on the score:

Switch(
   Score >= 90, "A",
   Score >= 80, "B",
   Score >= 70, "C",
   "F"
)

This formula will return "A" if the score is greater than or equal to 90, "B" if the score is greater than or equal to 80 but less than 90, "C" if the score is greater than or equal to 70 but less than 80, and "F" if the score is less than 70.

PowerApps If

In Power Apps, the "If" function is a control structure that allows you to specify a set of conditions, and to perform different actions depending on whether those conditions are met.

Here's an example of how you might use the "If" function in Power Apps:

If(Condition1, Action1, Action2)

This function will first evaluate the "Condition1". If the condition is true, it will execute "Action1". If the condition is false, it will execute "Action2".

Here's a more concrete example:

If(Dropdown1.Selected.Value = "Option1", Set(Var1, "Value1"), Set(Var1, "Value2"))

In this example, the "If" function is checking the value of a dropdown control called "Dropdown1". If the selected value of the dropdown is "Option1", the function will set the value of a variable called "Var1" to "Value1". If the selected value of the dropdown is not "Option1", the function will set the value of "Var1" to "Value2".

The "If" function is a very powerful and flexible tool that can be used to create complex logic and control flow in your Power Apps. It is often used in combination with other functions, such as the "And" and "Or" functions, to create more sophisticated conditions.