Introduction
We often come across to have different choice values for drop-down depending upon the situation.
In this post, we shall see how to make different choice values for drop-down control, which will appear in either new or edit form. In this example let us look at different forms that will be using the same data source and present different choice values. If we would like to use one form for the entire app. We would just need to put validation and show the choice value for the dropdown.
Scenario
We shall see the form creation only for learning purposes, The form could be customized as per the need. The Formulas could be modified according to our requirements. We shall populate different choice values in the drop-down depending on the requirement.
Objective
Creating a dropdown, especially with the purpose of status, is a common situation. This validation helps to avoid the misuse of the form and business process.
Step 1. The list structure would look like below
Choice values of the Status column look like this.
Step 2. Design screen and form as per requirement
We could either use drop-down values with the concept of different forms or on the same form. We would need to write the formula accordingly. There are two methods through which drop-down values could be bound.
The most important point would be the database column should either be a single line of text to store all types of choice values or if the column type is choice then the choice values should exist so that while storing the item details the app does not throw errors.
Step 3
Method 1. Different forms bind different dropdown value
For example, I have two forms: one is for the requestor, and the other is for the approver. In that case, I would like to show two different values for both roles.
So, the requestor will see the values like (before making any change to the datacard, unlock the datacard through the Advanced tab; otherwise datacard does not allow to make any change).
The advanced tab is highlighted to present that it is unlocked.
The approver’s form would look like the below screen.
The advanced tab is highlighted to present that it is unlocked. The values of the drop-down are shown below.
Method 2. One example of the same form binds the drop-down value
Similarly, we can write any formula, for example logged-in user is part of the submitter group then show a draft and submit otherwise approved and rejected. Here in this example, we are seeing if form mode is new, then show [“Draft”,” Submitted”] otherwise [“Approved”,” Rejected”]
Method 2.1. Two examples of the same form bind drop-down value
Similarly, we can write any formula for and if the status is Submitted from all the statuses, then show one particular set of statuses; otherwise show another.
Step 4. Change Form mode
Change the form mode to new or edit as needed. This step is just for a thought in case the form is not loaded correctly.
Conclusion
Above example, we saw how to bind custom values from in the dropdown from PowerApp. The best way is to handle run time values which should populate dropdown values dynamically depending upon roles and responsibilities. The above scenario is required for specific projects where different phases require different dropdown values.