cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
davidstone
Kudo Kingpin
Kudo Kingpin

Possible to refer to 'next item' and 'previous item' as well as 'ThisItem'?

I have a set of data that may contain repeats, and I'd like to conditionally colour the first occurence of any repeats.

 

For example if my data was 'a, b, b, b, c, d' I would want the first 'b' to be blue.

 

Back in my InfoPath days I would have compared the current item to the next and preceding items to see if they were the same. I can't see a way to compare 'ThisItem' to the next or previous.

 

Or is there a better way of doing this?

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks @Anonymous and @Drrickryp, I actually have a solution for this, but it may not be obvious how it relates to the odd way in which I described my problem!

 

Basically the solution was to use GroupBy.

 

What I was actually trying to do was show a list of events, but where the events were on the same date I only wanted to show the date on the first event.

 

So I created a gallery and set its items to GroupBy on a date column in my data. This kind of gives you two collections, one inside the other. The gallery effectively has a record of all the unique dates, but within each item is a collection of the other items with the same date. You can then add a gallery inside the first gallery, pointed to this secondary data. Then in the top level gallery, you can add things which are effectively only showing against the first occurence - which is what I originally wanted to achieve.

View solution in original post

5 REPLIES 5
Drrickryp
Super User II
Super User II

Hi @davidstone,

Please check out this thread.  I think it will help you solve your problem.

https://powerusers.microsoft.com/t5/Creating-Apps/Next-amp-Back-buttons-to-move-through-Gallery-Reco...

Thanks - that's a bit closer. The problem is, that solution has a starting position to work from. Since I'll be looking relative to the current item, I'd need to know where in the dataset the current row was.

 

Anonymous
Not applicable

Hi @davidstone thank you for posting this thread. 

 

@Drrickryp can you review the latest reply and advise on a possible solution?

 

@Anonymous

Thanks @Anonymous and @Drrickryp, I actually have a solution for this, but it may not be obvious how it relates to the odd way in which I described my problem!

 

Basically the solution was to use GroupBy.

 

What I was actually trying to do was show a list of events, but where the events were on the same date I only wanted to show the date on the first event.

 

So I created a gallery and set its items to GroupBy on a date column in my data. This kind of gives you two collections, one inside the other. The gallery effectively has a record of all the unique dates, but within each item is a collection of the other items with the same date. You can then add a gallery inside the first gallery, pointed to this secondary data. Then in the top level gallery, you can add things which are effectively only showing against the first occurence - which is what I originally wanted to achieve.

View solution in original post

It might make more sense with a visual.

 

In the screenshot you'll see the two dates on the left side, but three events. The dates are labels inside the top level gallery, bound to the grouped data. The events in white are in a separate gallery inside each item in the top level gallery.

 

eventsgrouping.png

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (78,124)