Hi,
I'm writing a QAction triggered by a write param. The write param has setter="true" so the read param should already be set when the QAction is triggered.
When using protocol.GetRow() I get the correct value (an object array where the new value is set) but when using a DMS object to get all rows of the table(IDMSTable.GetRows()) it returns the row with the old value. How do I get all rows of a table where the new value is set for the affected row?
Hi,
The protocol inner workings that are explained here can help to understand what is going on.
When the setter attribute is present then the value gets set from the write to the read parameter that is present in SLProtocol. The next step is to execute the QAction. At this point when the QAction is executed (see step 2 in the diagram), the data in the change buffer has not been forwarded yet to SLElement (happens in step 4). The protocol.GetRow() call is getting the data from SLProtocol, which does have the changes, while IDMSTable.GetRows() is a call that gets the data in the background from SLElement, which does not have the changes yet.
A possibility to have access to the values of the entire table in SLProtocol could be to include the table as input parameter, as explained here . Another possibility could be to work with the SLProtocolExt to access the table parameter.
If a parameter of the own element needs to be read out then the advice would be not to use the IDMSTable attribute. This is because this call gets passed to SLNet that needs to figure out where the element is located, then get the data from SLElement and send it back (kind of similar like going to internet to download a file that is located on your local disk). If one of the above mentioned methods are used then it goes directly from SLProtocol to SLScripting, which means less performance cost. If there would be only interest of a few table columns then a limited set can also be requested as explained here
Regards,
Thank you Laurens for the explanation. Unfortunately, the QActionTable class, which is what SLProtocolExt returns doesn’t support LINQ operations: https://community.dataminer.services/question/does-qactiontable-support-linq
Edit: Nevermind. The QActionTable.Keys-property returns a string[] which can be used with LINQ, not optimal but good enough.
In addition, DMS objects serve as wrappers for SLNet calls, where the call is forwarded to the SLNet process to obtain table information. SLNet facilitates communication between DMAs or elements. However, since the required table already exists in the protocol, there is no necessity for this. As Laurens suggested, a more suitable option would be to utilize SLProtocolExt.