Sign In Register

How can we help you today?

Start a new topic

queryItems and gs-query

 Hi,


I'm making an admin screen to manage a custom data type and I would like to use the gs-query controller (or another similar controller) to be able to search in my game data just like in the Data Explorer but I can't figure how to use the result of the gs-query controller into the queryItems(...) call, results I get are always empty.

Code sample:

var API = Spark.getGameDataService();
var sort = null; // not relevant for this example
var query = scriptData.query;
//var query = scriptData["query-raw']; // this is another unsuccessful test I did
API.queryItems("CustomDataType", query, sort);

 

Here is an example of the scriptData content I get at the time of the execution of the code above:

{
    "query":{
        "$and":[
            {
                "ActivationCount":5
            },
            {
                "MaxActivation":{
                    "$ne":2
                }
            }
        ]
    },
    "query-raw":{
        "condition":"AND",
        "rules":[
            {
                "id":"ActivationCount",
                "field":"ActivationCount",
                "type":"integer",
                "input":"number",
                "operator":"equal",
                "value":5
            },
            {
                "id":"MaxActivation",
                "field":"MaxActivation",
                "type":"integer",
                "input":"number",
                "operator":"not_equal",
                "value":2
            }
        ],
        "valid":true
    }
}

 

Regards

Login to post a comment