# UDT Parameters Division

**URL:** <https://forum.inductiveautomation.com/t/udt-parameters-division/59989>\
**Category:** Ignition\
**Created:** [May 24, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989 "2022-05-24T22:19:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 24, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/1 "2022-05-24T22:19:20Z")

</div>

in accord with that: [https://docs.inductiveautomation.com/display/DOC81/UDT+Parameters](https://docs.inductiveautomation.com/display/DOC81/UDT+Parameters)  
/ Division. Dividing the first number by the second number. {BaseAddress/2} but a result is a double number like “0.1” i try to format: {BaseAddress/2|0} but the result is a rnd no a floor so how to have a integer i try many ways but I’m lost

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 24, 2022, 10:34pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/2 "2022-05-24T22:34:50Z")

</div>

What BaseAddress value gives you a result of “0.1”?  
Where is the result visible? (I have never used this feature so I do not know.)

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 24, 2022, 10:41pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/3 "2022-05-24T22:41:15Z")

</div>

I just copy and past from the manual in my was {No/16}:  
No is an integer…  
but if “No” is 2 comes the result is 0.125  
if I change to {No/16|0} comes 0 (right) but until 8 after the result is 1 … I’m confused about how to do … I miss something …

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 24, 2022, 10:43pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/4 "2022-05-24T22:43:04Z")

</div>

You can see the result in the instance of the UDT

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 24, 2022, 11:14pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/5 "2022-05-24T23:14:57Z")

</div>

Looks like you are not the first to have this question, looks like it can be fixed with formatting.

> [@UDT Parameter math is not evaluating correctly](https://forum.inductiveautomation.com/t/udt-parameter-math-is-not-evaluating-correctly/47911):
>
> This does not work. Note that the Description worked. [image] Actual OPC path for the alarm: ns=1;s=[PL\_STACKER]PL\_Stacker.Alarm[0].2 Parameters. The alarm configuration with the parameter math. [image] Testing… [image] [image] Both failed… The non math reference obviously works fine. [image] Am I doing this wrong? The documentation seems pretty clear. Any suggestions?

Just tried it out, it works, you were close:

```auto
{BaseAddress/2|#}

```

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 24, 2022, 11:37pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/6 "2022-05-24T23:37:32Z")

</div>

I’ll try tomorrow morning… anvirtual 🍻 for your help …

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 25, 2022, 1:26pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/7 "2022-05-25T13:26:32Z")

</div>

you gave me false hope ☹

I tried with # but the result is the same

{x/16|#}

with x from 0 to 8 the result is 0  
with x\> 8 the result is 1

so… how to do it?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 25, 2022, 1:36pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/8 "2022-05-25T13:36:04Z")

</div>

Tip: use the `</>` code formatting button when pasting blocks of code. It preserves indents and applies syntax highlighting. You can use ``backticks`` for inline code. It makes it much clearer where code starts and ends.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 25, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/9 "2022-05-25T16:05:26Z")

</div>

~~Not sure what to tell you, works as expected for me.~~

Edit:  
Actually you are right, it doesn’t. Part of me thinks this may be a bug but the other part is saying when you divide 9 by 16 the answer is a float.

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 25, 2022, 4:28pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/10 "2022-05-25T16:28:34Z")

</div>

I understood but for me this is crazy … I’ll change my udt and I pass 2 parameters but is not the same: a lot of work instead just a wizard udt ☹

… frustrate mode on  
what I love about ignition is the back end but if work casually I start to look around …

I like when someone explains to me how to use a tool/chat/software/calculator/etc because after 35 years of software engineering I still want to learn. But I prefer first solve a problem and after explain how to speak better: plants need to run (and produce money)  
…frustrate mode off

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 25, 2022, 4:34pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/11 "2022-05-25T16:34:09Z")

</div>

It may actually be a bug, hopefully we get an IA person to comment. This is a super niche thing though, It only applies to UDT parameters being used in an opc path. You could probably do what you need to in an expression tag with the use of floor() and bind that tag to the opc path.

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 25, 2022, 6:01pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/12 "2022-05-25T18:01:15Z")

</div>

yeah … the idea of the expression tag and floor is nice just I don’t understand how to bind that in the OPC path …

---

<div class="post-metadata">

**Author:** ![philip](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/philip/32/5709_2.png) [@philip](https://forum.inductiveautomation.com/u/philip)\
**Post date:** [May 31, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/13 "2022-05-31T16:20:08Z")

</div>

Will something like this work to get the floor:

`{(x)/16-(x%16)/16|#}`

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 31, 2022, 5:16pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/14 "2022-05-31T17:16:45Z")

</div>

> [@stra](#):
>
> with x from 0 to 8 the result is 0  
> with x\> 8 the result is 1

The result of the operation is a number between 0 and 1.

When the BaseAddress \>= 8 then the result is \>= 0.5, which when rounded becomes 1 any thing \< 8 is \< 0.5 and so is rounded to 0.

I don't think this is a bug, I think it is the intended behavior, it just isn't explained that the / is true division, not integer division. There may be some argument to a bug when the formatting is applied, as I would think it would just truncate instead of rounding.

@philip's formula will yield a floor of the dividend.

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 31, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/15 "2022-05-31T18:14:14Z")

</div>

Look like work,  
just is a crazy math way for a simple question 🙂

Thanks, Philip

---

<div class="post-metadata">

**Author:** ![stra](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/stra/32/23678_2.png) [@stra](https://forum.inductiveautomation.com/u/stra)\
**Post date:** [May 31, 2022, 6:18pm UTC](https://forum.inductiveautomation.com/t/udt-parameters-division/59989/16 "2022-05-31T18:18:42Z")

</div>

for me is crazy … what is the sense of having the possibility of floating numbers in a place where 99% is an index.  
but I’m from the old guard and the plant programming was just 2 + 2
