Power Apps | CookBook

Inhaltsverzeichnis [Anzeigen]

Components

Button

Enable Button depending on multipe Conditions (e.g. Dropdowns are selected):

Set OnChange of Coomponents:

Set DisplayMode of Component:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
If(IsBlank(Radio1.Selected.Value), DisplayMode.Disabled, DisplayMode.Edit)
If(IsBlank(Radio1.Selected.Value), DisplayMode.Disabled, DisplayMode.Edit)
If(IsBlank(Radio1.Selected.Value), DisplayMode.Disabled, DisplayMode.Edit)

DropDown

Populate Dropdown

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Switch(
<Dropdown>.Selected.Value,
"Value A", "a",
"Value B", "b",
"Value C", "c",
<Dropdown>.Selected.'name '
)
Switch( <Dropdown>.Selected.Value, "Value A", "a", "Value B", "b", "Value C", "c", <Dropdown>.Selected.'name ' )
Switch(
    <Dropdown>.Selected.Value,
    "Value A", "a",
    "Value B", "b",
    "Value C", "c",
    <Dropdown>.Selected.'name '
) 

Populating dropdown which depends on selection of a control

OnVisible property of Screen:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ClearCollect(defaultDemands, Defaults(Demands));
Clear(defaultDemands);
Patch(defaultDemands, Defaults(Demands), {Name:"Select Product"})
ClearCollect(defaultDemands, Defaults(Demands)); Clear(defaultDemands); Patch(defaultDemands, Defaults(Demands), {Name:"Select Product"})
ClearCollect(defaultDemands, Defaults(Demands));
Clear(defaultDemands);
Patch(defaultDemands, Defaults(Demands), {Name:"Select Product"})

Items property of dropdown you can choose between the two collections depending on the state of the radio selection:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
If(
IsBlank(<Radio>.Selected.Value),
defaultDemands,
Filter(ProductDemands, ProductValue = <Radio>.Selected.Value)
)
If( IsBlank(<Radio>.Selected.Value), defaultDemands, Filter(ProductDemands, ProductValue = <Radio>.Selected.Value) )
If(
    IsBlank(<Radio>.Selected.Value),
    defaultDemands,
    Filter(ProductDemands, ProductValue = <Radio>.Selected.Value)
)

JSON

Extract Value from JSON

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Match(
jsonString,
"""elementName"": *""(?<value>[^""]+)"
).value
Match( jsonString, """elementName"": *""(?<value>[^""]+)" ).value
Match(
    jsonString, 
    """elementName"": *""(?<value>[^""]+)"
).value

Styling

Color

Set Color of Button:

Define a variable with the desired color in App.OnStart

Set BasePalletColor of Component to this variable: