# Perspective/View/Params - disappear

**URL:** <https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 25, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414 "2020-03-25T20:34:27Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 25, 2020, 8:34pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/1 "2020-03-25T20:34:28Z")

</div>

If I uncheck Persistent for a parameter I’ve created it will have disappeared once I close then re-open the same view in designer. Every instance utilizing the parameter works fine on a client until i run the view in preview mode with designer.

ie: imageName parameter no longer appears to exist but my insert query that uses the variable fileName executes fine until I preview the view.

 ![params](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f55d974b6c451ff65164ab9468fcf8b488507d3d.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 25, 2020, 10:23pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/2 "2020-03-25T22:23:47Z")

</div>

I feel like you're missing some important screenshots which would help explain what you're seeing. Let's start with a few assumptions

1. You've created a param named `imageName` for the view and it has a value, AND you've set it to no longer be persistent.
2. you have a binding which uses `imageName` in some way in place and it is working. If you look at the binding, you'll see that `imageName` is returning a value.
3. If you enter Preview mode right now, you'll see that everything is fine.

Now comes the trouble part: you close the View, or reach the View in an active session.

Due to toggling off the `Persistent` property, the param is not saved, which means bindings which use it will fail to locate the property.

> [@kisaacson](#):
>
> Every instance utilizing the parameter works fine on a client until i run the view in preview mode with designer.

This part has me a little confused though. Any "client" (session) which makes use a a non-persistent property will fail when it finds that property is not in place, except for one scenario: the param is created at runtime by some other script. If the param is created somewhere else

```auto
# perhaps something like this
self.view.params.imageName = 'something.png'

```

then references to the property will work because it now exists.

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 1:15pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/3 "2020-03-26T13:15:26Z")

</div>

Have you tried this? I know it sounds absurd but this error will only show up if i run the screen in preview mode, then clients will fail following after that point:

 ![error](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/5bfe936d287e52947f25bffa7e9111324a1901de.png)

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 1:18pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/4 "2020-03-26T13:18:37Z")

</div>

> [@cmallonee](#):
>
> except for one scenario: the param is created at runtime by some other script. If the param is created somewhere else

I'm creating this parameter and others by clicking +AddViewParameter.

If there are any other screenshots or information you think would be helpful let me know.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 26, 2020, 3:26pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/5 "2020-03-26T15:26:00Z")

</div>

Is there a specific reason you’re removing the persistence of this param? While we allow for toggling the persistence, it should really be left “on” if the property is going to be used in bindings.

Here was my experience after running through steps similar to your setup:

1. Place `imageName` param (doesn’t have to be a param - it could be any property).
2. Bind some property to `self.view.params.imageName`.
3. Save project.
4. Open Session to View
5. **Result** : binding is session is still working.
6. Toggle persistence to “off”.
7. **Result** : binding is session is still working.
8. Enter Preview Mode.
9. **Result** : binding is session is still working.
10. Save Project.
11. **Result** : binding in session is no longer working, as the persistence setting has now been saved to the Session.

When I mentioned “created somewhere else” I meant like a script - like I provided an example of.

Could you screenshot the Query along with however you’re invoking it and how it’s getting `fileName`? A better option would be to supply me with the view.json file for the View you’re using. If you’re hesitant to provide that file on the forum, you could always send it to me through a private message.

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 6:26pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/6 "2020-03-26T18:26:02Z")

</div>

> [@cmallonee](#):
>
> Toggle persistence to “off”.

Close the view after this step. Upon re-opening your param still exists? Mine are disappearing.

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 6:26pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/7 "2020-03-26T18:26:40Z")

</div>

> [@cmallonee](#):
>
> Could you screenshot the Query along with however you’re invoking it and how it’s getting `fileName` ?

I'll post these shortly.

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 6:46pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/8 "2020-03-26T18:46:05Z")

</div>

