Skip to main content
Version: 6.0.0

GetTableContentAndLocalSave

public BackndReturnObject GetTableContentAndLocalSave(string chartFileId);
public BackndReturnObject GetTableContentAndLocalSave(string chartFileId, string chartName);

Parameters

ValueTypeDescription
chartFileIdstringDataTable file uuid/id
chartNamestring(Optional) If the name of the chart file to be saved locally
is not specified, it is saved as chartFileId

Description

Calls and saves the chart registered in BACKND Console.
The chart is saved locally via BACKND's File System function.
A chart is data from the Excel file uploaded to and applied in the chart management section of BACKND Console.

Call and save a chart

Calls and saves the currently applied file from the chart created in BACKND Console.

  • Depending on the parameters entered, the chart ID or the chart name that has been specified separately is applied as the key.
  • The content of the currently applied chart file is saved as the value.
  • If there is no currently applied chart, it will not be saved.

Example

Synchronous

Backnd.DataTable.GetTableContentAndLocalSave("chartFileId");
Backnd.DataTable.GetTableContentAndLocalSave("chartFileId", "DataTable name");

Asynchronous

Backnd.DataTable.GetTableContentAndLocalSave("uuid", callback =>
{
// Post-process
});
Backnd.DataTable.GetTableContentAndLocalSave("uuid", "DataTable name", callback =>
{
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

Error cases

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 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 GetTableContentAndLocalSaveTest()
{
string selectedProbabilityFileId = "560";

var bro = Backnd.DataTable.GetTableContentAndLocalSave(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);
}