cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Convert Text to Record

Hello Experts,

I have a SPList with 3 columns:

  1. ItemsList
  2. UserA (as 'Person or group')
  3. UserB (as 'Person or group')

And in Powerapps, I have the following gallery:

 

Gallery1 - Items=Filter(SPList, ItemsList="1")

Label1 - Text=UserA.DisplayName

 

When I use this Patch function on a button:

Patch(SPList,Filter(SPList,ItemsList="1"),{UserB:Label1.Text})

 

I have the following error: 'UserB' expect 'Record? type, but find 'Text' type.

 

How can I change Text value to Record value?

Anyone can help me?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Convert Text to Record

Hi @luisep,

Please add another label to display Manager's Email in Gallery_1, set Text property: ThisItem.Manager.Email

then try this code:

 

Patch(SPList2,LookUp(SPList2, Invoice=Label_Invoice.Text),{Department:Label_Department.Text, Approver:
{
Claims:"i:0#.f|membership|" & Label_ManagerEmail.Text,
Department:"",
DisplayName: "",
Email: "",
JobTitle:"",
Picture:""
}
})

 

Note: Label_ManagerEmail can be invisible if you don't want to display it.

Sik

View solution in original post

9 REPLIES 9
Highlighted
Super User
Super User

Re: Convert Text to Record

@luisep 

The patch should look like this but you'll have to replace the references to the user's name and email with your own.

Patch(
    SPList,
    LookUp(SPList,ItemsList="1")
    {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|yourname@yourcompany.com",
        Department:"",
        DisplayName:"Your Name",
        Email:"yourname@yourcompany.com",
        JobTitle:"",
         Picture:""
   }
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper I
Helper I

Re: Convert Text to Record

Thanks @mdevaney ,

But I don't want to Patch my own User.

 

In column UserA, I have a lot of users that I would like to patch in column UserB, when filter condition is matching.

 

KR

Highlighted
Super User
Super User

Re: Convert Text to Record

@luisep 

You will have to provide a screenshot.  I do not understand what you are attempting to do.

Highlighted
Community Support
Community Support

Re: Convert Text to Record

Hi @luisep 

 

Could you please share more about your scenario?

Do you mean you want to patch UserA to UserB that the record meets the filter condition?

 

If the button is inside the Gallery, please try this, it will save UserA from selected record to UserB.

Patch(SPList,LookUp(SPList,ID= ThisItem.ID),{UserB:UserA})

Snipaste_2020-03-04_15-19-14.png

If this doesn't make sense, please share more information.

Sik

 

Highlighted
Helper I
Helper I

Re: Convert Text to Record

Hi @v-siky-msft , @mdevaney ,

Please find screenshot.

I'll explain my scenario:

- SPList1 with Department and Manager columns

- SPList2 with Invoice, Approver and Department columns

 

And in Poweapps:

 

Gallery_1: all data of SPList1

Gallery_2: only with Invoice registers.

 

For example, if I select from Gallery_1 register 'E-Tom' and from Gallery_2 select invoice '4', I want to Patch in SPlist2 (in register Invoice #4), 'Tom' as Approver and 'E' as a Department.

Patch(SPList2,Invoice=Label_Invoice.Selected,{Department:Label_Department.Selected},{Approver:Label_Manager.Selected})

 

But my issue is in {Approver:}, because 'Label_Manager' is text register, and I need Record register to patch it in Approver column (SPList2).

 

I hope I've clarified my scenario.

 

Kind regards

Highlighted
Helper V
Helper V

Re: Convert Text to Record

You could try something like this:

 

Create a label. In properties, set Text to:

LookUp(datasource, name = "fred", namefield)
or to get the first row and attribute from table:

First(datasource).attribute

 

I hope this helps!

Admin

Apps4rent

Highlighted
Helper I
Helper I

Re: Convert Text to Record

Thanks @Max44 ,

But it doen't work. It the same in my scenario, in Galery1 - Label_Manager.

 

I need to change text type to record type.

 

Kind regards

Highlighted
Community Support
Community Support

Re: Convert Text to Record

Hi @luisep,

Please add another label to display Manager's Email in Gallery_1, set Text property: ThisItem.Manager.Email

then try this code:

 

Patch(SPList2,LookUp(SPList2, Invoice=Label_Invoice.Text),{Department:Label_Department.Text, Approver:
{
Claims:"i:0#.f|membership|" & Label_ManagerEmail.Text,
Department:"",
DisplayName: "",
Email: "",
JobTitle:"",
Picture:""
}
})

 

Note: Label_ManagerEmail can be invisible if you don't want to display it.

Sik

View solution in original post

Highlighted
Helper I
Helper I

Re: Convert Text to Record

Hi @v-siky-msft ,

Now it's works perfect.

 

Thanks a lot.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020 Winner Announced

Check it out!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (11,429)