# UDT calculated values sequence

**URL:** <https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276>\
**Category:** Ignition\
**Created:** [October 17, 2022, 1:16pm UTC](https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276 "2022-10-17T13:16:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergioS](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SergioS](https://forum.inductiveautomation.com/u/SergioS)\
**Post date:** [October 17, 2022, 1:16pm UTC](https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276/1 "2022-10-17T13:16:07Z")

</div>

Good morning,  
into UDT (or tags in general) is possibile do define sequence for calculated tag?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/75ebf9fecfd08a72823a43556091c576014c219d.png)

In my case I need to calculate Datetime readed from siemens , and I need that DT is calculated as last expression, for be sure to have consistent value.

Someone have idea of how I can do?

Thanks

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [October 17, 2022, 1:31pm UTC](https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276/2 "2022-10-17T13:31:19Z")

</div>

Hello, I think you can achieve what you want by building your datetime tag using getDate() and setTime().

`setTime(getDate({[.]DT_YY}, {[.]DT_MN}, {[.]DT_DD}), {[.]DT_HH}, {[.]DT_MT}, {[.]DT_SS})`

---

<div class="post-metadata">

**Author:** ![SergioS](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SergioS](https://forum.inductiveautomation.com/u/SergioS)\
**Post date:** [October 17, 2022, 1:53pm UTC](https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276/3 "2022-10-17T13:53:48Z")

</div>

may be i'm not explained very well.

"BCD" tag are readed from plc, scheduladed at ScanGroup, expression tag are too executed at same ScanGroup , but for some raison (that i don't arrive to identifie) expression tag are not executed after opc tag reading, and calculated tag DT don't have consistence value (correct value)

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 17, 2022, 3:19pm UTC](https://forum.inductiveautomation.com/t/udt-calculated-values-sequence/65276/4 "2022-10-17T15:19:50Z")

</div>

Use derived tags instead of expression tags.  
If you don't want the DT tags to be able to write back to the BCD tags, remove the write expression.
