[QGIS-Developer] $currentfeature VS @current_feature

DelazJ delazj at gmail.com
Wed Jul 8 06:17:17 PDT 2020


Hi,
The @current_feature is, according to the doc[0], available when editing in
attribute table and form contexts which are not actually the one you have,
Matteo.

[0]
https://github.com/qgis/QGIS/blob/master/src/core/expression/qgsexpression.cpp#L861and
in documentation
https://docs.qgis.org/3.10/fr/docs/user_manual/working_with_vector/expression.html#variables

Greetings,
Harrissou

Le mer. 8 juil. 2020 à 14:51, Andreas Neumann <a.neumann at carto.net> a
écrit :

> 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
>
>
> _______________________________________________
> 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/036c57c3/attachment.html>


More information about the QGIS-Developer mailing list