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 add serial numb...
Power Apps
Answered

How to add serial number in text property of label in gallery ?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

I have a gallery in which I have added labels to display list item. text property of each label, I am using ThisItem.ColumnName. This is working fine and data is showing correctly in the gallery. Now I have added another label called "labelSerialNumber' to show the serial number like 1,2,3. On text property of 'labelSerialNumber' = varCountRow . In all rows it's showing 0 which I have set the value in the variable. Please help to resolve this issue.

On button click below code:-

Set(varCountRow,0);
ClearCollect(colSPListItemsAB,(Filter(collectionHSRH,
Created >= datePickerFromAB.SelectedDate || IsBlank(datePickerFromAB.SelectedDate),
Created <= datePickerToAB.SelectedDate || IsBlank(datePickerToAB.SelectedDate),
Status.Value = ddlStatus.Selected.Value || IsBlank(ddlStatus.Selected.Value)
))
);

ForAll(
Sequence(CountRows(colSPListItemsAB)),
varCountRow = varCountRow +1;
);

Thank you so much !!

 

Categories:
I have the same question (0)
  • Verified answer
    NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi @Anonymous,
    Try using below formula - 
    ClearCollect(colSPListItemsAB, Filter(collectionHSRH,
    Created >= datePickerFromAB.SelectedDate || IsBlank(datePickerFromAB.SelectedDate),
    Created <= datePickerToAB.SelectedDate || IsBlank(datePickerToAB.SelectedDate),
    Status.Value = ddlStatus.Selected.Value || IsBlank(ddlStatus.Selected.Value)
    ));
    Clear(colTemp);
    ForAll(colSPListItemsAB As Data, Collect(colTemp,Last(FirstN(AddColumns(colSPListItemsAB,"SerialNumber",
    CountRows(colTemp)+1), CountRows(colTemp)+1)) ))

    Use colTemp in Items property of your Gallery

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    In ForAll function, you are setting the value of the varCountRow variable instead of setting the value of the Text property of the label. you can use the following formula to set the value of the 'labelSerialNumber' label ->

    Text(varCountRow + 1)

     

    Try this one - 

    Set(varCountRow, 0);
    ClearCollect(colSPListItemsAB, Filter(collectionHSRH,
     Created >= datePickerFromAB.SelectedDate || IsBlank(datePickerFromAB.SelectedDate),
     Created <= datePickerToAB.SelectedDate || IsBlank(datePickerToAB.SelectedDate),
     Status.Value = ddlStatus.Selected.Value || IsBlank(ddlStatus.Selected.Value)
    ));
    ForAll(colSPListItemsAB,
     Set(varCountRow, varCountRow + 1)
    );

     

    Let me know if this helps

    Thanks 😀

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @NandiniBhagya20 ,

    Thank you. two thing needs to set.

    1. colTemp in Items property of  Gallery

    2. ThisItem.SerialNumber in the text property of label.

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 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard