Sign In Register

How can we help you today?

Start a new topic

Querying from code -> Not real results (null)

Hi, my name is Víctor and I'm having a problem querying in a dataType by code.


This is the code and it's supposed to give me all the data in QuestPlayer DataType...

Yesterday I inserted 3 new accounts on the game that means 3 instances on "QuestPlayer" Datatype.

When I look for them by ID they appear: https://gyazo.com/49b774ac14b81691c11f4fd9a4a2d054

But by code making queryItems they doesn't appear.


What should I do ? I know that if u insert an instance on a datatype and immediatly you try to query may not appear but this 3 accounts were inserted yesterday ( more than 12 hours ago ).

var resultsOBJ = API.queryItems("QuestPlayer",null);

    if(resultsOBJ.error()){
        Spark.setScriptError("ERROR", resultsOBJ.error());
    }else{
    
        //Get results
        var results = resultsOBJ.cursor();
        //Loop through cursor and update entries
        while(results.hasNext()){
            //do things
         }

 

1 Comment

Hi Victor,


Does your data type have any indexed fields? GDS requires at least one indexed fields before queryItems can be used, even if the query specified is null. You can read more about indexing your data types here - https://docs.gamesparks.com/documentation/configurator/game-data.html


Regards,

Vinnie

Login to post a comment