简体   繁体   English

计算指标:创建指标表达式

[英]Calculated metrics: create metrics expression

I want to create Calculated metrics expression for same Logical expression for example by Java 我想为相同的逻辑表达式创建计算的度量表达式,例如通过Java

if (KPI<=95 & FailedCount!=0) {

STATUS=1;}

else {STATUS=0;}

In Site Scope I wrote this expression 在Site Scope中,我写了这个表达式

((<<KPI>><=95)&(<<FailedCount>>!=0))

But I do not like the result 但我不喜欢结果

When KPI=0 and FailedCount=0; 当KPI = 0且FailedCount = 0时;

STATUS=0, STATUS = 0,

then KPI=100 and FailedCount=0 然后KPI = 100且FailedCount = 0

STATUS='n/a'. STATUS ='n / a'。

How to reslove this problem? 如何解决这个问题?

ps Add question on HP Community too ps也对惠普社区添加了问题

There's a ternary operator you can use: 您可以使用三元运算符:

(Boolean Expression)? resultIfExpressionIsTrue: resultIfExpressionIsFalse

In your case you could try to use something like: 在您的情况下,您可以尝试使用以下方法:

((<<KPI>><=95)&(<<FailedCount>>!=0))? 1: 0

You may also need to consider if you want the result to be 0 and 1 as integers (as above) or as strings in which case they should be put in between " marks. This is important from the perspective if you'd like to apply arithmetic or string like thresholds to the resulting calculated metric, also if you'd like the result to be seen as numeric or string values in other places, like in OMi or Service Health etc. 您可能还需要考虑是否要将结果作为整数(如上)或字符串形式的0和1,在这种情况下,应将它们放在"标记之间。从角度来看,这很重要,如果您想应用算术运算或字符串(如所得计算指标的阈值),如果您希望在其他位置(例如OMi或Service Health等)中将结果视为数字或字符串值,也可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM