Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
if(num(LifSafetyScore) >= 8 and (num(LifSafetyScore) <= 12 ,RED(),
if(num(lLifSafetyScore) >= 13 and (num(LifSafetyScore) <= 18 ,GREEN(),
if(num(LifSafetyScore) >= 18 and (num(LifSafetyScore) <= 22 ,Yellow()))))))
Above script is not working.How can write it ?
Can you try this:
If(LifSafetyScore >= 8 and LifSafetyScore <= 12, Red(),
If(LifSafetyScore >= 13 and LifSafetyScore <= 18, Green(),
If(LifSafetyScore >= 18 and LifSafetyScore <= 22, Yellow())))
UPDATE: I think the issue might be related to the parenthesis
can you let us know where you are writing this script and what type of object you have creating?
any sample QVW that you can post would help us to understand the issue..
Can you try this:
If(LifSafetyScore >= 8 and LifSafetyScore <= 12, Red(),
If(LifSafetyScore >= 13 and LifSafetyScore <= 18, Green(),
If(LifSafetyScore >= 18 and LifSafetyScore <= 22, Yellow())))
UPDATE: I think the issue might be related to the parenthesis
You seem to have too many parentheses. Try removing the ones in bold from below.
if(num(LifSafetyScore) >= 8 and (num(LifSafetyScore) <= 12 ,RED(),
if(num(lLifSafetyScore) >= 13 and (num(LifSafetyScore) <= 18 ,GREEN(),
if(num(LifSafetyScore) >= 18 and (num(LifSafetyScore) <= 22 ,Yellow()))))))
Hi Pavana,
Maybe parenthesis issues:
if(num(LifSafetyScore) >= 8 and num(LifSafetyScore) <= 12 ,RED(),
if(num(lLifSafetyScore) >= 13 and num(LifSafetyScore) <= 18 ,GREEN(),
if(num(LifSafetyScore) >= 18 and num(LifSafetyScore) <= 22 ,Yellow() )))
Maurice
I agree with Sunny T , the issue might be to the parenthesis.
if(num(LifSafetyScore) >= 8 and (num(LifSafetyScore) <= 12 ,RED(),
if(num(lLifSafetyScore) >= 13 and (num(LifSafetyScore) <= 18 ,GREEN(),
if(num(LifSafetyScore) >= 18 and (num(LifSafetyScore) <= 22 ,Yellow()
)
)
)
Regards.
Dear Pavana,
Try this one, I hope you are looking for that one:
if(num(LifSafetyScore) >= 8 and (num(LifSafetyScore) <= 12), RED(),
if(num(lLifSafetyScore) >= 13 and (num(LifSafetyScore) <= 18), GREEN(),
if(num(LifSafetyScore) >= 19 and (num(LifSafetyScore) <= 22), Yellow())))
Kind regards,
Ishfaque Ahmed
The num()* function does nothing here, so you can remove it. You can also reduce the number of conditionals, so the expression becomes much simpler:
if(LifSafetyScore >= 8,
If(LifSafetyScore <= 12 ,Red(),
if(LifSafetyScore <= 18 ,Green(),
if(LifSafetyScore <= 22 ,Yellow())))
)
* Num() is a formatting function, and it does not affect the underlying value. The comparisons are on the underlying values so they are not affected in any way by the Num().
EDIT - minor correction to the expression
if(num(LifSafetyScore) >= 8 and (num(LifSafetyScore) <= 12 ,RED(),
if(num(lLifSafetyScore) >= 13 and (num(LifSafetyScore) <= 18 ,GREEN(),
if(num(LifSafetyScore) >= 18 and (num(LifSafetyScore) <= 22 ,Yellow()))))))
If the LifSafetyScore is not being recognised as a number, you may need the Num#()
Num#(<a string>) is the number interpretation function takes a string and outputs a dual number
Num(<a number>) is the number format function and takes a number and outputs a dual value formatted as specified