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 / How to hide a label of...
Power Apps
Answered

How to hide a label of a gallery from 2nd records onward

(0) ShareShare
ReportReport
Posted on by 2

I want to hide a label in the gallery from the second records onward, if the label text is not Blank.

 

Please guide is it possible by coding.

 

 

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @MIA27,

    Could you please tell me that you want to hide the label from the second records onward by checking which label is not blank?

     

    If this label is out of the gallery, you could use the following formula for the Visible property of the Label in Gallery

    !IsBlank(Label.Text)&&ThisItem.ID<>1

    Assuming that you have records from SP list and sort by ID

  • MIA27 Profile Picture
    2 on at

    But the field is inside the gallery, not outside.

    So if first record then only show else next onward dont show,

     

    pls guide

     

  • MIA27 Profile Picture
    2 on at

    my gallery is based on Dataverse table in teams, not share point,

     

    so as you know the ID field is not available in Dataverse Table, (auto created same like SP)

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    HI @MIA27,

    So if the first record is not blank, then  hide the second records onward?

    Well, you need to define a primary key in your Dataverse table, so that we could capture the record directly.

     

    We need to capture the first record by this primary key, so does the second onward records.

    Sort by this primary key column by ascending, check if this primary key is the minimum, and check if thisItem is blank using LookUp():

    ThisItem.PrimaryKey=First(SortByColumns(Data,"PrimaryKey",Ascending)).PrimaryKey&&!IsBlank(LookUp(Data,PrimaryKey=First(SortByColumns(Data,"PrimaryKey",Ascending)).PrimaryKey).FieldName)

     

     

  • MIA27 Profile Picture
    2 on at

    I need to apply in the label visible property or in gallery property.

    Getting confused.

     

    I added a field RecoID - set it to autonumber, which will help me find the first record on sorting.

    Will be adding a label inside the gallery template, to fetch RecoID for code to compare

     

    Just for my learning/understanding, how it will be working:

    It will check RecoID = 1st record

    but second part of the code, I am not able to understand as it no space near &&

     

    Sorry, I want to understand, implement and learn, so that the same method can be used at several places as required

     

    Pls. advise

     

     

     

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @MIA27,

    Absolutely the Visible property of the Label you want to hide.

    The formul set for Visible property expects a boolean value like true or false, I provide the formula does return true or false.

     

    The second part is to check if the first record is blank.

    In my formula, you could replace the Primary Key with your RecoID 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard