<div dir="ltr"><div><div><div><div>Python can also be used to find duplicate attributes. It isn't as straightforward as a sql query, but it works. And if your data isnt in spatialite/postGIS, I don't know if you can do a select distinct without creating a more complicated subquery using the expression builder. From the console:<br>
<br></div>from collections import Counter<br><br># get a reference to the layer to be searched<br></div>layer = iface.activeLayer()<br><br># get the position in the attribute table of the attribute to be checked<br></div>
idx = layer.fieldNameIndex('attribute_name')<br><br></div><div># create a list of all the attribute values<br></div><div>attributeList = [feature.attributes()[idx] for feature in layer.getFeatures()]<br><br></div>
<div># print the duplicate entries in the attributeList<br></div><div>print([attribute for attribute, count in Counter(attributeList).items() if count > 1])<br><br></div><div><br></div><div>Eric<br></div><div><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 28, 2014 at 8:32 PM, Alex Mandel <span dir="ltr"><<a href="mailto:tech_dev@wildintellect.com" target="_blank">tech_dev@wildintellect.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 02/28/2014 02:46 AM, Paolo Cavallini wrote:<br>
> Hi all.<br>
> I can't recall of any function or plugin to find duplicate data ona<br>
> table of attributes: am I right, or am I forgetting something?<br>
> Thanks in advance.<br>
><br>
<br>
</div>I always use Spatialite or Postgis so I can run a DISTINCT function in a<br>
query, or GROUP BY what should be unique and get a count (if it's > 1<br>
it's not unique). I'm not aware of any other way to check for duplicate<br>
data.<br>
<br>
Enjoy,<br>
Alex<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</div></div></blockquote></div><br></div>