Skip to main content
Version: 5.18.17

GetOtherData

public BackendReturnObject GetOtherData(string tableName, string inDate, string owner_inDate);
public BackendReturnObject GetOtherData(string tableName, string inDate, string owner_inDate, string[] select);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, int limit);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, int limit, string firstKey);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, int limit, string firstKey, TableSortOrder tableSortOrder);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, string[] select);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, string[] select, int limit);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, string[] select, int limit, string firstKey);
public BackendReturnObject GetOtherData(string tableName, string owner_inDate, string[] select, int limit, string firstKey, TableSortOrder tableSortOrder);

Parameters​

ValueTypeDescriptionDefault
tableNamestringName of table to look up-
limitint(Optional) Number of game information rows to load. Minimum 1, maximum 100.10
inDatestringinDate value of the row to look up-
owner_inDatestringinDate of the user who owns the row-
selectstring[](Optional) Columns to include among existing columns in the rowIncludes all columns
firstKeystring(Optional) Starting point of data lookupData that was inserted last
sortOrderTableSortOrder(Optional) TableSortOrder.DESC(descending order) or TableSortOrder.ASC(ascending order)TableSortOrder.DESC(descending order)

Description​

Among the values saved in the table, the user's pieces of data identical to owner_inDate are loaded equal to the number of limits.

  • The data can be looked up regardless of schema definition status.
  • Both public and private data can be looked up.
  • If you enter another person's owner_inDate (Backend.UserInDate) in owner_inDate, the data of that person is loaded.
  • The throughput of the data is the same regardless of whether the select clause is used.

Example​

Synchronous​

// Obtain the user's owner_inDate by searching the user name
var userBro = Backend.Social.GetUserInfoByNickName("nickName");
string otherOwnerIndate = userBro.GetReturnValuetoJSON()["row"]["inDate"].ToString();

BackendReturnObject bro = null;

// Load up to 10 rows added by another person from tableName
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate);
// When loading fails
if(bro.IsSuccess() == false)
{
Debug.Log("An issue occurred while reading data : " + bro.ToString());
}
// When loading is successful but data does not exist
if(bro.IsSuccess() && bro.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
// When more than one piece of data is loaded
if(bro.FlattenRows().Count > 0)
{
string inDate = bro.FlattenRows()[0]["inDate"].ToString();
int level = int.Parse(bro.FlattenRows()[0]["level"].ToString());
}
// Load up to one row added by another person from tableName
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1);

// After the 'load up to one row added by another person' above is called, check if there are older pieces of data below to load additionally
if(bro.HasFirstKey() == false)
{
Debug.Log("The data to be loaded does not exist");
}

// If there is more data after the 'load up to one row added by another person' above is called, load the subsequent data
// (Data will be loaded from latest to oldest.)
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1, bro.FirstKeystring());

bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1, bro.FirstKeystring(), TableSortOrder.DESC);

// Only show columns included in selectList when loading data.
string[] selectList = new string[] { "intData", "doubleData" };

// Load up to 10 rows added by another person from tableName (Columns aside from those displayed in selectList will not be displayed.)
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList);

// Load one row added by another person from tableName (Columns aside from those displayed in selectList will not be displayed.)
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1);

// If there is more data after the 'load up to one row added by another person' above is called, load the subsequent data
// (Data will be loaded from latest to oldest.)
// (Columns aside from those displayed in selectList will not be displayed.)
bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1, bro.FirstKeystring());

bro = Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1, bro.FirstKeystring(), TableSortOrder.DESC);

// From the loaded values called above, load the data with a matching inDate
bro = Backend.PlayerData.GetOtherData(tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString());

// From the loaded values called above, load the data with a matching inDate (Columns aside from those displayed in selectList will not be displayed.)
bro = Backend.PlayerData.GetOtherData(tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString(), selectList);

Asynchronous​

