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 @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
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
Anonymous
Not applicable

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?

 

@Anonymous

Highlighted
Kudo Kingpin
Kudo Kingpin

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

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

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

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,342)