cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Kudo Kingpin
Kudo Kingpin

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

Thanks @TopShelf-MSFT 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
Highlighted
Super User
Super User

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

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...

Highlighted
Kudo Kingpin
Kudo Kingpin

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

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.

 

Highlighted
Community Champion
Community Champion

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

Hi @davidstone thank you for posting this thread. 

 

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

 

@TopShelf-MSFT

Highlighted
Kudo Kingpin
Kudo Kingpin

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

Thanks @TopShelf-MSFT 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

Highlighted
Kudo Kingpin
Kudo Kingpin

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

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,273)