web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use Choice/Person fiel...
Power Apps
Unanswered

Use Choice/Person fields in ShowColumns function

(0) ShareShare
ReportReport
Posted on by 30

Hello Community,

 

Please bear with me as I am new to Power Platform. 

 

My Question is how can we use Choice or Person fields in 'ShowColumns' function in PowerApps?

 

Ex: ClearCollect(collectionA, ShowColumns(Student, "ID", "Name", "Country", "Mentor"))

 

In here Country is a 'Choice Field' and Mentor is a 'Person Field' in SharePoint. I want to get the Display Name of the 'Mentor' and Value of the Country.

 

In my Gallery control I can use 'Mentor.DisplayName' and 'Country.Value' but in ShowColumns function it doesn't allow to use the same way.

 

Please help.

 

 

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,508 Super User 2024 Season 1 on at

    The ShowColumns function includes columns of a table and drops all other columns. You can use ShowColumns to create a single-column table from a multi-column table. ShowColumns includes columns, and DropColumns excludes columns.

    Essentially this will provide you a collection with a table of "ID", "Name", "Country", "Mentor". What do you want to do with that collection? You can then use LookUp function to get values from this collection.

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218

  • Sanj_ Profile Picture
    30 on at

    Hello @phipps0218 

     

    Thank you for your prompt response. 

     

    'Mentor' is a person field and 'Country' is a choice field in SharePoint. If I used the below method, it doesn't give me the the values for 'Mentor' and 'Country'.

     

    ClearCollect(collectionA, ShowColumns(Student, "ID", "Name", "Country", "Mentor"))

     

    Simply I want to get the DisplayName of 'Mentor' and Value of 'Country' when creating collection.

     

    Like:

    ClearCollect(collectionA, ShowColumns(Student, "ID", "Name", "Country".Value, "Mentor".DisplayName))

     

     

     

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Sanj_ ,

    You can call the added columns anything except the original names

    ClearCollect(
     collectionA, 
     ShowColumns(
     AddColumns(
     Student,
     "Nationality",
     Country.Value,
     "Teacher",
     Mentor.DisplayName
     ),		 
     "ID", 
     "Name", 
     "Nationality", 
     "Teacher" 
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Sanj_ Profile Picture
    30 on at

    Hi @WarrenBelz 

     

    It worked for me. Thanks a lot. 🙂 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard