Colouring in the SQL query field

Hello,

I want to make a dynamic colouring process in order to highlight the DELAYED_TARIH field in my query. If the date is today's date, I want it to remain red if it is a date that is not yet due, I want it to remain green.

I am waiting for your help in this regard, thank you.

SELECT
Caption AS LOKASYONADI,DetailsUrl AS [_LinkFor_LOKASYONADI],
Nodes.CustomProperties.LokasyonNo AS TEMOSNO,
Nodes.CustomProperties.TRANSPOL_HIZ AS TRANSPOL_HIZ,
Nodes.CustomProperties.GECICI_HIZ AS GECICI_HIZ,
Nodes.CustomProperties.GECICI_TARIH AS GECICI_TARIH
FROM Orion.Nodes
where Nodes.CustomProperties.GECICI_HIZ >= 1
and (Nodes.CustomProperties.Department IN
('IL E', 'HT KAPISI', 'YEDEK HAT', 'MERKEZE BAGLI LOKASYON', 'BSSS', 'ANA HAT' , 'KHK', 'DHK', 'HKK' , 'HAVALIMANI'))
order by GECICI_TARIH ASC;

  • Not sure if there's a way to add color in a sql query box, it'd need to be like [_ColorFor_x] or something

    You can do it in a custom table element, by using CASE with HTML formatting and enabling HTML on the column it results in

    I don't see the 'DELAYED_TARIH' column in your table, I'm sure it's a language thing i'm not getting

    Something like

    SELECT
    CASE
    WHEN timestamp >= GETUTCDATE() THEN CONCAT('<span style="color: #6A5ACD;">', caption,  '</span>')
    ELSE caption
    END as Name

    You'd need to add the URL into that in the same way

  •   posted a modified version of the custom query widget a few years ago that allows you to do all kinds of style sheet modifications in the widget you are using. Its a bit of a chore to get it added to your environment, but i love it
    RE: Custom Query resource with colors and styles

    Otherwise the OOTB custom query widget does not support any control over the display formatting, so in ye olden days we all did what  mentions with adding html formatting to the custom table widget since it has the check box for allowing html.

  • Cevaplarınız için teşekkür ederim
      dedi, case sorgusunu kullanarak düzenleme yaptığımda 'Sorgu geçerli değil' hatası alıyorum.

    Sorgu düzenlenmiş hali doğru mu? Sorun nerede?

    SELECT
    Caption AS LOKASYONADI,
    DetailsUrl AS [_LinkFor_LOKASYONADI],
    Nodes.CustomProperties.LokasyonNo AS TEMOSNO,
    Nodes.CustomProperties.TRANSPOL_HIZ AS TRANSPOL_HIZ,
    Nodes.CustomProperties.GECICI_HIZ AS GECICI_HIZ,
    CASE
    WHEN Nodes.CustomProperties.GECICI_TARIH >= GETUTCDATE() THEN
    CONCAT('<span style="color: #6A5ACD;">', CAST(Nodes.CustomProperties.GECICI_TARIH), '</span>')
    ELSE
    CAST(Nodes.CustomProperties.GECICI_TARIH)
    END AS GECICI_TARIH
    FROM Orion.Nodes
    WHERE Nodes.CustomProperties.GECICI_HIZ >= 1
    AND Nodes.CustomProperties.Department IN
    ('IL E', 'HT KAPISI', 'YEDEK HAT', 'MERKEZE BAGLI LOKASYON', 'BSSS', 'ANA HAT' , 'KHK', 'DHK', 'HKK' , 'HAVALIMANI'))
    ORDER BY GECICI_TARIH ASC;

  • I don't believe you can use CAST but otherwise that looks OK at a glance