Retriving Data

Describes how to retrieve loaded data

Get input data table

You can get a data table loaded through the InputManager and retrieve the rows of data contained in the table. The code example below imports a data table corresponding to a data file named SampleData and retrieves the data.

InputTable sampleData = InputManager.Instance.GetInput("SampleData");
foreach (SampleData data in sampleData.Rows()) 
{
    int col1 = data.COL_1;
    int col2 = data.COL_2;
}

Retrieve data by key

The user can retrieve the desired data by the key defined in the input data schema. The FindRows method of the InputTable object allows you to retrieve all data with a specific Key. The first parameter of the FindRows method refers to the Key in the KeyMappings.

See the code example below for more details.

  • Example 1: Retrieve data with value [3] for ["COL_1"] through KeyMappings 1 with ["COL_1"] as Key defined in SampleData schema.

  • Example 2: Retrieve data where ["COL_1", "COL_2"] has value [1, 3] through KeyMappings 2 with ["COL_1", "COL_2"] as Key defined in SampleData schema.

InputTable sampleData = InputManager.Instance.GetInput("SampleData");

// Example 1
List<IInputRow> finds = sampleData.FindRows(1, 3);
// Example 2
List<IInputRow> finds2 = sampleData.FindRows(2, 1, 3);

Last updated