Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Formula Indicator syntax

mike_bush
Kilo Guru

I recently discovered that I can end a formula with (for example) || 100 so that a percentage calculation would return 100 if there were no scores on a particular day - VERY useful and not really documented, only appears in some earlier forum posts.

Is there any other syntax I can use - I'd really like to say (if xxxx/yyyy > 100 then 100 else xxxx/yyyy) or words to that effect.

How much syntax and parsing actually occurs?

1 ACCEPTED SOLUTION

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You should be able to use (simple) javascript expressions.



Your example could be like:



([[xxxx]]/[[yyyy]] > 100) ? 100 : [[xxxx]]/[[yyyy]]



Or shorter and in my opinion more readable


Math.min(100,[[xxxx]]/[[yyyy]])


View solution in original post

3 REPLIES 3

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You should be able to use (simple) javascript expressions.



Your example could be like:



([[xxxx]]/[[yyyy]] > 100) ? 100 : [[xxxx]]/[[yyyy]]



Or shorter and in my opinion more readable


Math.min(100,[[xxxx]]/[[yyyy]])


Brilliant - how do you know this stuff? Talk to all the right people?



Should it not be DOCUMENTED !?!?


Glad it helped Mike!


I'm now part of the ServiceNow PA team, so I do talk with the right people now.



We'll do our best to make features like this more visible, through documentation and off course the community!