Power Apps: Forms, Variables, & Collections
Forms
Forms are set up in a
manner akin to galleries, utilizing a drag and drop interface for their
creation and configuration. We have the ability to change the arrangement of
items in our form (referred to as data cards) by simply dragging and dropping
within the interface. Additionally, we can select various options for each of
our fields along with their visibility and editability through the properties.
If we prefer not to allow our users to input data, we can also opt to remove
fields (data cards) from our form.
Just like Galleries, we
have significant design flexibility and can utilize the properties of
individual controls in our form to modify elements such as color and behavior.
By default, forms do not allow users to submit data, this functionality must be
implemented manually by the developer. Depending on your desired form behavior,
there are various methods to achieve this, with the most common being a
clickable button on the canvas that sends the data entered into the form to the
database, thereby creating a new record.
Start by placing a button
onto your canvas. Next, utilize the OnSelect property of the button to include
the formula SubmitForm(Form1). By using the OnSelect property, the formula will
execute every time the button is clicked or selected by the user. The
SubmitForm formula is a standard Power Apps formula that is designed to send
data to a specified data source provided in the function's parameters.
Power Apps offers more
sophisticated methods for generating new records in data sources through the
Patch function. This function provides greater control and flexibility
regarding the submission of your data.
Variables &
Collections
Creating Variables
A phone book can be
viewed as a directory for storing contacts, allowing us to add, delete, or
update the names and numbers of individuals. Whenever we consult this phone
book, we have access to the most current contacts available to us. A variety of
data types can be held in variables, including colors, numbers, table records,
and strings. Additionally, these values can be modified within our application
by applying the same formula while altering the value.
Using Variables
We can reference any
variable we’ve created within formulas by using its name. Variables are stored
in a local context, which means they are established and removed based on the
app's workflow. When the application is closed, the variables are erased and
will be set up again the next time the app is launched or accessed, and this applies
to collections as well.
Collections
A collection serves as a
local table that exists in the environment where the application operates. They
enable us to set up and maintain data in a table format, which can be accessed
similarly to a variable by using the collection's name. In the formula bar, we
can utilize Collect, specify a name for our collection, and then designate a
column name followed by the value we wish to insert into that table or
collection. We can view our collection inside the Power Apps Studio under the
Variables tab in the App Authoring Menu along with any other variables that
exist in our app.
Conclusion
We have successfully
learnt about forms as well as variables and collections.
Comments
Post a Comment