Hi Andreas

 

Even my answer comes late…

Thanks for your reply and propositions.

I tried all 3 possibilities and the attribute(getFeature(…)) solution works 
perfectly for my needs.

 

With “not related” I meant, that the main table and the domain table (list 
lookup) only have a relation by an intermediate table. I think you understood 
right :)

 

 

 

Freundliche Grüsse

Christoph Lauber

 

Von: Neumann, Andreas [mailto:[email protected]] 
Gesendet: Dienstag, 10. Mai 2016 15:31
An: Christoph Lauber <[email protected]>
Cc: [email protected]
Betreff: Re: [Qgis-user] SQL display expression

 

Hi Christoph,

Are you talking about the left column in the forms view?

What do you mean by "not related"? Do you mean related, but not contained in 
the same table?

Is this for a value list lookup?

For a 1:1 relation?

QGIS expressions don't know "SELECT". The expression always works on a single 
feature. It can't return records. 

There could be several ways to do what you want:

1. use joins (layer properties --> joins)

2. use the attribute(getFeature(....)) expression

3. Create a virtual layer (starting from version 2.14) --> see 
https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/virtual_layers.html

I hope that one of the above ways help you solve your problem.

Greetings,

Andreas

On 2016-05-10 14:23, Christoph Lauber wrote:

Hi

 

I have a question about the display expression for forms.  The aim is to show 
data of a table that is not related by QGIS.

 

What I would like to do is to write a SQL to my SpatiaLite database to fetch 
some data. I suppose, that the display expression is restricted to the “select 
column” clause like: “"pkuid"   ||  ' '  || CASE WHEN art = 1 THEN 'this' ELSE 
'that' END”. When I put a select clause in it like “CASE WHEN "art" THEN 
(SELECT value FROM WI_D_Inventar_Art WHERE id = "art") ELSE 'Undefined' END” I 
get an expression is invalid error (the expression works in spatialite_gui). It 
seems that the SELECT keyword is not accepted.

 

Is there any possibility to write “free” SQL-Syntax for the display expression?

 

I wrote already a function that connects to the database, fetchs the data and 
closes the database. It works, but it is slow.

 

Thanks for your help.

 

Freundliche Grüsse

Christoph Lauber

 

*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*
GeoplanTeam AG dipl. Ing. ETH/SIA Hutzli+Kluser
Vermessung | Geoinformatik | Umwelttechnik
Egliweg 6, CH - 2560 Nidau
Phone:(+41) - 032 332 78 00
Fax:(+41) - 032 332 78 01
Web:  <http://www.geoplanteam.ch/> www.geoplanteam.ch
E-Mail:  <mailto:[email protected]> 
[email protected]
*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*

 

 

_______________________________________________
Qgis-user mailing list
[email protected] <mailto:[email protected]> 
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

 

 

_______________________________________________
Qgis-user mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to