# EasyChart updating and rewrite datas in

**URL:** <https://forum.inductiveautomation.com/t/easychart-updating-and-rewrite-datas-in/101215>\
**Category:** Ignition\
**Tags:** scripting, designer\
**Created:** [January 22, 2025, 8:43am UTC](https://forum.inductiveautomation.com/t/easychart-updating-and-rewrite-datas-in/101215 "2025-01-22T08:43:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Vasvari](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@Daniel\_Vasvari](https://forum.inductiveautomation.com/u/Daniel_Vasvari)\
**Post date:** [January 22, 2025, 8:43am UTC](https://forum.inductiveautomation.com/t/easychart-updating-and-rewrite-datas-in/101215/1 "2025-01-22T08:43:52Z")

</div>

Hello guys!

I am pretty new at Ignition. I am working with an Easy Chart component in Ignition Designer and i need some help.

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

My goal is to dynamically modify its "pens" property. Specifically, I want to ensure that only one row (Cicle Time, the purple ones) can be checked at a time. When a row is checked (`row[7] == "True"`), its `user_writable` property (row[20]) should be set to `True`, while all other rows should have `user_writable` set to `False`. If it false, it is unseeable.

**Problem:**  
I am using the condition `if event.propertyName == 'pens'` to detect changes to the "pens" property. However, updating the "pens" dataset within the script triggers the same property change event again, resulting in an infinite loop. I need to avoid this loop while ensuring the updated dataset is properly written back to the Easy Chart.

**Goal:**

1. Identify the checked row (`row[7] == "True"`) and its index.
2. Set the `user_writable` property (row[20]) of the identified row to `True`, and all other rows to `False`.
3. Update the "pens" property while preventing an infinite loop caused by recursive event triggering.

Thank you!

---

<div class="post-metadata">

**Author:** ![Daniel\_Vasvari](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@Daniel\_Vasvari](https://forum.inductiveautomation.com/u/Daniel_Vasvari)\
**Post date:** [January 22, 2025, 8:44am UTC](https://forum.inductiveautomation.com/t/easychart-updating-and-rewrite-datas-in/101215/2 "2025-01-22T08:44:57Z")

</div>

The code:

````python
if event.propertyName == 'pens':
	# Adatok kiolvasása
	data = system.dataset.toPyDataSet(event.source.pens)
	headers = list(data.getUnderlyingDataset().getColumnNames())
	rows = []

	# Eltároljuk az indexet, ahol a pipa van
	trueid = None
	for index, row in enumerate(data):  
		if row[7]: # Feltételezzük, hogy row[7] Boolean
			trueid = index
			break # Csak az első pipát nézzük

	# Ellenőrizzük a feltételeket, és frissítjük az adatokat
	for index, row in enumerate(data):
		row_list = list(row) # Sor konvertálása listává
		if index == trueid: # Ha ez az a sor, ahol van pipa
			row_list[20] = True # User által módosítható
		else: # Minden más esetben
			row_list[20] = False # Tiltjuk a pipálást
		rows.append(row_list) # Új adat hozzáadása

	# Frissített DataSet visszaírása
	updated_dataset = system.dataset.toDataSet(headers, rows)
	event.source.pens = updated_dataset # Ez a végén történik, elkerülve a végtelen ciklust```
````

---

<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 22, 2025, 1:05pm UTC](https://forum.inductiveautomation.com/t/easychart-updating-and-rewrite-datas-in/101215/3 "2025-01-22T13:05:42Z")

</div>

The simplest solution is to **not write back** to the property if it needed no changes. That is, as you loop through making adjustments, track what changes you are making. If no changes, skip your last two lines.