// Obtain the user's owner_inDate by searching the user name
var userBro = Backend.Social.GetUserInfoByNickName("nickName");
string otherOwnerIndate = userBro.GetReturnValuetoJSON()["row"]["inDate"].ToString();

string[] selectList = new string[] { "intData", "doubleData" };

Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, callback =>
{
if(callback.IsSuccess() == false)
{
Debug.Log("An issue occurred while reading data : " + callback.ToString());
}
// When loading is successful but data does not exist
if(callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
// When more than one piece of data is loaded
if(callback.FlattenRows().Count > 0)
{
string inDate = callback.FlattenRows()[0]["inDate"].ToString();
int level = int.Parse(callback.FlattenRows()[0]["level"].ToString());
}
});

Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}

if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}
Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});
Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});


Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
});

Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}
if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}

Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});
Backend.PlayerData.GetOtherData(tableName, otherOwnerIndate, selectList, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});

// From the loaded values called above, load the data with a matching inDate
Backend.PlayerData.GetOtherData(tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString(), callback =>
{

});
// From the loaded values called above, load the data with a matching inDate (Columns aside from those displayed in selectList will not be displayed.)
Backend.PlayerData.GetOtherData(tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString(), selectList, callback =>
{

});

SendQueue​

// Obtain the user's owner_inDate by searching the user name
var userBro = Backend.Social.GetUserInfoByNickName("nickName");
string otherOwnerIndate = userBro.GetReturnValuetoJSON()["row"]["inDate"].ToString();

string[] selectList = new string[] { "intData", "doubleData" };

SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, callback =>
{
if(callback.IsSuccess() == false)
{
Debug.Log("An issue occurred while reading data : " + callback.ToString());
}
// When loading is successful but data does not exist
if(callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
// When more than one piece of data is loaded
if(callback.FlattenRows().Count > 0)
{
string inDate = callback.FlattenRows()[0]["inDate"].ToString();
int level = int.Parse(callback.FlattenRows()[0]["level"].ToString());
}
});

SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}

if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}
SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});
SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});


SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, selectList, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
}
});

SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, selectList, 1, callback =>
{
if (callback.IsSuccess() && callback.FlattenRows().Count <= 0)
{
Debug.Log("The data does not exist");
return;
}
if(callback.HasFirstKey() == false)
{
Debug.Log("The data to be read next does not exist");
return;
}

SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, selectList, 1, callback.FirstKeystring(), callback2 =>
{
// Handled with callback2
});
SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, otherOwnerInDate, selectList, 1, callback.FirstKeystring(), TableSortOrder.DESC, callback2 =>
{
// Handled with callback2
});
});

// From the loaded values called above, load the data with a matching inDate
SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString(), callback =>
{

});
// From the loaded values called above, load the data with a matching inDate (Columns aside from those displayed in selectList will not be displayed.)
SendQueue.Enqueue(Backend.PlayerData.GetOtherData, tableName, bro.FlattenRows()[0]["owner_inDate"].ToString(), bro.FlattenRows()[0]["inDate"].ToString(), selectList, callback =>
{

});

ReturnCase​

Success cases​

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

When the lookup succeeds but there is no row with the relevant inDate
statusCode : 200

returnValue : {"serverTime":"2023-10-29T13:46:51.305Z","rows":[],"ConsumedCapacity":{"Read":{"CapacityUnits":0.5}}}

Error cases​

When it is owner_inDate of a user that does not exist
statusCode : 400
errorCode : BadParameterException

When data is looked up in private table using another person's owner_inDate
statusCode : 400
errorCode : BadParameterException

When the inDate is string.Empty upon executing GetOtherData using inDate
statusCode : 400
errorCode : ClientException

When Get is attempted on a non-existent table
statusCode : 404
errorCode : NotFoundException

When an attempt is made to load to an inactive tableName
statusCode : 412
errorCode : PreconditionFailed

GetReturnValuetoJSON (Values within rows all differ depending on the data.)​

