Rank: Advanced Member
Groups: Registered
Joined: 9/13/2018(UTC) Posts: 41 Location: Ottignies Was thanked: 2 time(s) in 2 post(s)
|
Hi there,
I have a request from the users for conditional formatting on dates.
The report is about projects, and their start/end dates, and the status.
The idea would be that if the end date is over, and the project is still ongoing (not closed), the date should be displayed in red.
I found out using the cell script how to format the cells, but I'm stuck on the date comparison... (cell.Value <= Now() ???)
Can you please help?
Thank you in advance Thomas
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Cell script is the good place for conditional formatting. In your cas I would suggest: Code: if (! cell.IsTitle && cell.DateTimeValue < DateTime.Now) {
cell.FinalCssStyle = "background:red;";
}
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 9/13/2018(UTC) Posts: 41 Location: Ottignies Was thanked: 2 time(s) in 2 post(s)
|
Thanks!
It worked fine on the date comparison.
Now that I added the comparison of the string part, it seems not to work.
Is there something like cell.StringValue I am supposed to use when comparing strings?
Thanks!
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Read the documentation in comments: cell.DisplayValue (type = string) is the display value cell.DoubleValue (type = double?) is the cell value for numeric cell.DateTimeValue (type = DateTime? ) is the cell value for date time
To customize your calculation and cell display, you can assign cell.Value (type = object) is the cell value: string, double or DateTime
cell.Value can be casted as a string or you can use DisplayValue.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.