Remove a destination when the same destination is consecutive

Hello everybody.


I have an issue. I wanna make a reservation of a car and to do that i have to say my destinations. For that i have a combo box where it shows the name of the locations available where the user can add his destinations. To do this, i wanna avoid consecutive destinations, for example:

- Destinations:

1- Lisboa

2- Braga

3- Braga

The 2º and 3º destinations are the same and doesn´t make sense. 

The condition in the combo box is already done but when i remove a destination in a RowNumber where the destinations of the RowNumber up and down are the same, i need to delete also another one because if don´t i will have the same consecutive destinations, for example:

1- Lisboa

2- Braga (If i delete this destination, i will have 1 - Lisboa and 2 - Lisboa, and with i have the same consecutive destinations)

3- Lisboa



If someone could help me, i would appreciate it.

Pedro Santos

Hi Pedro,

You should guarantee you don't have duplicates to start with... that way, when you remove something from the dropdown it will not leave "copies" behind either.

If your list is coming from an Aggregate you can Group By the city name, to make sure there are no duplicates. If you are using SQL, you can use GROUP BY or DISTINCT, depending on what you need.

Hope this helps

Hi Pedro,

In the On Change Screen Action of the Combo Box, you should filter out the consecutive equal destinations, by checking whether the one after the one to delete is the same as the one before the one to delete.

you can start from end or from the beguin and allways compare with the n with n+1 when you are removing in that position compare with n+2 if possible need to be carefull with the list length.that should fix you problem.

@Carlos: that's a bit convoluted, as there can only be two equal records adjacent, as there's only a single record removed. Also, if it's about clearing an entire list of doubles, a ListFilter is imho the best approach.

Thank you guys for the quick response. I already solve it.

Hi Pedro,

Good to hear. Could you please mark one of the answers as Solution? Thx.

Kilian Hekhuis wrote:

@Carlos: that's a bit convoluted, as there can only be two equal records adjacent, as there's only a single record removed. Also, if it's about clearing an entire list of doubles, a ListFilter is imho the best approach.

But you can have both destinations in the same list, the problem is that they cannot be one after another in the list position. Can you do that with a list filter?


Yes you can. You should then filter out all records that have a previous record that is the same (or all records that have a next record that is the same). Of course, like you already mentioned, the edge cases of start of list and end of list need to be handled.

Kilian Hekhuis wrote:

Hi Pedro,

Good to hear. Could you please mark one of the answers as Solution? Thx.


Hello Kilian,


I solve it in a different way.


Pedro Santos