# Custom property

**URL:** <https://forum.inductiveautomation.com/t/custom-property/69820>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [February 14, 2023, 12:48pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820 "2023-02-14T12:48:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Watson\_Durom](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@Watson\_Durom](https://forum.inductiveautomation.com/u/Watson_Durom)\
**Post date:** [February 14, 2023, 12:48pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/1 "2023-02-14T12:48:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 14, 2023, 12:57pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/2 "2023-02-14T12:57:36Z")

</div>

> [@Restricting the data value of custom Range](https://forum.inductiveautomation.com/t/restricting-the-data-value-of-custom-range/69818/2):
>
> Where is this data coming from: a tag, or some type of component like a table or numeric text field?

---

<div class="post-metadata">

**Author:** ![Watson\_Durom](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@Watson\_Durom](https://forum.inductiveautomation.com/u/Watson_Durom)\
**Post date:** [February 14, 2023, 1:06pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/3 "2023-02-14T13:06:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 14, 2023, 1:08pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/4 "2023-02-14T13:08:26Z")

</div>

Can you share your expression?

---

<div class="post-metadata">

**Author:** ![Watson\_Durom](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@Watson\_Durom](https://forum.inductiveautomation.com/u/Watson_Durom)\
**Post date:** [February 14, 2023, 1:11pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/5 "2023-02-14T13:11:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Watson\_Durom](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@Watson\_Durom](https://forum.inductiveautomation.com/u/Watson_Durom)\
**Post date:** [February 14, 2023, 1:12pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/6 "2023-02-14T13:12:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2023, 1:24pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/7 "2023-02-14T13:24:47Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Watson\_Durom](https://avatars.discourse-cdn.com/v4/letter/w/edb3f5/32.png) [@Watson\_Durom](https://forum.inductiveautomation.com/u/Watson_Durom)\
**Post date:** [February 14, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/custom-property/69820/8 "2023-02-14T13:26:07Z")

</div>

Thanks i will try this.
