Power Apps have one pretty big problem, resulting from the whole logic of how it works.

It is not possible to have code and call it from various other items or codes. This could lead to a desperate overcomplication, when one code takes place on many places.

So what to do?

We will do this by creating an item (for example, a Toggle), and from various other places in the application we will change its value. Then we put the code that we want to run to the OnChange property of this item.

Creating an element with an OnChange property

Insert e.g. Toggle and define its OnChange property with the code we want to call:

Define some property (for example Default), by variable.

Change the value of item > call code

From now we can run the code by simple changing the variable = changing the value of item. In this example we are simply switching true to false and false to true.

The toggle can be set to invisible, off course.

Leave a Reply

Your email address will not be published.

*

clear formPost comment