{
"serverTime": "2023-10-29T13:09:53.832Z",
"rows": [
{
"stringData": {
"S": "57J5EO3CJOGE"
},
"floatData": {
"N": "0.17887"
},
"dateTimeData": {
"S": "2023-10-29 13:09:53.401"
},
"boolData": {
"BOOL": true
},
"doubleData": {
"N": "0.139331"
},
"inDate": {
"S": "2023-10-29T13:09:53.543Z"
},
"updatedAt": {
"S": "2023-10-29T13:09:53.545Z"
},
"dicData": {
"M": {
"key1": {
"S": "JQZB3TY7LUNE"
},
"key2": {
"S": "QZOUGY1PVIR6"
},
"key3": {
"S": "EBCWMSVZKKOM"
}
}
},
"owner_inDate": {
"S": "2022-07-18T07:42:46.490Z"
},
"listData": {
"L": [
{
"S": "WJOLDW7Q1TXW"
},
{
"S": "15XFDY0PSJTF"
},
{
"S": "SWTBY0LTRBGB"
}
]
},
"intData": {
"N": "108684"
}
}
],
// Time to load next after loading has expired
"firstKey": {
"inDate": {
"S": "2023-10-29T13:09:53.543Z"
}
},
"ConsumedCapacity": {
"Read": {
"CapacityUnits": 0.5,
"GlobalSecondaryIndexes": {
"partition-inDate-index": {
"CapacityUnits": 0.5
}
}
}
}
}

Sample Code​

public class GameDataItem
{
public string nickName = Backend.UserNickName;
public string ownerIndate = Backend.UserInDate;
public string inDate;
public int hp;
public int mp;
public float atk;
public long money;
public Dictionary<string, string> equip = new Dictionary<string, string>();
public List<string> items = new List<string>();
public DateTime lastUpdate;

public GameDataItem()
{
}

public GameDataItem(LitJson.JsonData json)
{
hp = int.Parse(json["hp"].ToString());
mp = int.Parse(json["mp"].ToString());
atk = float.Parse(json["atk"].ToString());
money = long.Parse(json["money"].ToString());

foreach(var column in json["equip"].Keys)
{
equip.Add(column, json["equip"][column].ToString());
}

for(int i = 0; i < json["items"].Count; i++)
{
items.Add(json["items"][i].ToString());
}
inDate = json["inDate"].ToString();
lastUpdate = DateTime.Parse(json["lastUpdate"].ToString());
}

public Param ToParam()
{
Param param = new Param();

param.Add("nickName", nickName);
param.Add("hp", hp);
param.Add("mp", mp);
param.Add("atk", atk);
param.Add("money", money);
param.Add("equip", equip);
param.Add("items", items);
param.Add("lastUpdate", DateTime.UtcNow);

return param;
}
public override string ToString()
{
string equipString = "equip\n";
foreach(var dic in equip)
{
equipString += $"-{dic.Key} : {dic.Value}\n";
}

string itemString = "items : ";
for(int i = 0; i < items.Count; i++)
{
itemString += $"{items[i]}, ";
}

return $"hp : {hp}\n" +
$"mp : {mp}\n" +
$"atk : {atk}\n" +
$"money : {money}\n" +
$"lastUpdate : {lastUpdate}\n" +
equipString + "\n" + itemString + "\n";
}
}
public void GetInDate()
{
var userBro = Backend.Social.GetUserInfoByNickName("nickName");
string gamerIndate = userBro.GetReturnValuetoJSON()["row"]["inDate"].ToString();

var bro = Backend.PlayerData.GetOtherData("PlayerInfo", gamerIndate);

if(!bro.IsSuccess())
{
Debug.LogError(bro.ToString());
return;
}

LitJson.JsonData gameDataListJson = bro.FlattenRows();

if(gameDataListJson.Count <= 0)
{
Debug.Log("The data does not exist");
return;
}

GameDataItem gameDataItem = new GameDataItem(gameDataListJson[0]);
Debug.Log(gameDataItem.ToString());
}