On 30 March 2015 at 23:07, Junior Delaz <del...@gmail.com> wrote:
>
> Hi,
> Niccolo, Nathan is right. his proposal is the simplier and recommanded.
> But I think your formulae should work if you write
> $atlasfeatureid || '_' || attribute($atlasfeature, 'name' ).
> Only simple quote ' and not " near the field's name inside attribute function 
> brackets.
>
> By the way, can someone explain me why for some functions (attribute, 
> getFeature), you need to use simple quote for the fields and double quotes 
> when using other functions ?
> And when you double-click on field's name, they are always appended to your 
> expression with double quote. Can this be standardised ?
>

Double quotes will give you the value of that field. It's standard
behaviour. But when you write:

attribute($atlasfeature, "name" )

you're actually saying "fetch the value of the attribute named 'name',
and then get the attribute from $atlasfeature which is called that
value". Eg, if your feature's 'name' field has a value "New York",
then the expression will be retrieving the value of the "new york"
attribute from $atlasfeature. Most likely your feature doesn't have an
attribute called "New York", so nothing is returned.

The single quote is a literal. So:

attribute($atlasfeature, 'name' )

means "fetch the attribute from $atlasfeature which is called 'name'".
So this would return "New York".

Hope that helps clarify!
Nyall
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to