Discussion:
[Qgis-user] combine field calculator functions
Michael Giebels
2013-08-06 11:38:35 UTC
Permalink
Hello QGIS users,

the QGIS world is new to me, so please be gentle...

I am wondering how I could combine field calculator functions in order
to convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting

"column1"='abc'

which gives me a binary result (0,1) in my resulting column. Then I can

replace ("newcolumn",'1','6')

How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new
number when querying another information (e.g. 'cba') from column 1?

Thanks in advance!

Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/c787b872/attachment-0001.html>
Nathan Woodrow
2013-08-06 11:42:32 UTC
Permalink
Hey Micheal,

This is currently not possible. If you are running QGIS 1.9 you do have
the ability to define your own functions using Python example here
https://github.com/NathanW2/qgsexpressionsplus/blob/master/functions.py however
if you are new to Python and QGIS this isn't something I would do right
away.

- Nathan
Post by Michael Giebels
Hello QGIS users,
the QGIS world is new to me, so please be gentle...
I am wondering how I could combine field calculator functions in order to
convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new number
when querying another information (e.g. 'cba') from column 1?
Thanks in advance!
Michael
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/558f9580/attachment.html>
Carlos Cerdán
2013-08-06 13:24:49 UTC
Permalink
... or perhaps you can:

0. Add the new column, acording type od data and length and... save and
close QGIS (no data added).
1. Open the *.DBF table with LibreOffice Calc or MS Excel, to take
advantage of their functions
2. Calc-Excel formulas would be taken as text, so you have to overwrite
them with their own results
3. Save (as *.DBF).
4. Open the shape in QGIS. It will have the new data.
5. An "advanced" step 2 is add new columns directly in Calc/Excel. For
that, watch the headers: they have: name_of_camp , type_of_data , lenght

Good luck

Carlos Cerd?n




2013/8/6 Nathan Woodrow <madmanwoo at gmail.com>
Post by Nathan Woodrow
Hey Micheal,
This is currently not possible. If you are running QGIS 1.9 you do have
the ability to define your own functions using Python example here
https://github.com/NathanW2/qgsexpressionsplus/blob/master/functions.py however
if you are new to Python and QGIS this isn't something I would do right
away.
- Nathan
Post by Michael Giebels
Hello QGIS users,
the QGIS world is new to me, so please be gentle...
I am wondering how I could combine field calculator functions in order to
convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new number
when querying another information (e.g. 'cba') from column 1?
Thanks in advance!
Michael
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/504c032c/attachment.html>
Michael Giebels
2013-08-06 14:11:03 UTC
Permalink
Hi Carlos,

thanks for your input. I tried this before. However I am not able to
open *.dbf tables in Excel. It appears not to be readable in a suitable
form (Yes, I do go the way over right click, show all files, open, and
define seperators etc.). Somehow Excel does not read the row break
properly (when I try to import the pure data without the header it tries
to show all data in the first row and aborts due to limited number of
columns in Excel). I tried different file origins (MacIntosh, Windows,
DOS) as well. In a German forum I found information that Microsoft does
not support *.dbf files anymore for Excel 2010 or higher which might
explain that issue.

Btw: I am running QGIS 1.8 on a Mac OS X Version 10.7.5 (whom ever this
information helps) with MS Excel for Mac2011 Version 14.3.6 on it.

I mentioned it before to Nathan already. All I want to do in the end is
to convert six categories so I can display them in differing colors
without creating new layers. But that is the way I have to do it in the
end I guess.

Thanks for your replies and thanks for having me in the community

