Skip to main content
Version: 5.9.6

GetOneChartAndSave

public BackendReturnObject GetOneChartAndSave(string chartFileId);
public BackendReturnObject GetOneChartAndSave(string chartFileId, string chartName);

Parameters

ValueTypeDescription
chartFileIdstringChart 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

Backend.Chart.GetOneChartAndSave("chartFileId");
Backend.Chart.GetOneChartAndSave("chartFileId", "Chart name");

Asynchronous

Backend.Chart.GetOneChartAndSave("uuid", callback =>
{
// Post-process
});
Backend.Chart.GetOneChartAndSave("uuid", "Chart name", callback =>
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Chart.GetOneChartAndSave,"uuid", callback =>
{
// Post-process
});
SendQueue.Enqueue(Backend.Chart.GetOneChartAndSave,"uuid", "Chart 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 ChartItem
{
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 GetOneChartAndSaveTest()
{
string selectedProbabilityFileId = "560";

var bro = Backend.Chart.GetOneChartAndSave(selectedProbabilityFileId);

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

LitJson.JsonData json = bro.FlattenRows();

List<ChartItem> itemList = new List<ChartItem>();

for(int i = 0; i < json.Count; i++)
{
ChartItem item = new ChartItem();

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);
}