EasyChart updating and rewrite datas in

Hello guys!

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

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!

The code:

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```

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.