Live Developer Training: next batch coming soon. Be the first to know.Live training: next batch soonJoin the waitlist →Join →

Set Field Value From Another Field In Power Apps [5 Examples]

When working with Power Apps applications, we can usually build an app using different fields and set a field value based on another field.

In this Power Apps tutorial, I will show you working with Power Apps set text input value based on another field and how to use the Power Apps onchange update another field.

Additionally, we will also cover the below topics. Such as:

  • Power Apps auto populate field based on another field
  • Power Apps set default value for dropdown based on another field
  • Power Apps set the variable to the field value

1. Power Apps set text input value based on another field

I have a SharePoint Online list [Product Details] and this list contains the below fields.

Column NameData Type
Product NameIt is a default single line of text
PriceCurrency
Purchase DateDate and time
powerapps set text input value based on another field

In Power Apps, there are three Text input controls [Product Name, Product Price, and Product Purchase Date]. Whenever the user searches for a specific product name in the first text input control, the remaining text input controls [Price and Purchase Date] display the values automatically for the specific product name.

powerapps onchange update another field

To work around this, follow the below steps.

1. On the Power Apps screen, insert a Text input control and set its Default property as blank.

powerapps auto populate field based on another field

2. Then, insert another Text input control and set its Default property to the code below:

Default = LookUp(
    'Product Details',
    Title = txt_ProductName.Text,
    Price
)

Where,

  • ‘Product Details’ = SharePoint Online list
  • txt_ProductName = Text input control name for Product name
  • Price = SharePoint list currency column
power Apps auto populate field based on another field

3. Similarly, insert another Text input control and set its Default property as:

Default = LookUp(
    'Product Details',
    Title = txt_ProductName.Text,                  //For purchase Date
    'Purchase Date'
)

4. Once your app is ready, Save, Publish, and Preview the app. Once you search for any product name in the first text input control, the remaining text input controls display specific product details [Price and Purchase Date], as shown below.

power apps onchange update another field

2. Power Apps onchange update another field

To work with Power Apps onchange update another field, refer to the example below:

In Power Apps, there is an Edit form that is connected to the SharePoint list [Product Details].

Now, I would like to notify the warning message when the user forgets to enter the product name. If the user enters any product name, the warning message will disappear using the OnChange property.

Output:

powerapps on change update another field

To achieve it, follow the below steps. Such as:

1. On the Power Apps Screen, insert an Edit form control and set its DataSource as:

DataSource = 'Product Details'