[Qgis-developer] Getting access to atlas record

Nyall Dawson nyall.dawson at gmail.com
Thu Jun 19 23:00:26 PDT 2014


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?

>
> I see. Another option could be to have a special column name that
> would indicate that all columns are needed - this special name would
> be understood by QgsFeatureRequest. That would keep the usage of
> QgsExpression same as before, without having to discriminate between
> the two cases...

That sounds like it might be an easier approach, I'll give it a try!

Cheers,
Nyall


More information about the Qgis-developer mailing list