Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.
Users reporting for no reason may be locked out.
Nick Thissen wrote:
IDriver inherits IEntity, so IDriver has the customer ID as well under the Id property.
using System;
using System.Data;
using System.Linq;
using ATVO.ThemesSDK;
using ATVO.ThemesSDK.Data.Results;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
namespace Scripts
{
public class fastlap : IScript
{
public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
ISessionResult fl = (ISessionResult) value;
int id = fl.FastestLapDriver.Id;
string name = "";
string team = "";
if (id != 0)
{
var sheet = item.Theme.Spreadsheets.Find("Drivers.csv");
foreach (var row in sheet.Table.Data.Rows.OfType<DataRow>())
{
int idcheck = Convert.ToInt32(row[0]);
if (idcheck == id)
{
name = row[2].ToString();
team = row[3].ToString();
}
}
}
string result = name + " - " + team;
return result;
}
}
}