cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zeuslyone
Microsoft
Microsoft

Convert "Control" data type to Text

Hello all,

 

I've been working on sort buttons, which aren't a problem, but I've hit a snag. I created a sort button for an added column that is a choice column without issue (like in this thread), but when I tried it for another similar policy, I kept getting this error message for the column I was trying to add. Apparently, this column is a "control" data type which isn't even listed here. I looked at the SharePoint list, and that column is tied to a group in my organization -- I can only assume that this is what "Control" is in this case. I can't find any way to convert these values to text (neither with .Value or with Text()). Does anyone have any solution for dealing with this? The best I can come up with is some sort of duplication of the value in that field in the SharePoint list but as a text value, but I'd prefer if there were a function in PowerApps I could use.

 

PowerAppControl.JPG

 

Best,

Z

1 ACCEPTED SOLUTION

Accepted Solutions

@zeuslyone
I would try replacing "PM Name", AssignedPM.Value with the following code

"PM Name", AssignedPM.DisplayName

A person record has several properties and I’m not sure what Value represents but DisplayName should return a Text data type instead. As a general rule when working with a complex column the property will be different than .Value

—-
Please Accept as Solution if this post answered your question so others can find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@zeuslyone
Please share your code and tell us what control/property you’ve placed it within.

This happens when I try to add a new column which changes the column into text that could be sorted. This function below works (just changed the source name to generic for sharing) until I add the underlined red text. I'm not sure what you mean about what "control/property you've placed it within" -- I didn't create this app, rather editing it for a colleague, but as I said, on the SharePoint end, the column is set to: "Type - Person or Group", and on the PowerApps end is set to: "FieldType: Complex"

SortByColumns(AddColumns(Source Name, "Source", SourceQuarter.Value, "PM Name", AssignedPM.Value), Sortfield, If(SortDirection, Descending, Ascending))

 

Let me know what else I can clarify. Thanks!

Best,

Zack

@zeuslyone
I would try replacing "PM Name", AssignedPM.Value with the following code

"PM Name", AssignedPM.DisplayName

A person record has several properties and I’m not sure what Value represents but DisplayName should return a Text data type instead. As a general rule when working with a complex column the property will be different than .Value

—-
Please Accept as Solution if this post answered your question so others can find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

Thank you, @mdevaney ! I appreciate the help and the educational explanation. I'm still figuring my way around the syntax here, so I appreciate the helpful patience.

@zeuslyone 

No problem at all. 

 

I cannot seem to find any documentation for people objects but you can always type AssignedPM. (make sure to type the period too) and then see what fields are available in the autocomplete.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,187)