Hi All
When I do an API call in a protocol, everything is added to a table, which seems to get added to rather than remove old rows that are no longer needed and no longer in the API response.
How do I do it so that when we process the response to add the required row/columns for the most recent api call, the old ones that no longer exist get removed?
Thanks
Ryan
Hi Ryan,
If you have the entire content you wish to set in the table, in your QAction, you should be able to use something like FillArray method | DataMiner Docs with the option SaveOption.Full.
This should let you set every row and DataMiner will take care of determining which rows need to be added or updated or deleted.
As an FYI, I am adding each entry in the api response to a List<QActionTableRow>() in a foreach loop and then doing a FillArray when all are added

The FillArray method contains multiple overloads that can take different input arguments.
Depending on the type of input arguments you provide, different options will be available. In this case, if for instance, you provide a List of object[] for the second argument, you will be calling the FillArray method with rows and the SaveOption should be available as the third argument.
If you call it with just object[], DataMiner will consider that as columns, and the SaveOption won't appear.
In the case of the DateTime, that one is optional and only really needed if you want to use History Sets (see: https://docs.dataminer.services/develop/devguide/Connector/Howto/How_to_use_history_sets_on_a_protocol_parameter.html)

To answer your second comment, QActionTableRow object can easily be casted to object array and with that you can convert from a List<QActionTableRow> into a List<object[]> for the FillArray method.
If you are using SLProtocolExt and calling something like protocol.TableName.FillArray() then it should already be doing the equivalent to the SaveOption.Full
I am currently doing it:
protocol.tableid.FillArray(row list)
Hi Joao, thanks for this, i did look at this do you need to specify the datetime part of the method? As it doesn't seem to let me use SaveOption