/// <summary>
/// Sets the value of the field at the given field index in the given row.
/// <remarks>
/// A new row is added if <paramref name="record"/> is <code>null</code>.
/// A new field is added if <paramref name="fieldIndex"/> is greater than or equal to <see cref="Fields"/> count.
/// </remarks>
/// </summary>
/// <param name="record">The record to be updated; may be null.</param>
/// <param name="fieldIndex">The index of the field to be updated.</param>
/// <param name="value">The value.</param>
public void SetValue(ref RecordsetRecord record, int fieldIndex, string value)
{
if (record == null)
{
record = NewRecord();
Records.Add(record);
}
var cell = new RecordsetCell
{
Name = record.Label + "." + Fields[fieldIndex].Alias,
Label = Fields[fieldIndex].Alias,
Value = value
};
if (fieldIndex >= record.Count)
{
record.Add(cell);
}
else
{
record[fieldIndex] = cell;
}
}