Issue with Dynamic Popup and Custom Properties

Hello,

I'm reaching out regarding an issue with a dynamic popup.

I have created custom properties on the object that should be clickable and trigger the popup:

I then linked these custom properties in the popup configuration, using the params of the view I want to open:


However, this setup isn't working as expected, except for one specific case:

image

I am using it as follows:

For other cases, the variable value does not update properly. Here’s an example where the button does not update the variable as intended:

Did I miss a step in the setup? Any help would be greatly appreciated!

Thank you in advance, and have a great day!

All your parameters are input only.
Click on the arrow and set them to Input/Output.

See Views in Perspective Input/Output Parameters.

Thank you for your response, but the issue persists...
When I click on my pop-up and select Auto (=1), my variable remains at 0.


Thanks in advance, and sorry for the inconvenience.

Output parameters are not going to work properly from a popup view as the popup is not actually within your base view.

See here: How do I use the Input, Output, Input/Output options on perspective's view params? - #3 by cmallonee

So, if you're expecting a value on your base view to update based on a parameter in your popup automatically, put simply, it will not.

I tend to use messaging to pass data back from my popup views, but as is pointed out in the above topic you can use session properties as well.

Looks like you are passing in tag paths (as strings) to your popup view, but you are not binding to the tags from within the popup.
Change your multi-state button controlValue binding to a Indirect Tag Binding.
You would leave your view parameters as inputs only (you are not planning on overwriting the string / tag path, just referencing it within the popup to create your dynamic binding to a tag).
If all tags of a motor that are to-be referenced within the popup are in the same folder, consider creating a single tag path parameter, which would be the path to the motor folder. Then, your indirect binding for each tag will reference the same folder path with added tag name. E.g. {1}/{2}_Mode
Where:
{1} = {view.params.Folder_Path}
{2} = {view.params.Name_Pompe}
If you can manage to remove the equipment name prefix from each tag (since they are already grouped within a folder by the same name), your tag bindings become even more straightforward.

1 Like

Thank you, rperretta and Chris, for your responses.

It works well when using Indirect Tag Binding!

@Chris_Bingham
However, when I want to use expressions and conditions, for example, to control the visibility of buttons:

  • If Mode = 0, the ON button is enabled.
  • If Mode ≠ 0, the ON button is not enabled.

Is it possible to use Indirect Expressions?

Should I use this?

Or this ?

I feel like neither of them is working...

Thanks in advance! Have a great day, everyone!

A tag expression will always want the results of the expression to be a tag path (which is bound to). Therefore, the expression therein should never result in true/false.
Create a custom property on your view which binds to the Mode tag, then use an expression binding which creates a true/false based on that existing tag binding.
Something resembling:
{view.custom.Mode} = 1
Use the property object picker within the expression in order to select the correct property after you create it.

Optionally, you could bind to the Mode tag with an indirect expression, then add an expression transform with a true/false expression based on that tag value…but I’m guessing you will be using the Mode tag value in more than one place, which is why I recommend creating the tag value binding in a common place to all objects in your view, and referencing that property as often as needed.

1 Like

Thank you Chris, it works correctly now.

One last small question:

I now want to change the state of a variable from a scripted button that uses the parameters from my Popup view.

I want that when I click ON,

my variable, which is also a custom property (Var_BP_Ma) of my main page, should be set to True.
I also want Var_BP_At to be set to False, and Var_Voy_Ma to be set to True.

Here is my code (ON Button): (the opposite is done for the OFF button).

However, when I click the button, the values of my variables do not change, and here is what happens endlessly:

Thank you in advance and sorry for the inconvenience.

This looks like you are writing to the parameters which contain your tag paths, not writing to the tags themselves...? If these are considered to be input parameters - which contain the tag paths (as a string), I would never write back to them. After you click a button to write values to overwrite the tag paths, you are losing any reference back to the actual tags, which might be why your screen displays errors on each of those tags.

To keep things simple & straightforward, I would update your architecture to the following:

  1. Create a single input parameter on your view called Pompe_Path ( (view.params.Pompe_Path), which will be a string containing the tag path to your pump folder (or UDT). This will be the only parameter that you pass into this view, and you never write to it again.
  2. Create several view.custom parameters, which are indirect tag bindings to each of your tags. Where {1} below = view.params.Pompe_Path
  • view.custom.Var_Def : {1}/Var_Def
  • view.custom.Var_Ma : {1}/Var_Ma
  • view.custom.BP_Ma : {1}/BP_Ma
  • etc...
  1. When building your graphics, reference the view.custom.xxxx parameters. Read / Write w/ bidirectional property binding to each of those properties everywhere in the view. Nothing within your graphics would need to reference the original input parameter (view.params.Pompe_Path).
2 Likes