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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Adding a RowNo to an already complicated Items property

(1) ShareShare
ReportReport
Posted on by 714 Moderator
@WarrenBelz Since it was your initial brilliance that provided this beautiful logic, I return to you once again for guidance. :D
 
I made one change to the last version you provided since it was returning an empty row at the top of the gallery occasionally. I added a !IsBlank to the Question and Answer and the gallery is clean now.
 
Now, for purely asthetic reasons, I'd like to add a RowNo to the Items so I can affect visual elements inside the gallery.
 
You've helped me do that in the past and I thought maybe I could modify the below to add the sequence and then update the list but can't.
 
If(
   Len(txtFrmQuestion.Text) > 4,
   With(
      {
         _Items: Filter(
            Split(txtFrmQuestion.Text, " "),
            Len(Value) > 4
         )
      },
      Filter(
         DropColumns(
            GroupBy(
               Ungroup(
                  ForAll(
                     _Items As _I,
                     Filter(
                        colFAQ,
                        _I.Value in Text(Question) || _I.Value in Text(Answer)
                     )
                  ),
                  Value
               ),
               Question,
               Answer,
               Grouped
            ),
            Grouped
         ),
         !IsBlank(Question) && !IsBlank(Answer)
      )
   )
)
 
I have the same question (0)
  • Verified answer
    MarkRahn Profile Picture
    1,125 Super User 2025 Season 2 on at
    Adding a RowNo to an already complicated Items property
     
    @WarrenBelz helped me out with learning the "With" statement recently. I think this would work:
     
    With(
        {
            _Items: Filter(
                Split(
                    txtFrmQuestion.Text,
                    " "
                ),
                Len(Value) > 4
            )
        },
        With(
            {
                _FilteredItems: Filter(
                    DropColumns(
                        GroupBy(
                            Ungroup(
                                ForAll(
                                    _Items As _I,
                                    Filter(
                                        colFAQ,
                                        _I.Value in Text(Question) || _I.Value in Text(Answer)
                                    )
                                ),
                                Value
                            ),
                            Question,
                            Answer,
                            Grouped
                        ),
                        Grouped
                    ),
                    !IsBlank(Question) && !IsBlank(Answer)
                )
            },
            ForAll(
                Sequence(CountRows(_FilteredItems)),
                Patch(
                    Last(
                        FirstN(
                            _FilteredItems,
                            Value
                        )
                    ),
                    {RowNo: Value}
                )
            )
        )
    )
     
    It is a technique I used in the past that I found on this website: 
     
    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a Like.
     
    Thanks
    -Mark
  • DCHammer Profile Picture
    714 Moderator on at
    Adding a RowNo to an already complicated Items property
    Thank you Mark. That fixed it. I did need to add ID into the GroupBy clause so I had it later but this works and I can show/hide things based on their RowNo.
    I had a With statement that did it but the inside of that With was far less complicated than what I had here and couldn't figure out how to modify.

    Thank you again.
     
    Darren
  • Verified answer
    WarrenBelz Profile Picture
    151,881 Most Valuable Professional on at
    Adding a RowNo to an already complicated Items property
    Responding as you tagged me - firstly @MarkRahn is correct. The blue bit below will save you a few lines of code ( I wrote a blog on this a few years ago)
     
    If(
       Len(txtFrmQuestion.Text) > 4,
       With(
          {
             _Items: Filter(
                Split(txtFrmQuestion.Text, " "),
                Len(Value) > 4
             )
          },
          With(
             {
                _Data:
                Filter(
                   DropColumns(
                      GroupBy(
                         Ungroup(
                            ForAll(
                               _Items As _I,
                               Filter(
                                  colFAQ,
                                  _I.Value in Text(Question) || _I.Value in Text(Answer)
                               )
                            ),
                            Value
                         ),
                         Question,
                         Answer,
                         Grouped
                      ),
                      Grouped
                   ),
                   !IsBlank(Question) && !IsBlank(Answer)
                )
             },
             ForAll(
                Sequence(CountRows(_Data)),
                Patch(
                   Index(
                      _Data,
                      Value
                   ),

                   {RowNo: Value}
                )
             )
          )
       )
    )
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 663 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 398 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard