dpCancelSplitRequest()
If a query takes very long, use the function dpCancelSplitRequest in order to cancel the query function.
Synopsis
int dpCancelSplitRequest(int reqId);
Parameter
Parameter | Meaning |
---|---|
reqId | The request ID. The request ID must be set to 0 when calling the function for the first time. Thereafter the request ID is set by the function. |
Return Value
The function returns 0 if it was executed successfully and -1 in the event of an error.
Errors
Errors can be retrieved with getLastError() . This includes incorrect or missing arguments.
Description
If a query takes very long due to the queried amount of data, use the function dpCancelSplitRequest in order to cancel the query function. You can use the function, for example, if you scroll in a trend and the original query is not yet finished.
Example
The example gets the values of the data point(s) "ExampleDP_Arg*. of type ExampleDP_Float. via dpQuerySplit and interrupts the function via dpCancelSplitRequest.
main()
{
int reqId = 0;
int progress = 0;
int err = 0;
dyn_dyn_anytype tab;
int startPos = 2;
shape liste=getShape("SELECTION_LIST1");
while ((progress < 100) && !err)
{
err = dpQuerySplit(reqId, progress, "SELECT '_original.._value'
FROM 'ExampleDP_Arg*' WHERE _DPT= \"ExampleDP_Float\" ",
tab);
for(int i=startPos; i<=dynlen(tab); i++)
{
// dynlen(tab)returns the length of tab.
setValue(liste, "appendItem", tab[i][2]);
}
startPos = dynlen(tab) + 1;
//Queries approx.~1000 elements. Afterwards the function
dpCancelSplitRequest cancels the query.
if (dynlen(tab) > 1000)
{
dpCancelSplitRequest(reqId);
break;
}
}
}
Assignment
Data point function
Availability
CTRL, UI