[QGIS-Developer] Variable syntax: $ vs @

Stefan Keller sfkeller at gmail.com
Fri Jun 30 03:21:08 PDT 2017


Hi Nathan

Only partially related to this thread as a shy reminder:
My intern Simran recently has made a pull request [*] for your nice
Expressions Plus Plugin QGIS plugin.

These are the proposed additional functions:
* max_incremented() - an "autoincrement" id function
* hstore - support of a key-value pair set/string
* nullif() - returns None if arg_1 equals to arg_2 otherwise arg_1
* get_env_variable() and set_env_variable()
* jitter_geometry()

These expression functions could be of interest for workshops like the
mentioned one.

Cheers, Stefan

[*] https://github.com/NathanW2/qgsexpressionsplus/pull/8


2017-06-19 14:36 GMT+02:00 Neumann, Andreas <a.neumann at carto.net>:
> Hi Nathan,
>
> Thank you for the explanation. Makes sense. I will pass this on in the
> workshop.
>
> Andreas
>
> On 2017-06-19 14:12, Nathan Woodrow wrote:
>
> Hey Andreas,
>
> They are really two different things.  $geometry is really a function that
> takes no arguments. This has been deprecated in favour calling with () e.g
> geometry().  @ is only for variables.
>
> So you can explain it that $ used to be a shorthand way of calling a
> function that took no arguments which has now been replaced with () at the
> end to call it. $area = area().  This becomes important because now we
> support optional arguments meaning you can take 0 to N arguments.
>
> - Nathan
>
> On Mon, Jun 19, 2017 at 9:53 PM, Neumann, Andreas <a.neumann at carto.net>
> wrote:
>>
>> Hi,
>>
>> While preparing for a workshop on expressions I wonder how to explain why
>> some variables are referenced with the $ sign (like $geometry) while other
>> variables start with the @ sign, like @row_number, @layer_name.
>>
>> I know that it has historical reasons and that variables with the @ sign
>> are newer and are implemented using a different technology.
>>
>> But are there plans to get rid of the old $ sign notation and move
>> everything to the @ sign notation?
>>
>> Just wonder how I best explain this to the participants of the workshop.
>>
>> Thanks for your reply,
>>
>> Andreas
>>
>>
>>
>> _______________________________________________
>> 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


More information about the QGIS-Developer mailing list