Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED] Find duplicate data in DataObject


Go to End


3 Posts   1295 Views

Avatar
djpmedia

Community Member, 13 Posts

6 November 2014 at 2:53am

Hi,

I'm working for a client on a website which contains a Google Map which shows houses.
I've created a dataobject with contains all the houses with there Lat en Lang information.

Know is there a issue that some houses have the same Lat en Lang information because they are located in a Flat.
What I want is to group these houses en show on the Map one marker with a link to a page of the website which contains a list of these houses.

But here's the problem: how can I find duplicate values in a Dataobject/Datalist and make changes to it.
I tried with the Silverstripe API and with PHP unique array value, but nothing worked.

So I hope that you can give me some new insight in how this can work.
Otherwise I need to change plans and figure out a different solution.

Many thanks,
Dennis de Jong

Avatar
zenmonkey

Community Member, 545 Posts

6 November 2014 at 5:12pm

Have you tried creating a groupby data list? http://doc.silverstripe.org/framework/en/howto/grouping-dataobjectsets Dpeending on how you're passing this info the google map api, this may be the quickest solution. If your Lat and Lng are stored in differnt fields you'll to group by a virtual propoerty that combines them.

Avatar
djpmedia

Community Member, 13 Posts

11 November 2014 at 4:43am

Many thanks!! This is works!! It didn't not worked with the API RSSFeed, but with some modification I got this working.
A great benefit is that I also can use Children.Count to display how many apartments are available at GPS location.

I used also the Count function to count how many items are there in a group. Is this more than one, than show a different record.