<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Awesome. Thank you.<br>
<br>
I added the extra column to the shapefile attributes, joined the
shapefile to the CSV file, and then updated the new column in my
shapefile using:<br>
attribute($currentfeature,'joinedcolumn') (NOTE: single quotes for
field name)<br>
<br>
I'm sure I could have skipped the Join step and just used getfeature
as suggested below, but I went the Join route anyway.<br>
<br>
Big thanks,<br>
Zoltan<br>
<br>
<br>
<div class="moz-cite-prefix">On 2015/07/30 14:34, DelazJ wrote:<br>
</div>
<blockquote
cite="mid:CAECJsSrVdohx7+kRWZiBmhB2eKuAFEJY7TwUuGHJGrM7x06sBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>Hi,<br>
</div>
I think combining getFeature and attribute functions should
help u do that in the field calculator, though I haven't used
them on csv files.<br>
</div>
<div>Assuming col1 in your csv contains also the code you are
looking for, applying this expression on shapefile "col 6" in
QGIS field calculator may do the job:<br>
</div>
<div>attribute (getFeature ('mycsvfile', 'mycsv_col1',
"myshape_col1"), 'col2')<br>
</div>
<div><br>
</div>
<div>Regards,<br>
</div>
<div>DelazJ <br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2015-07-30 13:06 GMT+02:00 Zoltan
Szecsei <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:zoltans@geograph.co.za" target="_blank">zoltans@geograph.co.za</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
How could I implement something like vlookup in QGIS?<br>
<br>
I have a shapefile with 2000 polygons and column 1 of its
attribute table has a code value.<br>
<br>
Using the code in this column 1, I need to look up which
row of a CSV file has that code, and return column 2 of
the CSV file.<br>
This returned value must then be placed into a new column
(say column 6) on the shapefile attribute table.<br>
I could pre-add the new column to this shapefile, and then
run the vlookup equivalent too, of course.<br>
<br>
I tried this by opening the DBF file in Libreoffice calc,
sorting the columns, adding the extra two columns of my
lookup data, then ran vlookup and saved/closed the DBF
file.<br>
<br>
Once back in QGIS the attributes ended up being linked to
the wrong polygons (probably because I sorted the DBF file
outside of QGIS).<br>
<br>
Thanks in advance,<br>
Zoltan<br>
<br>
<br>
-- <br>
<br>
===========================================<br>
Zoltan Szecsei PrGISc [PGP0031]<br>
Geograph (Pty) Ltd.<br>
GIS and Photogrammetric Services<br>
<br>
P.O. Box 7, Muizenberg 7950, South Africa.<br>
<br>
Mobile: <a moz-do-not-send="true"
href="tel:%2B27-83-6004028" value="+27836004028"
target="_blank">+27-83-6004028</a><br>
Fax: <a moz-do-not-send="true"
href="tel:%2B27-86-6115323" value="+27866115323"
target="_blank">+27-86-6115323</a> <a
moz-do-not-send="true" href="http://www.geograph.co.za"
rel="noreferrer" target="_blank"><a class="moz-txt-link-abbreviated" href="http://www.geograph.co.za">www.geograph.co.za</a></a><br>
===========================================<br>
<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a moz-do-not-send="true"
href="mailto:Qgis-developer@lists.osgeo.org"
target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/qgis-developer"
rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
GIS and Photogrammetric Services
P.O. Box 7, Muizenberg 7950, South Africa.
Mobile: +27-83-6004028
Fax: +27-86-6115323 <a class="moz-txt-link-abbreviated" href="http://www.geograph.co.za">www.geograph.co.za</a>
===========================================</pre>
</body>
</html>