> [@cmallonee](#):
>
> Could you screenshot the Query

def runAction(self, event):  
"""  
This event is fired when the 'action' of the component occurs.

```
Arguments:
	self: A reference to the component that is invoking this function.
	event: An empty event object.
"""
# Write your script here
fileName = self.view.params.imageName

filePath = 'webserver/webapps/main/image/' + (fileName)	
imageBlob = system.file.readFileAsBytes(filePath)	

system.db.runPrepUpdate("INSERT INTO table (image) VALUES (?)", [imageBlob], 'DB')

```

---

<div class="post-metadata">

**Author:** ![kisaacson](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@kisaacson](https://forum.inductiveautomation.com/u/kisaacson)\
**Post date:** [March 26, 2020, 6:52pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/9 "2020-03-26T18:52:56Z")

</div>

def runAction(self, event):  
“”"  
Fired after the gateway has received a file upload.

```
Arguments:
	self: A reference to the component that is invoking this function.
	event: An object with the following attributes:
		file: An object with the following attributes:
			name (str): The name of the uploaded file.
			size (int): The size (in bytes) of the file that was uploaded.
"""

filePath = 'webserver/webapps/main/image/'
name = event.file.name
self.view.params.imageName = name

event.file.copyTo(filePath + name)
```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 26, 2020, 9:18pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/10 "2020-03-26T21:18:07Z")

</div>

> [@kisaacson](#):
>
> Close the view after this step. Upon re-opening your param still exists? Mine are disappearing.

Closing the View commits the changes to the View (though they aren't "pushed" or saved to the Gateway yet), so when you re-open, the param will not be there.

Modifying my steps to close the View as the next step after toggling Persistence to "off" did not modify the behavior of my sessions in any way. I'm beginning to think that our disconnect is stemming from phrasing you used in the original post:

> [@kisaacson](#):
>
> Every instance utilizing the parameter works fine on a client until i run the view in preview mode with designer.

I understood this to mean that you had running Perspective Sessions ("clients") which were working up until you entered Preview Mode in the Designer - at which point those remote sessions ceased functioning. If you meant that the Designer was working up until you entered Preview Mode, well then yes, this is all expected.

Once you close the View, the changes you've made so far are committed locally in the Designer - this includes your toggling of the Persistence property to "off", which means that when you re-open the View it has your committed changes, which means the param is missing. Everything will look fine, but once it attempts to read the param which no longer exists, your script will fail with the Exceptions you are seeing in your screenshot.

As I suggested before, the easy solution to this is to leave the property as having Persistent set to "on".

---

<div class="post-metadata">

**Author:** ![patrick.dunham](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@patrick.dunham](https://forum.inductiveautomation.com/u/patrick.dunham)\
**Post date:** [April 7, 2020, 4:40pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/11 "2020-04-07T16:40:03Z")

</div>

Hi, I’ve recently stumbled across this thread after spending a good hour and half trying to figure out why my views kept breaking.

I was under the impression that the ‘Persistent’ property governed persistence of values, not keys (as noted [here](https://docs.inductiveautomation.com/display/DOC80/Perspective+Component+Properties) ). After searching through the docs, I was unable to find any documentation stating that the behavior of the “Persistence” property for View Params was any different.

As a user, I’ve been under the impression that “Persistence for properties should be on, unless it’s used in a binding”. Having View Params (which I think are just special cases of properties) buck this trend is extremely confusing - especially given that I can’t find any easily-accessible documentation stating this exception.

---

<div class="post-metadata">

**Author:** ![patrick.dunham](https://avatars.discourse-cdn.com/v4/letter/p/c37758/32.png) [@patrick.dunham](https://forum.inductiveautomation.com/u/patrick.dunham)\
**Post date:** [April 7, 2020, 5:16pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/12 "2020-04-07T17:16:14Z")

</div>

I took a quick look at the `view.json` for the view where I first ran into this. Interestingly, setting “persistent” to `False` doesn’t delete the param entirely - it just seems to stop the Designer & Session from being aware of it entirely.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/aae88a1585c3c7a2baa76ea75e480ac82e164351.png)

---

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [May 16, 2020, 8:14am UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/13 "2020-05-16T08:14:23Z")

</div>

It seems there’s a disconnect regarding whether the ‘persistent’ preference should apply to parameter _values_ [as the documentation and the designer explainer pop-up suggest](http://forum.inductiveautomation.com/t/params-disappearing/26922/10) or parameter _instances_ themselves, as @osolorzano suggests in [this](http://forum.inductiveautomation.com/t/params-disappearing) thread.

Clearly as of now, it seems the latter is the case, [but i’m strongly in favor of the former](http://forum.inductiveautomation.com/t/persisting-perspective-persistent-properties-parameters-parameter-instance-vs-parameter-value-persistence/34809), and what i imagine was the original intent - no sense having properties just disappear, especially if they don’t _really_ disappear in the JSON (which would break things anyway), but just become invisible in the designer.

And like @tyrel.parker [suggests](http://forum.inductiveautomation.com/t/params-disappearing/26922/9) - these parameters are often modified for testing, and so should not retain their ‘test’ initial values just because someone forgets to clear the test values, regardless if they will likely be immediately overwritten by bindings at run time. I’ve had an embarrassing situation where comms were lost, and on view reloads across the plant, the obviously very-wrong ‘test’ initial values were displayed. Thus my desire to make all my bound property/view parameter _values_ non-persistent.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [May 20, 2020, 6:01pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/14 "2020-05-20T18:01:31Z")

</div>

The real answer here is that the concept of any property "instance" (including parameters) with no value is a meaningless concept, at least in the JSON-based property model that powers Perspective.

Thought experiment. Consider the following JSON document:

```auto
{
    "foo": "bar",
    "baz": "qux"
}

```

Now, show me that document where "baz" has no value.

> ... what i imagine was the original intent ...

This is probably the root of the misunderstanding. The original intent of the "persistent" property has a very narrow (and different) meaning than what you're trying to use it for. The intent was to ensure that values _generated by bindings_ that execute in the Designer don't get saved into the view. The purpose for this is two-fold:

1. So that views don't start up with initial values that represent the state that the process was in when last running in the designer. This would cause a brief flash of incorrect values.
2. So that bindings that generate very large objects/arrays/datasets don't have their values stored as configuration with the component, causing the saved view size to be bloated with information that will be re-generated when the view starts up anyhow.

With all that said, I think you have a valid use case for your parameter value / test value concept, it's just that's not what "persistent" means. Perhaps we need some new feature concept for a forced initial value? You might use a binding to an expression that generates a static value for this in the meantime.

---

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [May 21, 2020, 8:04pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/15 "2020-05-21T20:04:22Z")

</div>

Thank you! As always it's useful to understand different perspectives. I think I've wrapped my head around it with your help.

> The _value_ of this property will not be saved with the view

1. current implementation (i'd call it "brutalist", but I'm no dev, so please don't take offense)

2. alternative (literal?) interpretation

3. user-friendly (but not literally correct/not as flexible).

* * *

I'd agree/argue sure #1 is _technically_ correct as implemented ("don't save" = _effectively_ delete _if generating JSON from scratch_), but it's not great from UX perspective because the property _disappears_ (albeit _temporarily_ only for bound properties). Documentation doesn't mention "bound-only", nor does designer restrict action to bound properties, **thus the dilemma we find ourselves in.**

I'd also agree with/argue that my/our _desired_ (and a useful) use case (and the documentation) is more or less aligned to options 2 or 3, while avoiding surprise deletions altogether:

> to ensure that _values_ ~~_generated by bindings_ that execute~~ in the Designer don’t get saved into the view

Though I/we may now more properly understand the underlying cause, the issue remains:

- "persistent" documentation/designer pop-up description doesn't match behavior/implementation (or bound-only intent)
  - effectively deletes unbound instances
  - hides (deletes) bound instances temporarily before recreating thanks to binding info (JSON "propConfig"?) of bind-referenced property

---

<div class="post-metadata">

**Author:** ![peter.dolberg](https://avatars.discourse-cdn.com/v4/letter/p/d9b06d/32.png) [@peter.dolberg](https://forum.inductiveautomation.com/u/peter.dolberg)\
**Post date:** [May 28, 2020, 7:01pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/16 "2020-05-28T19:01:14Z")

</div>

I was bitten by this misunderstanding of persistent properties too. As was pointed out by @hunterdg neither the designer tooltip nor the documentation make it clear how persistent properties behave, nor how they are intended to be used.

Can the designer tooltip and documentation be updated to make this clearer?

> You might use a binding to an expression that generates a static value for this in the meantime.

It seems like a reasonable approach. I tested a binding like this:

```auto
if({session.props.device.type}='designer', 'testValue', 'realValue')

```

This had the desired effect for a property. The binding approach works with properties, but does not work with parameters. Attempting to set a binding on a parameter triggers the error "Cannot configure bindings on input parameters."

Are there any other workarounds for having designer-only test values for parameters? If not we will have to set a parameter value for testing, then change it before saving. That can be tough when there are several parameters.

---

<div class="post-metadata">

**Author:** ![hunterdg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hunterdg/32/67774_2.png) [@hunterdg](https://forum.inductiveautomation.com/u/hunterdg)\
**Post date:** [May 29, 2020, 1:49am UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/17 "2020-05-29T01:49:32Z")

</div>

I too assumed the ‘persistent’ property would be most useful when applied to view **parameters** , however I believe the _intent_ is to toggle off the ‘persistent’ preference on the **properties** that _reference_ your view parameters, though I’ve only arrived at this realization as a result of this conversation. This presumably allows **saving** _test_ view parameter values to the project, while being sure to ignore them at runtime, as the ‘bound’ property _value_ literally doesn’t exist in the JSON.

For what it’s worth, only _input_ parameters are unable to be bound. As a workaround, you can change parameters to read/write (input/output) by clicking the arrow to the right of the parameter. This will allow static expression bindings as @Carl.Gould mentions to be attached and thus they will no longer be subject to the permanent deletion by the ‘persistent’ preference implementation as it exists today (_values_ won’t be saved, but the binding expression will).

I’d suggest this is most definitely only a workaround, and could potentially cause problems if a now read/write parameter that _should_ be input/read-only were somehow/accidentally exposed in a writable component.

It does seem to make intuitive sense (to me anyway) that _input_ view **parameters** , while not able to be bound, should have a method of _saving_ a default or `null` value (or modifying _value_ persistence), thus allowing us to modify them at will in the designer (for test purposes) without having to revert them or worry that the test values might get saved to the view. This seems more initially accessible than finding/changing the ‘persistent’ preference on all the **properties** that _reference_ the view params (_multiple_ bound properties reference _single_ view parameters in my world). This was the root of my misunderstanding.

Here’s a thought - perhaps _all_ **bound** properties should be non-persistent _by default_ and input/in-out view parameters should always be persistent? This would negate the issue of having to worry about view param initial values and force designers to plan for "default’ initial conditions if they _don’t_ want errors in cases where bindings fail, as opposed to designing to _avoid_ seeing test/initial values when bindings fail? Of course this would break existing installs that rely on seeing initial values in error conditions.

---

<div class="post-metadata">

**Author:** ![gdube](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gdube/32/41701_2.png) [@gdube](https://forum.inductiveautomation.com/u/gdube)\
**Post date:** [January 16, 2025, 8:25pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/18 "2025-01-16T20:25:04Z")

</div>

Any changes planned for this from Inductive? As I understand it, it's only meant for properties with bindings.

But it could be useful to reset a property to its empty/zero value, such as:

- Array: `[]`
- Object: `{}`
- String: `''`
- Numeric: `0`
- Boolean: `false`

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 16, 2025, 8:56pm UTC](https://forum.inductiveautomation.com/t/perspective-view-params-disappear/33414/19 "2025-01-16T20:56:27Z")

</div>

The empty value is `None` aka `null`. You should handle those with `coalesce()` where you need it, so there's no ambiguity.
