Perspective objects and binding question

Hello,
I am trying to change the color of an Icon in Perspective, I can change the value if (value>0,colorTrue,colorFalse). That is working fine, but I would like to change the colour by a query dataset result.

But I didn´t find the way to "Query" with a Transform in Icon.props.color and use the resulting dataset in the "Expression" binding due to "Loop" detected.
So, do I have to use an auxiliary text field to make the query to use that Textfield.dataset[0,X] as part of the Expression in my Icon.Props.Color? Seems no logic using another textfield, but is the only way I achieved it to work. Even I tried to add a custom property, make the Query on that property and use it in color but did not work.

And my second question is, in a screen with more than 50 icon elements, all the same, the only that changes is the Expression tag name, which is Pos2 instead Pos1 in the tag name.
How do I manage it to do it in the easiest way, not changing 1 by 1 all the tags?

Thank you

Make a custom property. Use this to hold the resulting dataset from your query. If you're using these results multiple times, make the custom property on the root container of the view so the same query isn't being run multiple times unnecessarily.

Then bind your fill color to a specific dataset value from the returned dataset.

Not sure I follow what you're trying to do here, or how the icons are laid out. Needs some more info.

Thank you for the reply. I will try with the custom property.
The second part question is...
Is there any way to copy/paste some element and modify all the tags linked to that icon (in Color expression for example, may be some Custom Property...) just one time?
Or i have to replace the tag path in every single property field?
In traditional Scadas there is a context button which is "Replace tags" and you can list all the tags linked to the element, instead replacing the tag one by one in color expression, custom property, visibility condition....
If you have some element with so many bindings with a tag (in colour, visibility, custom property, position...) you will spend lot of time replacing all the tag names if you have a big amount of elements.

Thank you

Sounds like you want an embedded view with a parameter.

Hello,
After testing with a Custom property:
-Created a custom property called Color
-Making a query from a stored procedure and getting a dataset (return values from 0 to 6)
-How do I map that value to a color? I don´t know how to refer the expression to the result query dataset.
I am assuming I can not make {this.custom.Color}[0,3]=1 since I would be calling the color in the output, not the dataset i want to map to.

I would use two completely separate properties (until you get the syntax down at least).

Create another property and use an expression binding to your dataset property (don't use a transform).
You should be able to use the {this.custom.Color}[0,3] syntax to get the value at [0,3].

Hover over "Error_Configuration" and a tooltip will tell you the exact error.

Yes, thank you, that was the way.
Seems that there is not possible to make a Dataset Query and a transform in the same step.
With 2 custom properties works fine.

The other aspect I was trying to solve, is made by just creating another property called "Path" and associate the Path with the Tag of the icon. Refering all the properties to the same custom property instead of the tag, will save much time than editing all properties one by one.

Bye!

1 Like