Hello,
I am trying to implement my statistics provider following section "STATISTICS PROVIDERS" from this document: http://developer.dynamicweb.com/Files/Filer/Documentation/Development/eCommerce/(en-US)%20eCommerce%20Extensibility%20API,%20%20Dynamicweb%20eCommerce.pdf.
When I add rows to data table I get following error:
"Column '' does not belong to table MyTable." See Attached screenshot.
Following is code of my Statistics provider. If I remove lines that add DataRow to Data table in method CollectData it works without errors but chart is missing.
What am I doing wrong?
[AddInName("OrderTotalCountryStatisticsProvider"), AddInDescription("Order total + country filter"), AddInGroup("Orders"), AddInImage("tree/btn_currency.png")]
public class OrderTotalCountryStatisticsProvider : StatisticsProvider, IDropDownOptions
{
private DataTable _statDataTable = null;
[AddInParameter("CountryDropdown"), AddInParameterEditor(typeof(Dynamicweb.Extensibility.Editors.DropDownParameterEditor), "")]
public string CountryDropDown { get; set; }
public System.Collections.Hashtable GetOptions(string name)
{
Hashtable result = new Hashtable();
foreach (var country in Dynamicweb.eCommerce.Common.Application.Countries)
{
result.Add(country.Code2, country.CountryText.Name);
}
return result;
}
public override string XAxisColumn { get { return "Date"; } }
public override string YAxisColumn { get { return "Orders"; } }
public override DataTable Data
{
get
{
if ((_statDataTable == null))
{
_statDataTable = CollectData();
}
return _statDataTable;
}
}
private DataTable CollectData()
{
DataTable ret = new DataTable("MyTable");
ret.Columns.Add("Orders", typeof(int));
ret.Columns.Add("Date", typeof(string));
ret.Columns.Add("Country", typeof(string));
DataRow row = ret.NewRow();
row["Orders"] = 10;
row["Date"] = DateTime.Parse("7-8-2015").Date;
row["Country"] = "DE";
ret.Rows.Add(row);
return ret;
}
}
P. S.
The problem was in ColorColunm property - it is a required field to override. I overrided it and added Color column to DataTable. Now everything works