[QGIS-Developer] $currentfeature VS @current_feature

Andreas Neumann a.neumann at carto.net
Wed Jul 8 05:51:16 PDT 2020


Hi Matteo, 

The "$" prefix marks a function without arguments, "@" are variables.
Sometimes both variants exist, as you have discovered. Mainly due to
historic reasons and the fact that the "$"-stuff is around for a lont
time already, but the variables where added quite a bit later. 

Are you sure that "@current_feature" really exists? I can't find it in
my expression builder (in layer scope). 

You are probably aware that variables have different scopes (global,
project, layer, layout, etc.) - some variables are only available in
some scopes, because they wouldn't work in other scopes or it wouldn't
make sense there. 

Greetings, 

Andreas 

On 2020-07-08 14:03, matteo wrote:

> Hi all,
> 
> before to file a ticker I'd like to have a small feedback. Maybe I'm
> missing something but what is actually the difference between
> $currentfeature and @current_feature?
> 
> Because I was expecting to use @current_feature together with attribute
> like:
> 
> attribute(@current_feature, 'my_field')
> 
> within the Default Value of a Field in the Attributes Form, but it
> didn't work while
> 
> attribute($currentfeature, 'my_field')
> 
> works nice
> 
> If someone has a small explanation I will gladly add it to the documentation
> 
> Cheers and thanks for any hint
> 
> Matteo
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200708/1f46dadc/attachment.html>


More information about the QGIS-Developer mailing list