Michael
Post by Carlos Cerdán
0. Add the new column, acording type od data and length and... save
and close QGIS (no data added).
1. Open the *.DBF table with LibreOffice Calc or MS Excel, to take
advantage of their functions
2. Calc-Excel formulas would be taken as text, so you have to
overwrite them with their own results
3. Save (as *.DBF).
4. Open the shape in QGIS. It will have the new data.
5. An "advanced" step 2 is add new columns directly in Calc/Excel. For
that, watch the headers: they have: name_of_camp , type_of_data , lenght
Good luck
Carlos Cerd?n
2013/8/6 Nathan Woodrow <madmanwoo at gmail.com <mailto:madmanwoo at gmail.com>>
Hey Micheal,
This is currently not possible. If you are running QGIS 1.9 you
do have the ability to define your own functions using Python
example here
https://github.com/NathanW2/qgsexpressionsplus/blob/master/functions.py however
if you are new to Python and QGIS this isn't something I would do
right away.
- Nathan
On Tue, Aug 6, 2013 at 9:38 PM, Michael Giebels
Hello QGIS users,
the QGIS world is new to me, so please be gentle...
I am wondering how I could combine field calculator functions
in order to convert information from an existing data column
into a new one.
What I can do with my mediocre knowledge is to query
information from column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e.
there MUST be a simple expression in the function list) and do
not lose the new number when querying another information
(e.g. 'cba') from column 1?
Thanks in advance!
Michael
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/3d8e6682/attachment-0001.html>
Carlos Cerdán
2013-08-06 14:37:44 UTC
Permalink
Hi Michael:

You can try Calc, from the LibreOffice suite. In this case it's a powerful
free software tool to open many kinds of formats, such *. DBF without
issues.

There are installers for Mac OS also in http://www.libreoffice.org . Try
it! perhaps you find it very useful.

Carlos
(QGIS 1.8 on Ubuntu 12.04)


2013/8/6 Michael Giebels <giebels at meo-carbon.com>
Post by Michael Giebels
Hi Carlos,
thanks for your input. I tried this before. However I am not able to open
*.dbf tables in Excel. It appears not to be readable in a suitable form
(Yes, I do go the way over right click, show all files, open, and define
seperators etc.). Somehow Excel does not read the row break properly (when
I try to import the pure data without the header it tries to show all data
in the first row and aborts due to limited number of columns in Excel). I
tried different file origins (MacIntosh, Windows, DOS) as well. In a German
forum I found information that Microsoft does not support *.dbf files
anymore for Excel 2010 or higher which might explain that issue.
Btw: I am running QGIS 1.8 on a Mac OS X Version 10.7.5 (whom ever this
information helps) with MS Excel for Mac2011 Version 14.3.6 on it.
I mentioned it before to Nathan already. All I want to do in the end is to
convert six categories so I can display them in differing colors without
creating new layers. But that is the way I have to do it in the end I
guess.
Thanks for your replies and thanks for having me in the community
Michael
0. Add the new column, acording type od data and length and... save and
close QGIS (no data added).
1. Open the *.DBF table with LibreOffice Calc or MS Excel, to take
advantage of their functions
2. Calc-Excel formulas would be taken as text, so you have to overwrite
them with their own results
3. Save (as *.DBF).
4. Open the shape in QGIS. It will have the new data.
5. An "advanced" step 2 is add new columns directly in Calc/Excel. For
that, watch the headers: they have: name_of_camp , type_of_data , lenght
Good luck
Carlos Cerd?n
2013/8/6 Nathan Woodrow <madmanwoo at gmail.com>
Post by Nathan Woodrow
Hey Micheal,
This is currently not possible. If you are running QGIS 1.9 you do
have the ability to define your own functions using Python example here
https://github.com/NathanW2/qgsexpressionsplus/blob/master/functions.py however
if you are new to Python and QGIS this isn't something I would do right
away.
- Nathan
Post by Michael Giebels
Hello QGIS users,
the QGIS world is new to me, so please be gentle...
I am wondering how I could combine field calculator functions in order
to convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new number
when querying another information (e.g. 'cba') from column 1?
Thanks in advance!
Michael
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/7814e1c5/attachment.html>
Alexandre Neto
2013-08-06 14:53:06 UTC
Permalink
Hello Michael,

