cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramole
Post Prodigy
Post Prodigy

Patch a copy existing Lookup field in the same list

Hi

can you help me please, i would like to make a copy and RE patch all existing, a field in my the data source and field name is Company.Value = Lookup  copy alse to CompanyName = Single line of text

 

 

Thanks 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Ramole

If you want to copy all the existing lookup field value to Text field, I have provided the solution in my previous reply. There is no need to insert a Checkbox in a Gallery and another one outside the Gallery. 

If you insist on this, please check the formula as below.

ForAll(
    Gallery2.AllItems,
    If(Checkbox.Value,
       Patch(
        TravelPlans,
              LookUp(
                     TravelPlans,
                     ID = Value(Subtitle3.Text)
                     ),
                     {Title: Title3.Text}
              )
         )     
       )     

Hope it could help you.

Regards,

Qi

View solution in original post

5 REPLIES 5
v-qiaqi-msft
Community Support
Community Support

Hi @Ramole,

Do you want to copy a LookUp field value to a Text field?

Could you please tell me that if you want to edit a record or create a new record?

Actually, a LookUp field value is a type of record, if you want to access the value within, you should refer it as below:

LookupField:{  
         '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
         Id: <ID in the list where the Lookup filed looks up from>   
         Value: <Value in the list where the Lookup filed looks up from>
      }

So, the ID is in the list where the Lookup field retrieve value from.

Please check the thread as below:

Solved: Re: Patch from LookUp to Text Field in Sharepoint ... - Power Platform Community (microsoft....

Hope it could help you.

Regards,

Qi

Hi @v-qiaqi-msft 

 

Yes i would to copy all existing the lookup to text field 

i need to edit the existing record

 

 

Thanks 

 

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Hi @Ramole,

Do you want to patch all the LookUp field values to the Text field, patch as below?

LookUpField TextField
Value1 Value1
Value2 Value2
Value3 Value3
Value4 Value4

Or you just want to update the Text field with all the same value?

Edit as below:

I assume that you want to update a whole Text column with the whole LookUp field value,right?

I have a test on my side, please take a try as below.

Add a Button and set the OnSelect

ClearCollect(Test2,ShowColumns(AddColumns(TravelPlans,"NC",CountryLookup.Value),"ID","NC"))

Add a Gallery and set the Items as below:

Test2

Set the Text of the Labels within as below:

ThisItem.NC
ThisItem.ID

Add a Button and set the OnSelect

ForAll(
    Gallery2.AllItems,
    Patch(
        TravelPlans,
        LookUp(
            TravelPlans,
            ID = Value(Subtitle3.Text)
        ),
        {Title: Title3.Text}
    )
)

Note that the TravelPlans is my SP list and the CountryLookup is my LookUp field name. 

Subtitle2 represents the Label corresponding to the ID, and the Title3 represents the Label corresponding to the ID.

Hope it could help.

Regards,

Qi

Hi @v-qiaqi-msft 

 

Can i use a checkbox on Oncheck the formula  example i would like to add a checkbox inside the gallery and one Outside gallery if select outside gallery it will select all, or unchecks all, is possible ?

 

 

Thank you for your help 

 

 

 

 

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

Hi @Ramole

If you want to copy all the existing lookup field value to Text field, I have provided the solution in my previous reply. There is no need to insert a Checkbox in a Gallery and another one outside the Gallery. 

If you insist on this, please check the formula as below.

ForAll(
    Gallery2.AllItems,
    If(Checkbox.Value,
       Patch(
        TravelPlans,
              LookUp(
                     TravelPlans,
                     ID = Value(Subtitle3.Text)
                     ),
                     {Title: Title3.Text}
              )
         )     
       )     

Hope it could help you.

Regards,

Qi

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (65,493)