# Issue storing component property array value in SQL database, retrieving and restoring as property value

**URL:** <https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130>\
**Category:** Ignition\
**Created:** [May 27, 2022, 4:04pm UTC](https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130 "2022-05-27T16:04:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aaron\_Kneeland](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Aaron\_Kneeland](https://forum.inductiveautomation.com/u/Aaron_Kneeland)\
**Post date:** [May 27, 2022, 4:04pm UTC](https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130/1 "2022-05-27T16:04:35Z")

</div>

I am testing out the Dashboard seen in the sample quick start project and the dashboard has a property named ‘widgets’ that temporarily stores the users preferences for their dashboard. I am trying to store the value of the ‘widgets’ property to a database table with username, widgetValue columns so that their preferences can be saved beyond the session. The problem is that when I query for the array it is formatting as a string, not an array.

Here is the value being stored in the database and being retrieved as a string. Is there some trick to transforming this string to an actual array?  
[ {  
“isConfigurable”: false,  
“name”: “Gauge”,  
“header”: {  
“style”: {  
“classes”: “”  
},  
“title”: “Gauge”,  
“enabled”: true  
},  
“minSize”: {  
“columnSpan”: 2,  
“rowSpan”: 3  
},  
“style”: {  
“classes”: “”  
},  
“position”: {  
“columnEnd”: 3,  
“columnStart”: 1,  
“rowStart”: 1,  
“rowEnd”: 4  
},  
“viewParams”: {  
“tagPath”: “[Sample\_Tags]Ramp/Ramp1”  
},  
“body”: {  
“style”: {  
“classes”: “”  
}  
},  
“viewPath”: “framework/widgets/gauge”  
},  
{  
“isConfigurable”: false,  
“name”: “LED”,  
“header”: {  
“style”: {  
“classes”: “”  
},  
“title”: “LED”,  
“enabled”: true  
},  
“minSize”: {  
“columnSpan”: 1,  
“rowSpan”: 1  
},  
“style”: {  
“classes”: “”  
},  
“position”: {  
“columnEnd”: 6,  
“columnStart”: 4,  
“rowStart”: 1,  
“rowEnd”: 3  
},  
“viewParams”: {  
“tagPath”: “[Sample\_Tags]Ramp/Ramp2”  
},  
“body”: {  
“style”: {  
“classes”: “”  
}  
},  
“viewPath”: “framework/widgets/led”  
}]

Here is the component property

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

Here is the widgets property value stored in a db and queried back as a custom property, notice its a string

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/5/75883170fdf0103ff5bc0f9d26561093538fa8d2.png)

---

<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:** [May 27, 2022, 4:17pm UTC](https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130/2 "2022-05-27T16:17:55Z")

</div>

Add a transform that calls `system.util.jsonDecode`?

---

<div class="post-metadata">

**Author:** ![Aaron\_Kneeland](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Aaron\_Kneeland](https://forum.inductiveautomation.com/u/Aaron_Kneeland)\
**Post date:** [May 27, 2022, 6:29pm UTC](https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130/3 "2022-05-27T18:29:10Z")

</div>

This worked perfectly! I changed to use a scalar query and json decode transformation.

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0c252458af968fb838a346db86fb8ddf30b760bc.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:** [May 27, 2022, 6:39pm UTC](https://forum.inductiveautomation.com/t/issue-storing-component-property-array-value-in-sql-database-retrieving-and-restoring-as-property-value/60130/4 "2022-05-27T18:39:41Z")

</div>

Tip: shrink the windows to a size that shows the information of interest without acres of whitespace. _Then_ do the screengrab!
