If you get the “Object must be of type String” (or Int, etc) while adding a custom field to a Pivot Grid in DevExpress then check to see if you are using CustomGroupIntervals. If you have a custom GroupInterval you must provide a GroupValue for EVERY case that your values might contain or else you will get this error.
private void grid_CustomGroupInterval(object sender, DevExpress.XtraPivotGrid.PivotCustomGroupIntervalEventArgs e)
{
if ( Convert.ToDecimal(e.Value) < 5)
{
e.GroupValue = “< 5%”;
}
else if (Convert.ToDecimal(e.Value) < 10)
{
e.GroupValue = “< 10%”;
}
else if (Convert.ToDecimal(e.Value) < 15)
{
e.GroupValue = “< 15%”;
}
else if (Convert.ToDecimal(e.Value) <= 20)
{
e.GroupValue = “<= 20%”;
}
else
{
e.GroupValue = “> 20%”;
}
}