# Dynamic custom property selection, how to go about it?

**URL:** <https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 6, 2024, 2:23am UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508 "2024-12-06T02:23:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 2:23am UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/1 "2024-12-06T02:23:05Z")

</div>

I have a custom prop object with about 20 bound tags, incoming to the view. There is a table displaying basically what those tags are that can be updated with a new value. When I click or tap on a table row, I would like to get the value from the custom prop and send it to a numeric input field where I can change it. The setup is like this: each value in the custom prop object is numbered `G1` through `G26`. The row number in the table will correspond to the custom property number, 1 - 26. So I'm thinking I should build the custom prop string via script in the `onRowClick` event, but I'm not sure how to turn the string back into a object reference like `{string}`.

this is the data object JSON:

```python
{
  "G27": "value",
  "G28": "value",
  "G7": 85,
  "G9": 77,
  "G13": 626.4,
  "G8": 96,
  "G26": true,
  "G19": 79,
  "G2": 100,
  "G1": 7.9999995,
  "G21": 23,
  "G5": 66,
  "G23": 43,
  "G3": 1.5000001,
  "G12": 11,
  "G6": 6.000001,
  "G10": 97,
  "G11": 13,
  "G24": 95,
  "G20": 90,
  "G25": 17.699999,
  "G16": 70,
  "G4": 17.499994,
  "G22": 40,
  "G18": 91,
  "G17": 14.999996,
  "G15": 8,
  "G14": 80
}
path to the object: `root.custom.temp_data`

```

Here is a screen shot:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/3/635a1e14f97dd9e85c98c5aab51dbe0ace9de579.png)

Is it possible to build a string for each path to `G#`, like `var = 'root.custom.temp_data.G' & rowNumber`?  
Then turn that into the actual reference? Because, the numeric input box is bound to a custom prop, so I am hoping to set that equal to the above-mentioned property.

Or am I doing this all wrong?

I'm also going on maybe 4 hours sleep, crossing my fingers I explain the problem and ask the right questions, lol.

EDIT: I suppose I could get the value from the tag via a dynamic script call, but I already have the values pulled into embedded views so the user can compare the last/current value to the new value. **EDIT: I just realized the tag paths are not conducive to be dynamically constructed.**

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0d77fb61602b4818553f7a27e72b4d9805d2724b.png)

And Here is my edit section:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8fba926ceb3de331b8e2bb388f7a3bf183255609.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 6, 2024, 1:08pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/2 "2024-12-06T13:08:50Z")

</div>

In this example, the `temp_data` property will behave exactly like a python dictionary. So your scripts would access the appropriate keys just as you would any other dictionary.

Use the property selector to get the appropriate path to your custom prop.

```python
temp_Data = self.custom.temp_data
gNum = 'G{}'.format(rowNumber)
#to read data
value = temp_Data[gNum]

#to write data
temp_Data[gNum] = value

```

---

<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:** [December 6, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/3 "2024-12-06T15:08:18Z")

</div>

Aaaargh!

 ![Table alignment](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/898f6485d72698e820029a3b4390b69dda241e13.png)

Right justify the numbers!  
Left justify the units!  
If one of the psi values has decimals then format all the psi readings with decimals so the decimal points line up!

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 5:31pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/4 "2024-12-06T17:31:12Z")

</div>

The numbers and units are one string, via concat expression.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 5:59pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/5 "2024-12-06T17:59:36Z")

</div>

I knew it was something simple. Thank you!

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 9:25pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/6 "2024-12-06T21:25:14Z")

</div>

So `self.custom.temp_data` is passed **by reference** to the `temp_Data`? When I write is back, as you suggested, the original value changes.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 6, 2024, 9:31pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/7 "2024-12-06T21:31:30Z")

</div>

Essentially yes. If you want a copy, you have to explicitly make that copy yourself.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 10:21pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/8 "2024-12-06T22:21:48Z")

</div>

I added extra decimal places, text align right, and 2em padding on the right.  
The display component is an embedded markdown with some html to provide the bold text. I tried adding spaces, but I think I need to use markup or html to make the spaces show.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/5/1505a899cdd20d70efb40c3d1152e2e97e69ce2f.png)

---

<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:** [December 6, 2024, 10:54pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/9 "2024-12-06T22:54:57Z")

</div>

I'm guessing that you're using a table with one column rendered as a view and that view has a markdown component. If so, then the alternative is,

- Create a view with two parameters, `value` and `engUnit`.
- Add two labels to the view and bind these to the view parameters.
- Use style classes rather than direct formatting on the labels. It will enable you to be consistent across the project and make style changes easy.
- Use the new view as the rendered view in the table column.

You can't use spaces or padding to align stuff when using variable width fonts.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [December 6, 2024, 11:14pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/10 "2024-12-06T23:14:38Z")

</div>

> [@Transistor](#):
>
> using a table

Actually it's just a label in the embedded view, with a few parameters. So, each value you see is a label in an embedded view:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/1/910ceb272d4966a8138b76e1bcd6f754009f8baa.png)

Now that you mention a table, perhaps that would be a better option - for performance and efficiency.

---

<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:** [December 6, 2024, 11:22pm UTC](https://forum.inductiveautomation.com/t/dynamic-custom-property-selection-how-to-go-about-it/99508/11 "2024-12-06T23:22:27Z")

</div>

... And then you can use separate columns for the values and labels.
