Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Andreas Neumann
Hi, So how is concat(NULL,fieldname) any better than COALESCE(fieldname,''). To me it is the same complexity and not really an improvement. But maybe I don't get it. The only slight advantage would be that "concat" may be a more familiar term than coalesce. But if you come from a database

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread DelazJ
Hi Andreas, 2015-09-21 8:39 GMT+02:00 Andreas Neumann : > Hi, > > So how is concat(NULL,fieldname) any better than COALESCE(fieldname,''). > To me it is the same complexity and not really an improvement. But maybe I > don't get it. The only slight advantage would be that

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Jürgen E . Fischer
Hi Andreas, On Mon, 21. Sep 2015 at 08:39:19 +0200, Andreas Neumann wrote: > So how is concat(NULL,fieldname) any better than > COALESCE(fieldname,''). That was just to illustrate the difference between foo||bar and concat(foo,bar). concat handles NULL as empty string (like in postgres) while

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Bernd Vogelgesang
Am 21.09.2015, 08:39 Uhr, schrieb Andreas Neumann : ... if you use capital letters in field names (which is discourage anyway). Hi Andreas, could you elaborate a little on why not to use capital letters for field names? Recently I started using capital letters for

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Andreas Neumann
Hi Bernhard, This is provider dependent. In PostgreSQL you will have to double quotes around the field names if they contain upper case letters or special characters not valid in SQL object names. QGIS stays on the "safe" side and will always add double quotes around the fields, even if it

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Matthias Kuhn
To clarify with a more meaningful example, the following two expressions are equal * CONCAT( name, ', ', country ) * COALESCE( name, '' ) || ', ' || COALESCE( country, '' ) Example: Given features with the attributes: * Feature 1: name : 'Tokyo' country: 'Japan' * Feature 2: name:

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-21 Thread Andreas Neumann
Hi Matthias and Jürgen, Thanks for your clarifications. Now it makes more sense and I agree that the Concat version is easier to use. Andreas On 21.09.2015 10:26, Matthias Kuhn wrote: To clarify with a more meaningful example, the following two expressions are equal * CONCAT( name, ', ',

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread Bernd Vogelgesang
Am 20.09.2015, 09:54 Uhr, schrieb Phil (The Geek) Wyatt : Hi Folks, I am working with LIST Address Points data from http://listdata.thelist.tas.gov.au/opendata/ >(Specifically Clarence Municipality) and I need to concatenate into one field the full address of

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread Matthias Kuhn
Hi Phil, In addition to COALESCE I'd like to promote the use of the function *CONCAT()* which treats NULL values as empty strings (it was changed recently, it's probably since 2.10) what makes it very handy. Example: NULL || "hello" -> NULL vs. CONCAT( NULL , "hello") -> "hello vs.

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread kimaidou
Hi, You can use the function "Colaesce", which returns the first not null value of a series. For example, Coalesce( foo, bar, 3) will return * 3 if foo and bar are NULL * bar if foo is NULL and bar is not NULL * foo if foor is NOT NULL You can use this function with second argument as an empty

[Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread Phil (The Geek) Wyatt
Hi Folks, I am working with LIST Address Points data from http://listdata.thelist.tas.gov.au/opendata/ (Specifically Clarence Municipality) and I need to concatenate into one field the full address of each location. I am struggling to figure out how to do it when there are fields for unit

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread Phil (The Geek) Wyatt
] Concatenate address fields with NULLS Hi Folks, I am working with LIST Address Points data from http://listdata.thelist.tas.gov.au/opendata/ (Specifically Clarence Municipality) and I need to concatenate into one field the full address of each location. I am struggling to figure out how to do

Re: [Qgis-user] Concatenate address fields with NULLS

2015-09-20 Thread kimaidou
Thank Matthias for pointing this out ! Very handy indeed. Cheers Michaël 2015-09-20 12:59 GMT+02:00 Matthias Kuhn : > Hi Phil, > > In addition to COALESCE I'd like to promote the use of the function > *CONCAT()* which treats NULL values as empty strings (it was changed >