It may be necessary to update or modify an existing query. In order to do so you will need to know the unique QueryID for the query to be updated.
...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
//Include the analytics class and the configuration class
$t->runInteraction("Analytics.class.php");
$t->runInteraction("Config.class.php");
//Create our query object
$query = new Query(Config::$ANALYTICS_ANALYST);
//Read all saved queries
$res = $query->get();
//find the queryID for the query that you need to update
$queryId = "56de2fr0219b38e071aac27e";
//re-set variables as required
$name = "List all Events for given #event#";
$type = "find";
$params = array(
"name" => "#event#"
);
//save the query,
//remembering to pass in the QueryID to update a previously saved query
$response = $query->save($name, $type, $params, $queryId); |
Explanation:
//save the query, remembering to pass in the queryId for the query to update
$response = $query->save($name, $type, $params, $queryId);
...
Code Block | ||||
---|---|---|---|---|
| ||||
Array
(
[_id] => 56de2fr0219b38e071aac27e
[type] => find
[params] => null
[date] => 2016-03-15T04:03:52.998Z
[name] => List all Events for given #event#
) |
...