# How to update Table in MySQL Data base from Ignition?

**URL:** <https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832>\
**Category:** General Discussion\
**Created:** [March 22, 2017, 3:02pm UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832 "2017-03-22T15:02:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![irshadhashim](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@irshadhashim](https://forum.inductiveautomation.com/u/irshadhashim)\
**Post date:** [March 22, 2017, 3:02pm UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832/1 "2017-03-22T15:02:16Z")

</div>

Hi All,

I am working on a Project with Ignition. I have few data reading from MySQL data base to a Table.  
Reading to the table and displaying is working fine.

I have 4 coloms in my Database table, StationID, Value, Status, and Date. My database table is as attached.

And now I wanted to change the value in colom Status to Active when the Value is 1 periodically.

It would be appreciable if anyone can help on this.

Looking forward for your support.

Best Regards,  
Irshad  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/dd8fdb3af21d41577acdf0cfa46eaa762b776f3f.JPG)

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [March 22, 2017, 3:20pm UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832/2 "2017-03-22T15:20:37Z")

</div>

Hi irshadhashim,

It is not clear enough what you are doing. I need more information.

How does the Value column change to 1? Couldn’t whatever mechanism that changes the Value column to 1 also change the Status column?

Thanks,

---

<div class="post-metadata">

**Author:** ![irshadhashim](https://avatars.discourse-cdn.com/v4/letter/i/9dc877/32.png) [@irshadhashim](https://forum.inductiveautomation.com/u/irshadhashim)\
**Post date:** [March 23, 2017, 6:15am UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832/3 "2017-03-23T06:15:19Z")

</div>

Hi,

The data in the table will be updated in 1 minute, more rows will be added in each minutes.  
Actually, this data is from an Alarm management software, if any Alarm is occurred in any Station, the software will update the data base table by adding new row on the table with StationID, Value(if alarm is High, then value will be 1; and when alarm reset, the value will be 0), Status(if alarm is High, then Status will be ON; and when alarm reset, the Status will be OFF), & Date(Time&date of alarm log).

Now my requirement is I wanted modify the Status colom, I want to change the status to Active instead of ON. We can conclude like this: When the Value is 1, I wanted to add Active in Status colom.

Hope you can understand my requirement.

Best regards,  
IrshadHashim

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [March 23, 2017, 1:40pm UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832/4 "2017-03-23T13:40:40Z")

</div>

[This section](https://docs.inductiveautomation.com:8443/display/DOC79/Edit+Data+in+Database) of the docs would be a good place to start.

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [March 23, 2017, 9:44pm UTC](https://forum.inductiveautomation.com/t/how-to-update-table-in-mysql-data-base-from-ignition/12832/5 "2017-03-23T21:44:02Z")

</div>

Given that you are only really manipulating the value in the status column, you could use a case statement to change “On” to “Active.” Something like this should work:

`SELECT 
	StationID,
	Value,
	IF(Status = 'On', 'Active', 'Off') AS Status,
	Date 
FROM
	FORUM_POST`

Another way this can be done is with a Power Table Extension Function. This would be done using scripting on the configureCell Extension Function, and would look like this:

`	if colName == 'Status':
		if value == 'On':
			return {'text':'Active'}`
