How to update Table in MySQL Data base from Ignition?

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

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,

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

This section of the docs would be a good place to start.

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'}