[Qgis-user] Can't accomplish comparisions between different Map Layer Table's

Guillermo Parra meminp_24 at yahoo.com
Tue May 14 13:11:19 PDT 2024


Thank you very much Osin!
With the example that you kindly provided is more clear. I will try it and again, thank you very much!
Regards.


    El martes, 14 de mayo de 2024, 13:52:16 GMT-6, oisin.kelly.wild at gmail.com <oisin.kelly.wild at gmail.com> escribió:  
 
 get_feature(layer, attribute, value)

This returns a feature. You can then wrap this in attributes() to return a dictionary of attribute names and  values.

You then add ['attributename'] on end to return value.

So for each table 
 something like

attributes(get_feature('table1', 'common-id-name', "common-id-name"))['H3centr-h9...']

Does this make sense

Oisin


Get BlueMail for Android On 14 May 2024, at 20:35, Guillermo Parra <meminp_24 at yahoo.com> wrote:
   Hello Oisin,   
   Thank you for your guidance regarding this topic, and I am sorry if I need further assistance, but I'm kind of new to QGIS.   
   Regarding the need to define the layer for each attribute, will it work if I stated like I had wroten before? i.e.:     'Table1.H3centr_h9_cobcubierto'  = 1 OR    'Table2.H3centr_h9_cobcubierto' = 1   Will QGIS recognize it?   
   And to find the comparable record, certaingly I can use a common id. So I will explore the getfeature( ) tool that you suggest, thank you very much.   
   Regards.     
   
   Guillermo Parra Montealegre e-mail: meminp_24 at yahoo.com    
   
    El martes, 14 de mayo de 2024, 13:23:07 GMT-6, oisin.kelly.wild at gmail.com <oisin.kelly.wild at gmail.com> escribió:   
   
      You definitely need to define the layer for each attribute (except the current layer). 
 
   You also need a way to find the comparable record, e.g. 
   (i) with a common id (use getfeature() to access attribute) or 
   (ii) spatially use one of the overlay functions. 
 
   Oisin 
 
   Get BlueMail for Android   On 14 May 2024, at 19:52, Guillermo Parra via QGIS-User <qgis-user at lists.osgeo.org> wrote: 
     Hi,   
   I have several tables with the same fields, same grid information, but different field data for each one (information from different providers, let's say).   
   Particularly, I have a field with 0 and 1 which represent if each provider have, or not have coverage in that area.   
   I want to compare the values of each table to set "1" if at least one of the providers have coverage in each area, or "0" if None of them have it, so I used the field calculator and the expression builder with this sql statement:   
     if( 'H3centr_h9_cobcubierto'  = 1 OR    'H3centr_h9_cobcubierto' = 1 OR   'H3centroides_h9_cobGT3D cubierto' = 1 OR   'H3centroides_h9_cob_cubierto'  = '1' OR   'H3centr_h9_cob_cubierto' = '1' OR   'H3cent_cob_cubierto'  = '1' OR   "H3centrR9_Tc3D_cubierto"  ='1', 1, 0)   
   The problem is that apparently it is considering only the last field in double quotes (which is in the same table that the new column where I want to fill the data), and the other fields apparently are beign ignored.   
   I would guest that it would be better to specify the table and field where each data will be taken ( like     if( 'Table1.H3centr_h9_cobcubierto'  = 1 OR    'Table2.H3centr_h9_cobcubierto' = 1 OR... etc.)    but when I make double click over each layer field, QGIS writes it that way, so I asume it is correct.   
   So, if someone have an idea on how I can make it work, I would greatly appreciate any suggestion.   Thanks,   
    Guillermo.   
   
   Guillermo Parra Montealegre e-mail: meminp_24 at yahoo.com       
 QGIS-User mailing list 
 QGIS-User at lists.osgeo.org 
 List info: https://lists.osgeo.org/mailman/listinfo/qgis-user 
 Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user 
 
     
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20240514/5bda5a9b/attachment.htm>


More information about the QGIS-User mailing list