Is it possible to create a button to reset the table data that is recorded until that moment, and start picking up new data from the time I press the button? In other words, I have a table recording 1 hour of realtime data, I want to press a button so that everything from that hour gets erased and it starts to record data from that moment. Could someone help me, please?
Could you evolve the code a little more? I tried to use what you told, but I couldnât make it work. So I tried this:
table = event.source.parent.getComponent(âTableâ)
header = [ât_stampâ,âPIDT1â,âPIDT2â,âPIT1â,âPIT2â,âZIT1â,âZIT2â]
row = []
data = system.dataset.toDataSet(header,row)
table.data = data
and everything that happens is that the table erases everything, itâs just a blank table, except the headers. It stays erased for about 1 second, and then the table reappears with all old rows values. I needed something like⌠set all the rows values to 0, for example⌠in order to get the new realtime values. Could you help me?
If the data is coming from a binding (DB query, presumably), then you need a script that will modify the data at the source (the DB) or change the parameters of the SQL query. Youâll have to show us the binding you currently have.
Or maybe if itâs less complex, I could use a 2 state toggle to set when I want the table to write data or not. For example, I press the button to âONâ state, at 2pm, and it records until I press the button again, at 3 pm. Then, I press it again at 8 pm. The table just shows data from 2 to 3 pm then from 8 pm to something. Is this easier for you to help?
Well, the historian doesnât have any script support for deleting history, so youâll have to do it with a post-filter. I would move the history binding to a custom property (rawData, perhaps) and add a Date as another custom property (startDate, perhaps), then bind the table data with a filter on startDate. Iâd use the view() function from Simulation Aids, though it could be done with a propertyChange event instead. Something like this (expression binding on data):
view("Select * Where t_stamp >= args[0]",
{Root Container.Table.rawData},
{Root Container.Table.startDate})
Then have your buttonâs script assign the current timestamp to startDate to hide past data.
Also, I donât think the old version of the module youâve chosen to use allows the asterisk (column wildcard). Youâll probably have to spell out all of your column names.
What did you put in the startDate property? No data after that will show up â thatâs the whole point. Set it to more than an hour ago and youâll get your previous data. Set it to ânowâ (via button script) and the data will disappear, then recent data will appear as time passes.
rawData needs your Tag History binding as shown in your 3rd comment, and as I already stated in my 2nd and 3rd comments. What was originally bound to data. The view() method will take that dataset and filter it to exclude rows older than startDate.
hey hi
can u help me in 1 script . where i have a table in ignition from mysql and adding the rows from ignition from translational list and after adding the rows in table becomes zero.? is this possible
i want a help a from u guys.
actually i hava a table in ignition from mysql DB wwithout any rows and i wanted to add the rows in database from table only. ex im able to add value in table after tapping the add button all data should push it the mysql database after that rows in the ignition table becomes zero.