Override Ticker background colour based on Spreadsheet data

Posts: 62
Hi all,

I have another question related to my Schedule.csv that I'm using in my theme. The schedule.csv links to a Ticker Widget and the Sub Widget template is for a row of each race week.


Schedule.csv is simple:


WEEK# TRACK SERIES CAR
1 <Track 1> <Series 1> <Car1>
2 <Track 2> <Series 2> <Car2>
3 <Track 3> <Series 3> <Car3>
...


What I would like to automate is having the row for the current week when displayed in the Ticker have a different background colour, driven by a value in the spreadsheet. So, I'd like to modify schedule.csv so it looks like:


WEEK# TRACK SERIES CAR CURRENT WEEK
1 <Track 1> <Series 1> <Car1>
2 <Track 2> <Series 2> <Car2> YES
3 <Track 3> <Series 3> <Car3>

And for the override background colour for the Sub Widget of the Ticker template to use the logic "if value of Current Week = 'Yes', then use Override background colour of #434343FF.

.. but I'm not a developer, so while I know the logic of what I want to build, I'm not fluent in scripting language to define it.

Any assistance greatly appreciated :)

Thanks!

-Jeremy



Posts: 785
This is pretty simple to achieve with OverrideBackground property. There are basically two options. I assume you use your schedule spreadsheet as the Data Set for the Widget.

Bind the OverrideBackground of the SubWidget that you use as a ticker template to the "Current" column of the spreadsheet. Then use the following script as converter to convert the "YES" case to a color, and any other case to a transparent color (or whatever color you want):
using System;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using System.Windows.Media;

namespace Scripts
{
public class ScheduleBackground : IScript
{
private Color CurrentColor = (Color) ColorConverter.ConvertFromString("#434343FF");
private Color NotCurrentColor = Colors.Transparent;

public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
if (value != null)
{
if (value.ToString() == "YES")
return CurrentColor;
}
return NotCurrentColor;
}
}
}
Posts: 62
Thanks so much Nick! I got it working!

-Jeremy