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.
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:
Product Shipping:
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.
- 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'
- 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"
- 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.
- 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).
- 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.
- 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.
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).
Then, click on the Save icon to save those data to the respective SharePoint lists as shown below:
This is how to copy Power Apps Data Card Value to another field.
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:
- How to change Power Apps DataCard to dropdown
- How to Update DataCard Value in Power Apps
- How to get month name from date in Power Apps
- Power Apps Notify() function
- How To Set Default Date in Power Apps Date Picker
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.