Expression/Calculation in OPC Item Path (Need Help)

Got 2 questions here:

  1. How can i change the OPC Path the be a tag variable?
    Specifically a HMI variable, so that if its changed it applies to everywhere in the project

  2. How can I set a expression or equiation in the OPC item path?
    A few things ive tried:
    [WTP]HR{BASEADDRESS + 2}
    [WTP]HR{BASEADDRESS}+2
    [WTP]HR({BASEADDRESS} + 2)
    etc.
    Or is there anyway to reference the OPC path through an expression tag to accomplish this?

Well firstly, you’re not going to be able to use a client tag, as these are client scoped and tags are gateway scoped. I haven’t tried what you’re attempting, but interested to see what others come back with!

This I have achieved it with a UDT. UDTs have parameters which can be used to reference where are you getting the tags from, in this case, your base address.

If you link the BASEADDRESS parameter to any inputbox, it should give you the result you’re looking for.

Conversely, you can have individual tags for each case of the BASEADDRESS (For example Tag1 has BASEADDRESS=1, Tag2 BASEADDRESS=2, etc) BUT, you can store the modifier you need stored in the inputbox as a parameter.

And the result display/label should have an expression-Tag like this {Tag[param.inputbox.baseaddress]}. This is pseudocode and I’m pulling it out of my head from other developments I’ve made.