Sign In Register

How can we help you today?

Start a new topic

Need some simple help with pulling data from Data Types

 I've been digging through the API and it seems heavily mismatched and I cannot find an answer to a seemingly simple question.

If i have a custom Data Type called posData, and that Data TYpe has let's say, 4 members: X, Y, Z, and W, all ints,

what do I have to do in Cloud Code to get the equivalent of :


SELECT * FROM posData


and then return that to myself on Unity. Simple SQL command but I cannot seem to get a straight answer on how to actually execute it with your system.


Would pay real money for help on this.




2 people have this question

Bump - this data can be static btw


1 person likes this

Well, for my project, aside from the necessary fields (in your case: X, Y, Z and W), I also have a field called Id. It is basically a automatic increment  number field (for example, 0, 1, 2, 3, 4...)


so in order to query all data type from the database, you can simply do:


var API = Spark.getGameDataService();

var query =  API.queryItems(type, API.N("Id").gt(-1), sortOrder);


then you can get all the documents you need from the database.

Also, i forgot you can actually send a null as condition to get all data from database.


Simply do this:

var API = Spark.getGameDataService();

var query =  API.queryItems(type, null, sortOrder);


Be aware there is a 100 items limit per query.



Login to post a comment