Re: [Qgis-user] calculating progressive value

2016-08-17 Thread Salvanet
thank you, it works fine!

I didn't update the table and so I didn't see the right values in the y
column




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5281019.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-16 Thread Micha Silver
What exactly did you enter into the query window? The word "table" 
should be the name of your points layer.



On 08/17/2016 12:21 AM, Salvanet wrote:

Hi Micha, I apply the query with spatial lite, but the result is "near
"table": syntax error".

Sorry, but this is the first time I use spatialite in QGS with DB manager,
what am I doing wrong?

thank you



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5280982.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-16 Thread Salvanet
Hi Micha, I apply the query with spatial lite, but the result is "near
"table": syntax error".

Sorry, but this is the first time I use spatialite in QGS with DB manager,
what am I doing wrong?

thank you



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5280982.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-15 Thread Micha Silver
Salvanet wrote
> Hi, I have a Qgis layer with a table with twno columns X and Y.
> The X column has a set of values​​, while in the Y column I have to enter,
> using field calculator, for each record the progressive value. Eg : X
> column values: a , b , c , d ; Y column values (to be calculated with the
> field calculator from Y column): a; a + b; a + b + c; a + b + c + d.
> 
> How can I do this?
> 
> 
> 
>   
> thank you
> 
> ___
> Qgis-user mailing list

> Qgis-user@.osgeo

> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user


I can suggest a way to do what (I think) you want if you transfer your table
to a database such as Spatialite or PostGIS. But first a caveat: there is no
guarantee that the order of rows in a spatial table will stay constant, so
adding values progressivley from previous rows might not work as you expect.
For example, say you split a feature into two, or add a new feature, then a
new row will be added, with some X value which might be "out of order".

Having said that warning, suppose you have a table such as:
id  X   Y
--
1  1  0
2  3  0
3  0  0
4  5  0
5  6  0

(Note the id column with sequntial primary keys)
A query such as:

UPDATE table SET y=(SELECT sum(t.x) FROM table as t WHERE t.id<=table.id);

will result in:
id  X  Y
---
1  1  1
2  3  4
3  0  4
4  5  9
5  6  15

HTH




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5280800.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-15 Thread Salvanet
Hi Cristine, thank you for the answer, the problem is that X column values
are variables



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5280749.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-14 Thread DelazJ
Hi,
unless the number of combinations is known and limited, using case when
function could become a nightmare.

QGIS 2.16 provides aggregates functions (
http://qgis.org/fr/site/forusers/visualchangelog216/index.html#feature-aggregate-support-for-expressions)
that I think would help to do this but I'm unable to find the right syntax,
if ever.

Regards,
Harrissou

2016-08-14 14:07 GMT+02:00 Christine :

> Salvatore Oliveto wrote
> > Hi, I have a Qgis layer with a table with twno columns X and Y.
> > The X column has a set of values​​, while in the Y column I have to
> enter,
> > using field calculator, for each record the progressive value. Eg : X
> > column values: a , b , c , d ; Y column values (to be calculated with the
> > field calculator from Y column): a; a + b; a + b + c; a + b + c + d.
>
> Hi Salvatore,
> not really sure, if I understood you properly, but you can use a "case when
> ... then ... else" condition in field calculator. Please adapt the
> following
> pattern to your needs:
>
> CASE
> WHEN X = a THEN a
> WHEN X = b THEN a+b
> WHEN X = c THEN a+b+c
> WHEN X = d THEN a+b+c+d
> ELSE 'error value'
> END
>
> Hope this helps,
> regards, Christine
>
>
>
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.
> nabble.com/calculating-progressive-value-tp5280693p5280699.html
> Sent from the Quantum GIS - User mailing list archive at Nabble.com.
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] calculating progressive value

2016-08-14 Thread Christine
Salvatore Oliveto wrote
> Hi, I have a Qgis layer with a table with twno columns X and Y.
> The X column has a set of values​​, while in the Y column I have to enter,
> using field calculator, for each record the progressive value. Eg : X
> column values: a , b , c , d ; Y column values (to be calculated with the
> field calculator from Y column): a; a + b; a + b + c; a + b + c + d.

Hi Salvatore, 
not really sure, if I understood you properly, but you can use a "case when
... then ... else" condition in field calculator. Please adapt the following
pattern to your needs:

CASE 
WHEN X = a THEN a
WHEN X = b THEN a+b
WHEN X = c THEN a+b+c 
WHEN X = d THEN a+b+c+d
ELSE 'error value'
END

Hope this helps,
regards, Christine






--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/calculating-progressive-value-tp5280693p5280699.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user