Up to this point, everything works fine — the value from the dataset is correctly loaded into the text field. Now I’ll describe the issue step by step.
The text field binding loads the value from the dataset column, for example "M_L".
The user edits the text field to "G_O", and the value is correctly changed without being overwritten.
Then, the user modifies the key custom property.
What happens is that the text field’s expression binding is re-executed, causing it to reload the value from the dataset — so the text field value goes back to "M_L".
I’d like to understand if it’s normal for the binding to re-evaluate every time a parameter is updated, even if that parameter is not directly linked to the binding itself.
key is simply passed as a parameter to the embedded view, and within that view it has no binding at all. So I don’t understand why the expression binding re-evaluate when the value of key change.
I think you're seeing this because you're using a dataset as a parameter.
Datasets aren't really first class objects in Perspective, and I'd bet there is something lossy in the Gateway -> Client -> Gateway sync process that's causing spurious change events to be detected for datasets.
It's worth noting that this issue doesn't happen with my Embedded View + component, so I'd wager that these extra change detections are coming from the Perspective client side of things.
I ran a test, changing the query's return type from dataset to json and modifying the text field's expression binding to coalesce( try( {view.params.ds}[0]['label'], ""), ""). Now the problem doesn't seem to occur anymore.
So, given that I need to use JSON, I'm facing another issue. Initially, my expression binding used the lookup() function to find a specific value in the "ZST_CODPAR" column and extract the data from the "VAL_PAR" column:
Now that the return is JSON and not a dataset, I can no longer use lookup(). What would be the best solution to access this data? I would like to avoid using runScript() or a script transform.
I'll also take this opportunity to ask where I can download the module you mentioned. I followed the link, but it took me to the version for Ignition 8.3, I’m using the 8.1.
For the time being, I've "resolved" it as follows:
I retrieve the data using a Named Query, setting its return format to JSON instead of dataset.
I pass the JSON as a parameter to the Embedded View.
In the Embedded View, I created a custom property ds, bound it to the incoming JSON params, and used a script transform to convert it back into a dataset.
I set the text field bindings as they were originally, but pointing to this new custom property instead of the view's params.
If you have my Integration Toolkit, you can use the where() expression function and then square bracket operations to do the equivalent of lookup() with lists of dictionaries. Perhaps this: