# Python Script - reading from query and writing to parameters

**URL:** <https://forum.inductiveautomation.com/t/python-script-reading-from-query-and-writing-to-parameters/100300>\
**Category:** Ignition\
**Tags:** database, vision, scripting\
**Created:** [December 30, 2024, 2:03pm UTC](https://forum.inductiveautomation.com/t/python-script-reading-from-query-and-writing-to-parameters/100300 "2024-12-30T14:03:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Brunner](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@Christopher\_Brunner](https://forum.inductiveautomation.com/u/Christopher_Brunner)\
**Post date:** [December 30, 2024, 2:03pm UTC](https://forum.inductiveautomation.com/t/python-script-reading-from-query-and-writing-to-parameters/100300/1 "2024-12-30T14:03:08Z")

</div>

Hello, Ignition 8.1  
I am trying to read recipe data from an SQL database and load it back into a custom property UDT structure. I have the read from database working, and I can write the individual values to the screen components, but I am missing how to write it to UDT custom properties.

```python
RecipeID = event.source.parent.getComponent('DropdownName').selectedValue

data = system.db.runNamedQuery("RecipeRead" , {"RecipeNumber":RecipeID})
#'event.source.parent.parent.RecipeParameters.Name',
#'event.source.parent.parent.RecipeParameters.Description',
#'event.source.parent.parent.RecipeParameters.LaminatorLineSpeed',
#'event.source.parent.parent.RecipeParameters.Note1',
#'event.source.parent.parent.RecipeParameters.Note2',
#'event.source.parent.parent.RecipeParameters.Note3',
	
	
#values = [row[col] for row in system.dataset.toPyDataSet(data) for col in row]
#system.tag.writeBlocking(tagPath,values)

values = system.dataset.toPyDataSet(data)
event.source.parent.getComponent('Description').text = values.getValueAt(0, 1)
#Recipe.RcpLaminator.getComponent('LaminatorLineSpeed').intValue = 
event.source.parent.getComponent('RcpNotes1').text = values.getValueAt(0, 3)
event.source.parent.parent.RecipeParameters.LaminatorLineSpeed = values.GetValue(0,2)

```

In my code you will see where I have figured out how to push the data to my text box values, number screen areas, etc. What I have not figured out is how to make the call to the value of the custom property - any suggestions?

---

<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:** [December 30, 2024, 2:11pm UTC](https://forum.inductiveautomation.com/t/python-script-reading-from-query-and-writing-to-parameters/100300/2 "2024-12-30T14:11:25Z")

</div>

Seems like a design flaw on your part. Custom tag properties are not intended to be changed at runtime--they are **configuration**. Use actual memory tags for such things. (And probably should not be using UDT data types as properties in Vision at all--there be dragons.)
