Expand my Community achievements bar.

Valueexpression in style rule?

Avatar

Level 1

In a report, I am trying to get the column for the Duration as of Today [WEEKDAYDIFF({actualStartDate},$$TODAY)] to show as red if the planned duration is less than the Duration as of Today. Below is what I have.

 

displayname=Duration as of Today
linkedname=direct
namekey=actualStartDate
querysort=actualStartDate
styledef.case.0.comparison.icon=false
styledef.case.0.comparison.leftmethod=duration
styledef.case.0.comparison.lefttext=duration
styledef.case.0.comparison.operator=lt
styledef.case.0.comparison.operatortype=double
styledef.case.0.comparison.righttext=WEEKDAYDIFF({actualStartDate},$$TODAY)
styledef.case.0.comparison.trueproperty.0.name=textcolor
styledef.case.0.comparison.trueproperty.0.value=d30519
styledef.case.0.comparison.truetext=
textmode=true
valueexpression=WEEKDAYDIFF({actualStartDate},$$TODAY)
valueformat=customNumberAsString

 

It works if I use a number (e.g., "34") rather than "WEEKDAYDIFF({actualStartDate},$$TODAY)" for the line in bold, which leads me to believe my syntax isn't correct. I tried taking actualStartDate out of the curly brackets but that didn't work. Does anyone have a clue how I can make this work?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

I think the problem may be that you're trying to colour something that is being calculated on the fly. What you need to do is a comparison. I know you can compare two fields and style them based on an operator; greater than, less than, equals, etc. but I don't think you can do a compare routine on a calculated column since it's calculating on the fly. (I'd like to be proven wrong about this). Maybe a calculated field would work though.

Here'a an example of a column that's styled based on if the task planned hours is greater than the template task planned hours. If so, it's red:

 

descriptionkey=plannedhour.plural
linkedname=direct
listsort=intAsInt(workRequired)
namekey=workRequired
querysort=workRequired
section=0
shortview=false
stretch=0
styledef.case.0.comparison.icon=false
styledef.case.0.comparison.leftmethod=work
styledef.case.0.comparison.lefttext=work
styledef.case.0.comparison.operator=gt
styledef.case.0.comparison.operatortype=double
styledef.case.0.comparison.righttext=templateTask:work
styledef.case.0.comparison.rightmethod=templateTask:work
styledef.case.0.comparison.trueproperty.0.name=textcolor
styledef.case.0.comparison.trueproperty.0.value=d30519
styledef.case.0.comparison.truetext=
textmode=false
valuefield=workRequired
valueformat=compound
viewalias=workrequired
width=90

 

In this example the left text "work" is compared to the rightext "templateTask:work" with the operator "gt" (greater than). when true, the textcolor is d30519 (Red).

TIP: if this solved your problem, I invite you to consider marking it as a Correct Answer to help others who might also find it of use.
If you like my content, please take a moment to view and vote on my Idea Requests: https://tinyurl.com/mysocalledideas

 

Avatar

Level 1

Thank you for your time.

 

I'll come back to let you know if the calculated field idea works.