How to copy Power Apps Data Card value to another

This Power Apps tutorial will discuss how to copy a Power Apps Data Card to another.

Recently, I was working on a requirement where I needed to copy the Power Apps Data Card value to another field. To achieve this need, we will follow the below instructions.

Power Apps copy Data Card Value to another field

Here, we will discuss how to copy Power Apps Data Card Value from one field to another.

Requirement:

When the user clicks the button after filling out the form, the information will be copied from the Billing Details form to the Shipping Details form. Furthermore, once copied, clicking another button will submit data to the appropriate SharePoint list.

PowerApps copy value to another field 1
PowerApps copy value to another field

Here, we have two SharePoint lists for Product Billing and Product Shipping, having several columns such as:

  • Product Title: Single-line text (in both lists)
  • Billing Street, Shipping Street: Single-line text (in both lists respectively)
  • Billing City, Shipping City: Single-line text
  • Billing State, Shipping State: Single-line text
  • Billing Zip, Shipping Zip: Number type
  • Billing Country, Shipping Country: Single-line text
  • Billing Date, Shipping Date: Date and time type

Product Billing:

Power Apps copy value to another field
Power Apps copy value to another field

Product Shipping:

Copy Power Apps value to another field
Copy Power Apps value to another field

To fulfill the requirement, now we will create two Power Apps edit forms (i.e., Product Billing Details and Product Shipping Address) using the above SharePoint lists (Product Billing and Product Shipping).

To create the edit forms within the Power Apps, the following steps are:

  • On the Power Apps, build a blank canvas app.
  • It will redirect to the Power Apps screen where we can add and build edit forms.
  • Add the above-mentioned SharePoint lists to the Power Apps.
  • Let’s add an edit form and connect it to the one SharePoint list Or select one edit form and insert the SharePoint list name on the edit form’s DataSource property.
DataSource = 'Product Billing'

Where ‘Product Billing’ is the name of the SharePoint list. Once the data source is connected to the Power Apps edit form, it will retrieve all the fields from the SharePoint DataSource.

Connect SharePoint Data Source to Power Apps edit form
Connect SharePoint Data Source to Power Apps edit form
  • Similarly, add another Power Apps edit form to the above screen and connect it with another SharePoint list i.e., Product Shipping.
DataSource = 'Product Shipping'
Copy PowerApps value to another field
Copy PowerApps value to another field
  • According to the specification, we need to copy the field values from the Product Billing Details form to the Product Shipping Details.
  • Add a Power Apps button control to the app and give a text to the button on the button’s Text property.
Text = "Click here to copy Billing to Shipping"
Power Apps copy field value to another field
Power Apps copy field value to another field
  • Let’s insert the below expression on the button’s OnSelect property to create an update context variable.
OnSelect = UpdateContext({ButtonPress:true})

Where ButtonPress is the name of the Update Context variable and value is true.

How to copy PowerApps value to another field
How to copy PowerApps value to another field
  • Next, on the second edit form (Product Shipping Details), unlock all the Data Cards to change their properties.
  • Select the Product Title’s TextInput field and insert the below expression on the TextInput’s Default property.
Default = If(ButtonPress=true, BTitleDataCardValue.Text, Parent.Default)

Where, BTitleDataCardValue refers the name of the Product Title‘s field value from the first edit form (Product Billing Details).

How to copy PowerApps field value to another field
How to copy PowerApps field value to another field
  • Similarly, set the default properties of the other fields(on the Product Shipping Details) by using the Product Billing Details form’s fields.
Default = If(ButtonPress=true,BStreetDataCardValue.Text,Parent.Default)      //On Shipping Street's TextInput
Default = If(ButtonPress=true,BCityDataCardValue.Text,Parent.Default)         //On Shipping City's TextInput
Default = If(ButtonPress=true,BStateDataCardValue.Text,Parent.Default)      //On Shipping State's TextInput
Default = If(ButtonPress=true,BZipDataCardValue.Text,Parent.Default)         //On Shipping Zip's TextInput
Default = If(ButtonPress=true,BCountryDataCardValue.Text,Parent.Default)     //On Shipping Country's TextInput
DefaultDate = If(ButtonPress=true,BDateDataCardValue.SelectedDate,Parent.Default)  // On Shipping Date's DatePicker

Where, BStreetDataCardValue, BCityDataCardValue, BStateDataCardValue, BZipDataCardValue, BCountryDataCardValue, and BDateDataCardValue are the name of the field values of the Product Billing Details from.

Copy Data Card fields to another in Power Apps
Copy Data Card fields to another in Power Apps
  • To submit the copied data to the data source, add a Save icon to the app and insert the below expression on the Save icon’s OnSelect property.
OnSelect = SubmitForm(ProductShippingForm);SubmitForm(ProductBillingForm);If(ButtonPress=true,Refresh('Product Shipping'),false);UpdateContext({ButtonPress:false});NewForm(ProductShippingForm);ResetForm(ProductBillingForm); ResetForm(ProductShippingForm)

Where ProductShippingForm and ProductShippingForm are the name of the edit forms respectively.

Copy Data Card fields to another in PowerApps
Copy Data Card fields to another in PowerApps

That’s all! Let’s save and publish the app. Open the app in preview mode and fill out all the fields on the Product Billing Details form. Once we click on the button, all the fields values will be copied and reflected those copied data on the another form (Product Shipping Details).

Copy DataCard fields to another in Power Apps
Copy DataCard fields to another in Power Apps

Then, click on the Save icon to save those data to the respective SharePoint lists as shown below:

Power Apps copy Data Card value to another field
Power Apps copy Data Card value to another field

This is how to copy Power Apps Data Card Value to another field.

See also  Power BI combine columns from two tables

Conclusion

From this Power Apps Tutorial, we learned how to copy Power Apps Data Card Value to another field.

You may like the following power apps tutorials:

>