protected Row DatatupleToRow(long dataTupleId, int rowIndex)
{
Row row = new Row();
row.RowIndex = Convert.ToUInt32(rowIndex);
DataTuple dataTuple = DatasetManager.DataTupleRepo.Query(d=>d.Id.Equals(dataTupleId)).FirstOrDefault();
dataTuple.Materialize();
int columnIndex = 0;
columnIndex += offset;
// need to add this empty cell to add cells to the right place
row.AppendChild(GetEmptyCell(rowIndex, 0));
foreach (VariableIdentifier variableIdentifier in VariableIdentifiers)
{
VariableValue variableValue = dataTuple.VariableValues.Where(p => p.VariableId.Equals(variableIdentifier.id)).First();
Cell cell = VariableValueToCell(variableValue, rowIndex, columnIndex);
row.AppendChild(cell);
}
return row;
}