GetTableContent
public BackndReturnObject GetTableContent(string chartFileId);
Parameter
Value | Type | Description |
---|---|---|
chartFileId | string | DataTable file uuid/id |
[version1] : bro.GetReturnValuetoJSON()["rows"][i]["selectedDataTableFile"]["M"]["uuid"]["S"]
[version2] : bro.GetReturnValuetoJSON()["rows"][i]["selectedDataTableFileId"]["N"]
Description
Looks up Excel file data of the chart applied in the console.
When using OLD charts, you must call the GetDataTableList method before calling the GetTableContent method.
Example
Synchronous
Backnd.DataTable.GetTableContent("selectedDataTableFileId");
Asynchronous
Backnd.DataTable.GetTableContent("selectedDataTableFileId", (callback) =>
{
// Post-process
});
Return cases
Success cases
When the lookup is successful
statusCode : 200
returnValue : refer to GetReturnValuetoJSON
Error case
When the wrong uuid/id is entered
statusCode : 400
errorCode : BadParameterException
GetReturnValuetoJSON
{
rows:
[
{
num: { S: "1" }, // row num(number)
column1: { S: "contents1" },
column2: { S: "contents2" },
column3: { S: "contents3" }
},
{
num: [Object],
column1: [Object],
column2: [Object],
column3: [Object]
}
]
}
Sample code
This sample code is a class made using the BACKND sample chart.
For more information about sample charts, please refer to BACKND Console Guide - DataTable Management.
// This item was made using the BACKND sample chart provided by default.
// Please change the variables to match the column names in the chart you have uploaded.
public class DataTableItem
{
public string itemID;
public string itemName;
public string hpPower;
public string percent;
public override string ToString()
{
return $"itemID : {itemID}\n" +
$"itemName : {itemName}\n" +
$"hpPower : {hpPower}\n";
}
}
public void GetTableContentTest()
{
string selectedProbabilityFileId = "560";
var bro = Backnd.DataTable.GetTableContent(selectedProbabilityFileId);
if(!bro.IsSuccess())
{
Debug.LogError(bro.ToString());
return;
}
BACKND.LitJson.JsonData json = bro.FlattenRows();
List<DataTableItem> itemList = new List<DataTableItem>();
for(int i = 0; i < json.Count; i++)
{
DataTableItem item = new DataTableItem();
item.itemID = json[i]["itemID"].ToString();
item.itemName = json[i]["itemName"].ToString();
item.hpPower = json[i]["hpPower"].ToString();
itemList.Add(item);
}
foreach(var item in itemList)
{
Debug.Log(item.ToString());
}
Debug.Log("Total number of chart items : " + itemList.Count);
}