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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Show a single record i...
Power Apps
Answered

Show a single record in a gallery

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello all,

 

I would like to display a single record in a gallery, not as one data field, but with one data field for each value. Each data field would have the column name, a colon, then the column value. I thought this might be achievable by making a temporary table with columns "key" and "value", but I don't know how to iterate through the record and the table constructor is not flexible. To make the problem more clear, say we have a record like so (maybe it needs to be a single record table):

SampleColumnName1SampleColumnName2SampleColumnName3
SampleValue1SampleValue2SampleValue3

I would like for the output to be a gallery in which the first data field reads "SampleColumnName1: SampleValue1", the second reads "SampleColumnName2: SampleValue2", etc.

 

This may not be possible, but if it is it'll be one heck of a formula. Thanks in advance for your efforts!

Categories:
  • Joel CustomerEffective Profile Picture
    3,224 on at

    why not do a ClearCollect? With ShowColumns you can define whatever columns you want

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-table-shaping

  • eka24 Profile Picture
    20,925 on at
    In one of the label inside the Gallery put; ThisItem.SampleColumnName1&":"&ThisItem.SampleColumnName2 In the second label; ThisItem.SampleColumnName3&":"&ThisItem.SampleColumnName4
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @jlindstrom I'm not sure that you understand. I would like to create a new table with columns "key" and "value", and then for each column in the input record, I would like to make a new record in the table containing that column's name and the original record's value in that column. In excel this would look like going from this:

     

    johnbchron_0-1595442785926.png

     

    to this:

     

    johnbchron_1-1595442823209.png

     

    Sorry I wasn't clear the first time

     

    Also I would like to iterate through this. I can't hardcode the values, because this is going to be part of a component, and the input record is a custom input field in the component.

  • Verified answer
    Joel CustomerEffective Profile Picture
    3,224 on at

    @Anonymous 

     

    I set up a sharepoint list with the fields cake, ice cream, pizza

     

    Here's how it looks in a gallery with multiple records

    food 1.png

    On select of the item in the gallery, I do the following using clearcollect and collect

    ClearCollect(
     ColFood,
     {
     Field: "Cake",
     Field_Value: ThisItem.cake
     }
    );
    Collect(
     ColFood,
     {
     Field: "Ice Cream",
     Field_Value: ThisItem.'Ice Cream'
     }
    );
    Collect(
     ColFood,
     {
     Field: "Pizza",
     Field_Value: ThisItem.Pizza
     }
    )

    I clear collect the first field and then collect the rest

     

    Then I have another gallery or data table that I set the Data Source to ColFood

     

    So when I select one of the rows in my gallery, this is what I see

    food2.png

     

    Pretty much what you were asking

     

    @Anonymous  if this answers your question, please mark it a solution so others can find it

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for replying.

    This would be perfect, really, if not for the fact that I can't hardcode the column values. I need to integrate this into a component that can accept a record with any schema and return it as this kind of table. I have been thinking... maybe the JSON command will be helpful in this case?

  • Joel CustomerEffective Profile Picture
    3,224 on at

    There is an experimental feature to do formulas with dynamic queries. I have no idea if it works with SharePoint https://powerapps.microsoft.com/en-us/blog/authoring-formulas-with-dynamic-schema-in-power-apps/

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This isn't something that I'm trying to develop anymore because I don't want to push too hard into territory that Power Apps doesn't natively support. Thank you for your efforts @jlindstrom, I'm going to mark your answer as the solution because in most cases that would solve the problem.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard