cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mogulman
Impactful Individual
Impactful Individual

Copy One Field to Another Field

I thought this would be simple.  I'm using an SQL Server connection to an on-premise server.  I have a Client form and I want to copy the Billing address to the Shipping address (attached).  I have a button to trigger copy (CopyBilling2Shipping).  In the OnSelect property of the button I have:

 

OnSelect = ShippingStreetVal.Text = BillingStreetVal.Text  (the Val fields are the datacard value fields).

 

I don't get any errors but nothing happens.  I'm sure there is a simple fix but I've looked around and can't find it.

 

CopyAddress.png

3 REPLIES 3
dinusc
Microsoft
Microsoft

You cannot use simple assignments here as your "ShippingStreetVal.Text" is probably already bound to its parent card value.

You can get some ideas of how this can be done from here:

https://powerusers.microsoft.com/t5/Creating-Apps/How-to-enable-a-Same-as-Shipping-Billing-address-f...

mogulman
Impactful Individual
Impactful Individual

It did give me some ideas on how to solve.

 

1. Used button to set context variable (copyB2S)

2. In each datacard set Default to If(copyB2S, BillingStreetVar.Text,ThisItem.ShippingStreet)

3. On save I refresh data if copyB2S is set and then unset.

SubmitForm(ClientEditFM);If(copyB2S,Refresh('[dbo].[Client]'),false);UpdateContext({copyB2S:false})

v-xida-msft
Community Support
Community Support

Hi @mogulman,

 

Have you solved your problem?

 

I have made a test on my side and please take a try with the following steps:

  • Set OnSelect property of CopyBilling2Shipping button control to following formula:

 

UpdateContext({ButtonPress:true})

 

  • Unlock the DataCard where you want to show copied result.
  • Select the TextInput control within the above DataCard control, set Default property of this TextInput control to following formula:

 

If(ButtonPress=true,BillingStreetVar.Text,Parent.Default)

 

  • Set OnSelect property of Submit button control to following formula:

 

SubmitForm(ClientEditFM);If(ButtonPress=true,Refresh('[dbo].[Client]'),false);UpdateContext({ButtonPress:false})

 

If you have solved your problem, please click "Accept as Solution" so that this thread will be marked for other users to easily identify if your problem is solved.

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,223)