Error trying to use a template with a dataset

I am working on a project and need to create a template with a Numeric Label for the value and a Label for the description. There is a custom property "mbRegister" on the root container of the template. There is an indirect tag binding that pulls in the value using a parameter referencing the numerical part of the tag path (modbus addresses).
There is a dataset on the root container of the main page that contains a column with the modbus addresses and a column containing the descriptions that I want to use for the labels.
I tried several different expressions with the following being the latest.

lookup({rootContainer.rootContainer.getComponent."nameData"}, {descreteInputs.mbRegister}, "000", "Address6", "Description")

I get the following error:
Unable to find component for path: 'rootContainer.rootContainer.getComponent."nameData"'
Any suggestions would be appreciated.

rootContainer.rootContainer is invalid as is getComponent(...) (this is a scripting function)

Try selecting your prop using the property selector instead.

It should be something like {Root Container.nameData}

3 Likes

Hi Nick,

Thank you for the reply to my post. I realized after I made the post my error with the scripting function. As to your suggestion: “It should be something like {Root Container.nameData}”, I had tried that along with several variations without success. I am not sure it is simply a matter of binding to a property.

Previously when I needed to create a template, typically some sort of indirect tag binding using a parameter was sufficient and in fact I am doing that for the tag value.

However, for the label I am trying to use the six numbers in the tag path to lookup the label data from a dataset. Below is a sample of the tag paths:

[default]Boiler/OPC_UA_Boiler_Tags/Input_RO_IR_300001.value

[default]Boiler/OPC_UA_Boiler_Tags/Input_RO_IR_300002.value

[default]Boiler/OPC_UA_Boiler_Tags/Input_RO_IR_300003.value

The dataset which is named nameData is a custom property on the main page root container. I have tried everything that I can think of to make this work. I tried creating a script on the project, also without success.

I did have a bit of success with the dataset. If I use a custom property in the lookup and then manually enter the number for each instance it does lookup the correct description form the dataset and sets it as the label text. But, there are dozens of tags and I was hoping to automate the process.

I’m not really sure if what I am trying to do is even possible.

Best regards,

Harry

What is this used for? Perhaps a simple initialization script could be used instead.

I have a template with a label. I also have a customer property with a dataset on the main page that has a column with the six digit modbus registers and a column with the descriptions that I want to use for the label text.

The path for each tag contains the six digit modbus register along with other non numerical text.

I am trying to use a lookup for the dataset based on the number portion of the tag path to bind the description to the label text field.

As for your suggestion using a simple initialization script; I’ve never used one and I’m not sure how to implement it.

To me, this sounds like an XY problem, where the solution you're asking help with may not be the best solution to the problem itself.

What populates the "dataset on the root container of the main page that contains a column with the modbus addresses and a column containing the descriptions that I want to use for the labels"?

The tag paths you replied with don't seem logical to me, unless i'm missing some more context that would make them so. But including a modbus register in a tag name isn't something I'd expect to see.

Can you show a screenshot of the data in the dataset?

When you said this, are you actually trying to read the main page's "nameData" prop from within the Template label? If so, this isn't going to work - You can't use the expression language to get the value of a prop in the main page. You would need to pass this into the Template

1 Like

Hi Nick,
Sorry for the long delay; got into something else here at work and this was put on the back burner for a bit. Your advice ultimately lead me to a solution. The way I was trying to do this would never work. Thank you.
Best,
Harry

1 Like