I am using a dataset tag as a "lookup table" to change the background color of a label.
So I want to bind an expression to the backgroundColor of a label.
Here is some pseudo-code of what I am looking for (assume 'dataset' refers to the pictured dataset above):
subassembly = '720342'
rowIndex = getRowIndex(dataset,subassembly) //what is the syntax for this??
color = dataset(rowIndex) //backgroundColor would be bound to this value, and would be purple
I should also say, that you may need to do some work to convert the java.awt.color type that you are providing into CSS compatible with perspective styling.
You'll want to bind the dataset to a custom property on your view, then reference that property in your expression. While there's a way to directly reference a tag, it's slow and not recommended doing it that way.
For a script the path is the same, just minus the curly braces and you use .getValueAt(row, col) to fetch a value, ie path.to.component.customProperty.getValueAt(0,12)
When building your expression, you'll be able to directly browse to it. The exact path/syntax you'll need varies depending on where you bind it, but if you put one on the view named myDS then it would be named {view.custom.myDS} in your expression.
If this is related to your other post, then as @pturmel posted over there, and here, 'lookup()' is part of the expression language, which is not the same as the Jython scripting that takes place in a tag value change script.
The syntax for referencing a property and/or a tag will vary based on context. I would highly recommend that you use the property/tag selector available in the editor dialog to select the property/tag you are interested in.
I feel like we’re missing a bit of context as to what exactly you’re having issues with and where you’re trying to accomplish it. The more detail you give us the better we’ll be able to help.
I was able to succesfully use @lrose 's lookup expression after binding my dataset tag to a custom property in my view. I added a column to the dataset with the hex values for each color so they could succesfully be bound to backgroundColor in my label.