[Qgis-developer] Getting access to atlas record

Martin Dobias wonder.sk at gmail.com
Thu Jun 19 23:10:46 PDT 2014


On Fri, Jun 20, 2014 at 1:00 PM, Nyall Dawson <nyall.dawson at gmail.com> wrote:
> On 20 June 2014 15:43, Martin Dobias <wonder.sk at gmail.com> wrote:
>
>>
>> Actually the dot syntax would imply on the fly evaluation. When
>> parsing, it is not possible to decide what will be the content of an
>> object.
>>
>> This would be similar to python: the expression x.y means that in
>> object x it should look up "x" in the dictionary of attributes and
>> return its value.
>
> I mean column names which are themselves the result of an evaluated
> expression. For eaxmple, if my table was something like:
>
> id, label_with, label1, label2
> 1000, 1, 'a', 'b'
> 1001, 2, 'a', 'b'
>
> I'd like to be able to label this with an expression like: attribute(
> feature, 'label' || "label_with"). If the column name was evaluated as
> a result of the 'label' || "label_with" expression, then the returned
> feature attribute value would be 'a' for feature 1000 and 'b' for
> feature 1001.  (Sorry for the confusing example!). Could this be done
> using dot notation?

No, with dot notation you would need to use a proper field name (could
be enclosed in double quotes though) The "attribute" method could
co-exist for these advanced cases - like in Python there is the
buildin function getattr(object, name[, default]) for the same
purpose.

Regards
Martin


More information about the Qgis-developer mailing list