Hi Dojo,
I have a column with a read parameter which is controlled by a toggle button from a write parameter. When I click the toggle button the column value is switching (Enabled / Disabled). For the write parameter I have a QAction row trigger. When I click the button the trigger logs correctly the new value.
But when new data is pushed in the system and I want to sync the new/updated data to the table, I do not get the current data which is shown in the table, so I set it back to the old values. Is it not synced directly in the system or what could lead to this problem? It is not always a problem, sometimes some values are not switching back.
I am fetching the rows like this:
protocol.GetDms().GetElement(protocol.ElementName).GetTable(Parameter.TableName.tablePid).GetRows()
Thanks,
David
Hi,
There are two places where parameter values are stored in memory: SLProtocol and SLElement. SLProtocol is the main entry point for data and contains all parameter values (displayed and not displayed). From SLProtocol, the parameter values to be displayed are pushed to SLElement as SLElement is the process that is responsible to generate trending, alarming, and also display the parameter values.
-When calling protocol.GetDms().GetElement()... then this gets the parameter value from SLElement, so it is possible when a value is set in SLProtocol that this was not forwarded/processed yet to SLElement and the old value is still returned.
-When calling protocol.GetRow then this gets the parameter value from SLProtocol, so this gets the parameter value at the 'root' source.
If a QAction is executed to get parameter data of the same element then the advice would be to use the protocol.GetRow call as that call directly goes from SLScripting (QAction) to SLProtocol to get the parameter value. When Using protocol.GetDms().GetElement() then this needs to follow a larger detour to get to the parameter value as it also first needs to look up the element: SLScripting->SLNet->SLElement, with the risk of the parameter value not being updated yet.
Regards,
Hi Laurens,
thanks for the detailed explanation.
1 week ago I moved the new and old data sync to the last possible place and used the following line to get all rows:
var currentRows = protocol.MyTable.Keys.Select(protocol.MyTable.GetRow);
That helped to solve my issue. So i thought it would be both, later data sync and getting the rows from the protocol. But with your explanation it makes more sense, so now I will always retrieve the data from the protocol instead of the element.
Hi Laurens,
I have another but I think related question:
I described above that the user can toggle a value in a table. Sometimes it takes some time (10-40 seconds) until the value switched the value. Is that also because it needs to be synced into the system or why is that? I guess sometimes this leads also to the sync problem and that table cell values are set back to the old value…

That can have various root causes. E.g. if some other QAction is busy, then this needs to finish first before handling the next set value that is waiting on the queue to be executed, or there could be items pending on the queue that need to be processed first. If this is something that is send to a device then it could be that the device needs some time to process the value and polling it will still return the old value
When I fetch the rows from the table in the row triggered QAction, the value in this cell is also set to the old value. But the row I get directly from the protocol by
protocol.GetRow(Parameter.TableName.tablePid, rowKey)
is already set to the new value of the parameter which was updated by the toggle button.
So maybe the data is not synced to the table already? Is it possible to trigger the sync manually or fetch the current instead of the cached data?