If all you want is to be able to display 6 categories with diferent colors,
isn't rule-based symbology an option for you? You can agregate several
values in each category using simple operators, and this way you don't even
need to create a new column in your data.

Hope it helps,

Alexandre Neto
Post by Michael Giebels
Hi Carlos,
thanks for your input. I tried this before. However I am not able to open
*.dbf tables in Excel. It appears not to be readable in a suitable form
(Yes, I do go the way over right click, show all files, open, and define
seperators etc.). Somehow Excel does not read the row break properly (when
I try to import the pure data without the header it tries to show all data
in the first row and aborts due to limited number of columns in Excel). I
tried different file origins (MacIntosh, Windows, DOS) as well. In a German
forum I found information that Microsoft does not support *.dbf files
anymore for Excel 2010 or higher which might explain that issue.
Btw: I am running QGIS 1.8 on a Mac OS X Version 10.7.5 (whom ever this
information helps) with MS Excel for Mac2011 Version 14.3.6 on it.
I mentioned it before to Nathan already. All I want to do in the end is to
convert six categories so I can display them in differing colors without
creating new layers. But that is the way I have to do it in the end I
guess.
Thanks for your replies and thanks for having me in the community
Michael
0. Add the new column, acording type od data and length and... save and
close QGIS (no data added).
1. Open the *.DBF table with LibreOffice Calc or MS Excel, to take
advantage of their functions
2. Calc-Excel formulas would be taken as text, so you have to overwrite
them with their own results
3. Save (as *.DBF).
4. Open the shape in QGIS. It will have the new data.
5. An "advanced" step 2 is add new columns directly in Calc/Excel. For
that, watch the headers: they have: name_of_camp , type_of_data , lenght
Good luck
Carlos Cerd?n
2013/8/6 Nathan Woodrow <madmanwoo at gmail.com>
Post by Nathan Woodrow
Hey Micheal,
This is currently not possible. If you are running QGIS 1.9 you do
have the ability to define your own functions using Python example here
https://github.com/NathanW2/qgsexpressionsplus/blob/master/functions.py however
if you are new to Python and QGIS this isn't something I would do right
away.
- Nathan
Post by Michael Giebels
Hello QGIS users,
the QGIS world is new to me, so please be gentle...
I am wondering how I could combine field calculator functions in order
to convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new number
when querying another information (e.g. 'cba') from column 1?
Thanks in advance!
Michael
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130806/aa7874ab/attachment.html>
auriarte59
2013-08-06 18:43:10 UTC
Permalink
Please delete this mail from the list
Thanks
Correo enviado utilizando el servicio BlackBerry de Entel

-----Original Message-----
From: Nathan Woodrow <madmanwoo at gmail.com>
Sender: qgis-user-bounces at lists.osgeo.org
Date: Tue, 6 Aug 2013 21:42:32
To: Michael Giebels<giebels at meo-carbon.com>
Cc: qgis-user<qgis-user at lists.osgeo.org>
Subject: Re: [Qgis-user] combine field calculator functions
Jürgen E. Fischer
2013-08-07 07:36:44 UTC
Permalink
Hi Michael,
Post by Michael Giebels
I am wondering how I could combine field calculator functions in order to
convert information from an existing data column into a new one.
What I can do with my mediocre knowledge is to query information from
column 1 by setting
"column1"='abc'
which gives me a binary result (0,1) in my resulting column. Then I can
replace ("newcolumn",'1','6')
How could I combine these two into one working function (i.e. there MUST
be a simple expression in the function list) and do not lose the new
number when querying another information (e.g. 'cba') from column 1?
Um, are you looking for the following?

CASE WHEN "column1"='abc' THEN '6' ELSE '0' END


J?rgen
--
J?rgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstra?e 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
committ(ed|ing) to QGIS IRC: jef on FreeNode
--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
Loading...