Home > Forum > General > Advanced coloring date fields in reports

Advanced coloring date fields in reports
0

Hi there,
I'm trying to work out a rule to color backround of a date cell. The condition would be "if the date in the current field is greater than today, then color backround, else dont change the color". Currently the not working JSON code is:

{
"content": "=CurrentField",
"style": {
"background-color": "=if(CurrentField > today, '#FF0000', '')"
}
}

I've also tried different variants of the condition like "date(CurrentField) > date(today)" or "CurrentField > date('TODAY')" and other similar, but none worked. Please help :)

MVP

I'm digging an old thread, but I've faced same trouble today, and had to add something new to make it work, so why not make an update :)
This is my final config, that works for Date columns (i didn't need time part, changing today() to now() should do the work though)

{
"content": "=CurrentField",
"style": {
"background-color": "=if(date(CurrentRawValue) > today(), '#FF0000', '')"
}
}

In reply to: Maksymilian Stachowiak

I'm digging an old thread, but I've faced same trouble today, and had to add something new to make it work, so why not make an update :)
This is my final config, that works for Date columns (i didn't need time part, changing today() to now() should do the work though)

{
"content": "=CurrentField",
"style": {
"background-color": "=if(date(CurrentRawValue) > today(), '#FF0000', '')"
}
}

Thank you,
the article is not clear ....

https://kb.webcon.pl/zaawansowane-kolorowanie-raportow/
https://kb.webcon.pl/kolorowanie-komorek-w-raportach-aplikacji/

help is not helping ...
https://docs.webcon.com/pl/docs/2024R1/Portal/Reports/Views

we need tutorial ... user voice ?
links to dev part of portal (with explanation) .. are death as well ...
refering to:
[quote="webcon"]
Konfiguracja w trybie zaawansowanym jest możliwa przy użyciu formatu JSON – schemat tworzenia takiej konfiguracji znajdziesz pod linkiem: http://developer.webcon.com/json-schemas/v1/column-formatting.schema.json.
[/quote]

----edit----
should I go here? https://files.webcon.com/bps/reports/column-formatting.schema.v3.json