get_feature() will get you the feature.Your current expression will get you the first feature from 'V_TB_ATTIVITA_PT_NR' layer where the "Colore" value is 'N'. - I don't think that is what you want. You need to query for a feature from another layer that relates to the current feature, (using a common field value). Once you get the feature, you can use the attributes(feature)['Colore'] to read the "Colore' field from that feature.
[image: Logo] <https://spatialthoughts.com/> Ujaval Gandhi Spatial Thoughts mobile: +91-8095684687 email: uja...@spatialthoughts.com [image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/> [image: Twitter icon] <https://twitter.com/spatialthoughts> On Tue, May 18, 2021 at 4:35 AM Delaz J <del...@gmail.com> wrote: > Hi Dario, > > Could you try with 'Colore' and not "Colore" (pay attention to the simple > vs double quotes)? > > Regards, > > Harrissou > Le 18/05/2021 à 00:41, Dario C a écrit : > > Hi, thank you for your reply, but I still don't understand how to do... > sorry > > i tried to write this code in colour expression, but I don't understand > what "value" is in get_feature : > > CASE > When > get_feature('V_TB_ATTIVITA_PT_NR',"Colore",'N')='N' then color_rgb (0,0,0) > When > get_feature('V_TB_ATTIVITA_PT_NR',"Colore",'R')='R' then color_rgb > (255,0,0) > END > > Consider that I have a virtual field called "Colore" where I have 'N' or > 'R' in case it is black or red color. > > Thank you for your kind availability. > > cheers > > Il giorno lun 17 mag 2021 alle ore 09:09 Ujaval Gandhi < > uja...@spatialthoughts.com> ha scritto: > >> You can select the layer under 'Plot Parameters' and its attributes will >> be available in the expression. (see attached screenshot). >> >> If you need to get the attribute from another layer, you can use the >> get_feature() function to get feature from another layer by specifying the >> layer name. >> [image: Logo] <https://spatialthoughts.com/> >> Ujaval Gandhi >> Spatial Thoughts >> mobile: +91-8095684687 >> email: uja...@spatialthoughts.com >> [image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/> >> [image: >> Twitter icon] <https://twitter.com/spatialthoughts> >> >> >> >> >> On Mon, May 17, 2021 at 2:47 AM Dario <dario9...@gmail.com> wrote: >> >>> Hi, >>> >>> I should get some data from a specific field of a specific layer but I’m >>> stuck. >>> >>> I’m using “Data Ploty” plug-in and I’d like to customise the colour of >>> the chart using expression. >>> As I’m working on layout I can’t see any field into expression menu, so >>> I need to call a specific layer and then the field. >>> I’d like to write something like that but, of course, selecting the >>> correct layer: >>> >>> CASE >>> WHEN "Civici" = 'Neri' THEN color_rgb(0,0,0) >>> ELSE color_rgb (255,0,0) >>> END >>> >>> >>> Thank you in advance. >>> >>> Cheers >>> >>> _ >>> _______________________________________________ >>> Qgis-user mailing list >>> Qgis-user@lists.osgeo.org >>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user >>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user >>> >> > _______________________________________________ > Qgis-user mailing listqgis-u...@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user > > _______________________________________________ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user >
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user