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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,873)