# How to Reuse Parameters and Custom Properties

**URL:** <https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 20, 2024, 12:46am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847 "2024-08-20T00:46:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [August 20, 2024, 12:46am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/1 "2024-08-20T00:46:35Z")

</div>

Hi Forum,

I have multiple views that use the same parameters and custom properties expressions/scripts, like so:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/8/58be0656752c690b7e2e08b8fc82960c4e415997.png)

How do I reuse this, such that if I have multiple views, that use exactly the same,  
I do not have to rewrite them?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 20, 2024, 1:31am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/2 "2024-08-20T01:31:02Z")

</div>

Use `session.custom` instead.

---

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [August 20, 2024, 2:07am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/3 "2024-08-20T02:07:18Z")

</div>

Oh That....  
hmmm... I was there.

On the early phase of this tool, I decided to make this feature to be localized on the page level. So that when user needs to investigate, they can open multiple tab in browser use this tool independently.

---

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [August 20, 2024, 2:18am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/4 "2024-08-20T02:18:37Z")

</div>

I don't know, probably I could use an empty view with two parameter objects named input and output.. Embed and Hide this on the view it going to be used.

Looks awkward.. I wonder if it would run..

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 20, 2024, 2:59am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/5 "2024-08-20T02:59:23Z")

</div>

`page.props.pageId` appears to be unique in each browser tab or window. It returns an 8-character hex code.

You could try creating a `session.custom.pages` dictionary of the form,

```python
{
  "P123cc4f3": {
    "xPlusY": 5,
    "xTimeY": 6
  },
  "Pa9472c": {
    "xPlusY": 7,
    "xTimeY": 3
  }
}

```

Every time the page is loaded add a dictionary element made of the `page.props.pageId`. I've added a leading 'P' in case there's a problem with an object key starting with a number. (I suspect that Ignition 8.1 will take it but you'll have a red warning on the `session.custom` props.)

I haven't thought this through but I think it should all disappear when the last page for that application is closed.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [August 20, 2024, 6:45am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/6 "2024-08-20T06:45:40Z")

</div>

So what you're asking is, how to make some set of variables common to multiple views ?  
That depends on the scope. Should it be session wide, page wide, gateway wide... ?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 20, 2024, 8:36am UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/7 "2024-08-20T08:36:40Z")

</div>

It's, "How to make some set of variables common to multiple views within the one browser tab / window." (Simple session variable bindings would affect all open tabs / windows for the same Ignition application.)

---

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [August 20, 2024, 12:44pm UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/8 "2024-08-20T12:44:39Z")

</div>

Hope below illustration explains what I am trying to do:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/b/2b4c0d5d8553aa58f83c7ff16aa4ae4d5becab1f.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/3/d3dac407f2542b32a9986a7a4d207c0217acc2ab.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/73b63d5d40f295aa156b567f4dc749198e5d60ac.png)

Basicly, I have a set of input params, (e.g. a parent tagPath) and set of custom properties ( driven by the input params) on one view (tile template)

Instead of a tile I wanted to make table format this time.  
I created another view (same input params, same custom properties)

Oh, I wanted to show it into Carousel View.  
Re-iterate same input params, same custom properties)

Oh, I need to change the formula of binding. Now I went to edit the 3 views, now is a mess.

I'd like to think of it as an SFC block, that I can use on views.  
I actually did it, using an empty view as my original. And embed this view to other view.

I ended up, wiring input params to embed views input, using multiple "On change script" on embed views output to write data to the current views Custom Properties. idk if this is efficient.

---

<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:** [August 20, 2024, 1:03pm UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/9 "2024-08-20T13:03:34Z")

</div>

This problem (page-wide persistence, but not session-wide) was part of the motivation for the [pageVarMap()](https://www.automation-pros.com/toolkit/doc/scripting.html#pagevarmap) function in my Integration Toolkit.

The catch is that **writes** to content must be scripted. But all views in a page that bind to `pageVarMap()` will get the same dictionary (aka mapping object).

---

<div class="post-metadata">

**Author:** ![Eugene49](https://avatars.discourse-cdn.com/v4/letter/e/c6cbf5/32.png) [@Eugene49](https://forum.inductiveautomation.com/u/Eugene49)\
**Post date:** [August 20, 2024, 1:12pm UTC](https://forum.inductiveautomation.com/t/how-to-reuse-parameters-and-custom-properties/94847/10 "2024-08-20T13:12:42Z")

</div>

What I did:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/c/2c630bfe3b865d37fcce4388da187add3e3761fb.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/2/b28b3c2f21f13b521a5e4b7a79e76c3d1e3c63e4.png)

> [@pturmel](#):
>
> This problem (page-wide persistence, but not session-wide) was part of the motivation for the [pageVarMap()](https://www.automation-pros.com/toolkit/doc/scripting.html#pagevarmap) function in my Integration Toolkit.

Finally, you showed up.. Finally would be able to investigate what pageVarMap really do.. I was lost on reading, what it is trying to do last time.
