[Gvsig_english] Field Calculator: look for an expression saved in a file

phil_murcia philipjmellor at gmail.com
Thu Sep 26 14:10:59 CEST 2013


I am trying to create a python expression to insert into the expression
calculator that fills a column for me in the attribute table, but am
struggling to find the correct syntax - or even successfully implement the
simplest of python expressions. The table shows the compatibility of
Land-use A with each instance of land use B, but I need to create a final
column that can select the correct number from the correct column, depending
on what is in the Land-use B column. An example of my attribute table is
shown below.

**Compatibility:**

    ID  |  Land-use A |  Agr  |  Urb  | For  | Com |  Pub | Land-use B |
Compat
     1           N              1        4      3         0       2        
Agr               
     2           G              2        3      5         1       0        
Pub
     3           K              4        2      3         5       1        
Urb
     4           N              1        4      3         0       2        
Urb

An example of my desired attribute table can be seen below:

**Desired:**

    ID  |  Land-use A |  Agr  |  Urb  | For  | Com |  Pub | Land-use B |
Compat
     1           N             1        4        3       0        2       
Agr              1     
     2           G             2        3        5       1        0       
Pub              0
     3           K             4        2        3       5        1       
Urb              2
     4           N             1        4        3       0        2       
Urb              4

Perhaps it is possible to do this in the gvSIG expression calculator without
import a .py file - but either way I can not seem to get the syntax right.
Any help would be much appreciated.




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Field-Calculator-look-for-an-expression-saved-in-a-file-tp4103134p5080184.html
Sent from the gvSIG users mailing list archive at Nabble.com.


More information about the Gvsig_internacional mailing list