Custom property

Hi,
There is a custom property (integer datatype). If values of this property go beyond 100 it should become as 100 and if values, go less than 0 then values should stay at so basically, it's like restricting values within 0 to 100. We have to achieve this using scripting or expression.

Thanks

Its value from expression (can be from tag or other component) as custom property has value now,
The value in custom property should be within 0 to 100 in range.

Can you share your expression?

round(({Root Container.Performance.UNITS_TESTED.value}/{Root Container.Performance.UNITS_PLANNED_1.TOTAL_PLANNED})*100)

This is the expression. which is used for the custom property

I need the output for this value to restrict between 0 - 100 in range

Wrap your expression in the min() and max() expression functions (the third documented form). Like so:

min(100.0, max(0.0, ...your expression...))

Note that the minimum you want goes with the max() function, and maximum you want goes with the min() function.

2 Likes

Thanks i will try this.