Is there a way to set a tag value to the value of a custom property in vision?

Hello,

Is there a way to write the value of a custom property to a tag in vision?

I am trying to figure out the best way to convert the polyol factor (which is input by the user as a percentage from 0-100.00%) from decimal to integer in ignition. My thought was to read in the value of the input as a float, do the conversion to integer in a custom property, and then write the value of the property to the tag.

In my example, the user would input 84.55%. I convert that to 8455. Then write the integer to the PLC.

Is this possible or is there a better way to do this other than changing the type in the PLC?

PolyolFactorConversion custom property contains: toInt({Root Container.Container.PolyolFactor}*100)

Tag Scaling or Derived Tags might be easier to work with than custom property math?

I tried scaling but I lose the decimal places to rounding. I will take a look at derived tags. Thanks!

Definitely use tag scaling. Works in both directions. The Ignition tag can be float while the PLC tag is integer and it will Just Work™.

If you are losing decimal places then you have chosen proper min and max values.

So these are the settings I've tried with scaling. Do you see what I may be doing wrong?

For example, if I enter 85.62 it rounds 86. The conversion is correct since it writes 8600 to the PLC tag, but it's still rounding off digits. If I can keep the value to 8562 I would be set but I haven't figured out how to do so with the scaling parameters given.

I really need to keep the decimal to the hundredths place.

Try changing the tag's datatype from Integer to Float.

2 Likes

You guys are awesome! That worked. Thanks again!!!