cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Martin_W
Helper III
Helper III

Frustrated! Copy from one field to another

hi again,

 

I'm finding PowerApps really frustrating! Things that would have been simple in say, VB, seem unduly obscure in Power Apps.

 

When I created my data source, (imported from Excel, I made the cardinal error of putting my first column, JobNumber, in the Title column. Realising my error, I created a new column to put the data in. I just need to code something to copy the value from the Title field to the new column. At first I thought it was that there was something special about the Title field that meant I couldn't copy it, but I'm also finding the same with any other number field.

 

I've tried ForAll, Update, UpdateIf etc and none of them work.

 

It should, surely, be as simple as writing a For loop that cycles through the collection, copying the Title field value into the JobNumber field. No For loop exists apparently in PowerApps. 

 

There doesnt seem to be any way to do this which is really irritating. I wouldnt have minded if I had to write a small amount of code to do this as a one off, but it can't be done!

 

I've even tried editing the source in Lists, but there seems to be no way to take the selected Excel cells, copied to the clipboard, and drop that into the list for a whole column.

 

Surely this must be possible? I mean, suppose I write a quotation with a proposed value of x, when the purchase order come in, there should be a means of copying the value x into another field (say 'POValue'). as far as I can tell that doesn't seem possible? Even UpdateIf seems to only work with constants.

 

The documentation seems poor as well, compared to say, earlier versions of VB. 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @Martin_W 

I understand how frustrating this is for you.

In your case, you can copy all the values from one field to another by calling the UpdateIf function. The syntax would like like this.

UpdateIf(YourDatasource,
         True,
         {JobNumber:Title}
)

 

View solution in original post

3 REPLIES 3
timl
Super User
Super User

Hi @Martin_W 

I understand how frustrating this is for you.

In your case, you can copy all the values from one field to another by calling the UpdateIf function. The syntax would like like this.

UpdateIf(YourDatasource,
         True,
         {JobNumber:Title}
)

 

Martin_W
Helper III
Helper III

Hi @timl 

 

Thanks for your prompt message. Your suggestion worked - but first I had to find a way of converting the Title field from text to a numeric data type. Why Microsoft couldn't retain functions like CInt from earlier languages I don't know! I did eventually find the Value function.

 

So - thanks for your help!

 

Martin

timl
Super User
Super User

You're welcome @Martin_W - just for reference in case it's useful, the Text function carries out this task in the other direction - eg, it converts a number to text.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,875)