<div dir="ltr">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. <div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div></div><div><table cellpadding="0" cellspacing="0" style="border-spacing:0px;border-collapse:collapse;color:rgb(68,68,68);width:480px;font-size:10pt;font-family:Arial,sans-serif;line-height:normal"><tbody><tr><td valign="top" style="padding:10px 0px 12px;width:160px;vertical-align:top"><a href="https://spatialthoughts.com/" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img border="0" alt="Logo" width="141" src="https://spatialthoughts685850346.files.wordpress.com/2019/12/spatial_thoughts_logo.png" style="border:0px;vertical-align:middle;width:141px;height:auto"></a></td><td style="padding:6px 0px;width:320px"><table cellpadding="0" cellspacing="0" style="border-spacing:0px;border-collapse:collapse;background-color:transparent"><tbody><tr><td style="padding:0px;font-size:12pt;font-family:Arial,sans-serif;font-weight:bold;color:rgb(61,60,63)"><span style="color:rgb(0,175,239)">Ujaval Gandhi</span></td></tr><tr><td style="padding:0px 0px 11px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(61,60,63)"><span style="color:rgb(0,175,239)">Spatial Thoughts</span></td></tr><tr><td style="padding:0px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(155,155,155)"><span>mobile: +91-8095684687</span></td></tr><tr><td style="padding:0px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(155,155,155)"><span>email: </span><span style="color:rgb(23,147,210)"><a href="mailto:ujaval@spatialthoughts.com" target="_blank">ujaval@spatialthoughts.com</a></span></td></tr><tr><td style="padding:6px 0px 0px"><span style="display:inline-block;height:22px"><span><a href="https://www.linkedin.com/in/spatialthoughts/" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img alt="LinkedIn icon" border="0" width="23" height="23" src="https://codetwocdn.azureedge.net/images/mail-signatures/generator/elegant-logo/ln.png" style="border:0px;vertical-align:middle;height:20px;width:20px"></a>  </span><span><a href="https://twitter.com/spatialthoughts" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img alt="Twitter icon" border="0" width="23" height="23" src="https://codetwocdn.azureedge.net/images/mail-signatures/generator/elegant-logo/tt.png" style="border:0px;vertical-align:middle;height:20px;width:20px"></a>  </span></span></td></tr></tbody></table></td></tr><tr><td colspan="2" style="padding:8px 0px 0px;border-top:1px solid rgb(23,147,210);width:480px;font-family:Arial,sans-serif;color:rgb(155,155,155);text-align:justify"></td></tr></tbody></table><br></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 18, 2021 at 4:35 AM Delaz J <<a href="mailto:delazj@gmail.com">delazj@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hi Dario,</p>
    <p>Could you try with 'Colore' and not "Colore" (pay attention to
      the simple vs double quotes)?</p>
    <p>Regards,</p>
    <p>Harrissou<br>
    </p>
    <div>Le 18/05/2021 à 00:41, Dario C a
      écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">  Hi, thank you for your reply, but I still don't
        understand how to do... sorry
        <div><br>
        </div>
        <div>i tried to write this code in colour expression, but I
          don't understand what "value" is in get_feature
          :</div>
        <div><br>
        </div>
        <div>CASE<br>
          When<br>
          get_feature('V_TB_ATTIVITA_PT_NR',"Colore",'N')='N' then
          color_rgb (0,0,0)<br>
          When<br>
          get_feature('V_TB_ATTIVITA_PT_NR',"Colore",'R')='R' then
          color_rgb (255,0,0)<br>
          END<br>
        </div>
        <div><br>
        </div>
        <div>Consider that I have a virtual field called "Colore" where
          I have 'N' or 'R' in case it is black or red color.</div>
        <div><br>
        </div>
        <div>Thank you for your kind availability.</div>
        <div><br>
        </div>
        <div>cheers</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Il giorno lun 17 mag 2021 alle
          ore 09:09 Ujaval Gandhi <<a href="mailto:ujaval@spatialthoughts.com" target="_blank">ujaval@spatialthoughts.com</a>> ha
          scritto:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div dir="ltr">You can select the layer under 'Plot
            Parameters' and its attributes will be available in the
            expression. (see attached screenshot).
            <div><br>
            </div>
            <div>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.<br clear="all">
              <div>
                <div dir="ltr">
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div>
                              <div dir="ltr">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div>
                                      <table style="border-spacing:0px;border-collapse:collapse;color:rgb(68,68,68);width:480px;font-size:10pt;font-family:Arial,sans-serif;line-height:normal" cellspacing="0" cellpadding="0">
                                        <tbody>
                                          <tr>
                                            <td style="padding:10px 0px 12px;width:160px;vertical-align:top" valign="top"><a href="https://spatialthoughts.com/" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img alt="Logo" src="https://spatialthoughts685850346.files.wordpress.com/2019/12/spatial_thoughts_logo.png" style="border: 0px; vertical-align: middle; width: 141px; height: auto;" width="141" border="0"></a></td>
                                            <td style="padding:6px 0px;width:320px">
                                              <table style="border-spacing:0px;border-collapse:collapse;background-color:transparent" cellspacing="0" cellpadding="0">
                                                <tbody>
                                                  <tr>
                                                    <td style="padding:0px;font-size:12pt;font-family:Arial,sans-serif;font-weight:bold;color:rgb(61,60,63)"><span style="color:rgb(0,175,239)">Ujaval Gandhi</span></td>
                                                  </tr>
                                                  <tr>
                                                    <td style="padding:0px 0px 11px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(61,60,63)"><span style="color:rgb(0,175,239)">Spatial Thoughts</span></td>
                                                  </tr>
                                                  <tr>
                                                    <td style="padding:0px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(155,155,155)"><span>mobile:
                                                        +91-8095684687</span></td>
                                                  </tr>
                                                  <tr>
                                                    <td style="padding:0px;font-size:10pt;font-family:Arial,sans-serif;color:rgb(155,155,155)"><span>email: </span><span style="color:rgb(23,147,210)"><a href="mailto:ujaval@spatialthoughts.com" target="_blank">ujaval@spatialthoughts.com</a></span></td>
                                                  </tr>
                                                  <tr>
                                                    <td style="padding:6px 0px 0px"><span style="display:inline-block;height:22px"><span><a href="https://www.linkedin.com/in/spatialthoughts/" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img alt="LinkedIn icon" src="https://codetwocdn.azureedge.net/images/mail-signatures/generator/elegant-logo/ln.png" style="border: 0px; vertical-align: middle; height: 20px; width: 20px;" width="23" height="23" border="0"></a>  </span><span><a href="https://twitter.com/spatialthoughts" style="background-color:transparent;color:rgb(51,122,183)" target="_blank"><img alt="Twitter icon" src="https://codetwocdn.azureedge.net/images/mail-signatures/generator/elegant-logo/tt.png" style="border: 0px; vertical-align: middle; height: 20px; width: 20px;" width="23" height="23" border="0"></a>  </span></span></td>
                                                  </tr>
                                                </tbody>
                                              </table>
                                            </td>
                                          </tr>
                                          <tr>
                                            <td colspan="2" style="padding:8px 0px 0px;border-top:1px solid rgb(23,147,210);width:480px;font-family:Arial,sans-serif;color:rgb(155,155,155);text-align:justify"><br>
                                            </td>
                                          </tr>
                                        </tbody>
                                      </table>
                                      <br>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <br>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Mon, May 17, 2021 at
              2:47 AM Dario <<a href="mailto:dario955i@gmail.com" target="_blank">dario955i@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div dir="auto">Hi,
                <div><br>
                </div>
                <div>I should get some data from a specific field of a
                  specific layer but I’m stuck.</div>
                <div><br>
                </div>
                <div>I’m using “Data Ploty” plug-in and I’d like to
                  customise the colour of the chart using expression. </div>
                <div>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.</div>
                <div>I’d like to write something like that but, of
                  course, selecting the correct layer:</div>
                <div><br>
                  <span><span style="font-family:"Courier New"">CASE</span></span><br>
                  <span><span style="font-family:"Courier New"">WHEN
                      "Civici" = 'Neri' THEN color_rgb(0,0,0)</span></span><br>
                  <span><span style="font-family:"Courier New"">ELSE
                      color_rgb (255,0,0)</span></span><br>
                  <span><span style="font-family:"Courier New"">END</span></span></div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>Thank you in advance.</div>
                <div><br>
                </div>
                <div>Cheers</div>
                <div>
                  <div><br>
                    <div dir="ltr">_</div>
                  </div>
                </div>
              </div>
              _______________________________________________<br>
              Qgis-user mailing list<br>
              <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
              List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
              Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
            </blockquote>
          </div>
        </blockquote>
      </div>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
Qgis-user mailing list
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
    </blockquote>
  </div>

_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</blockquote></div>