This Post is a Part of Programming PeformancePoint 2010 Series.
public IKPI CreateNewDefaultKPI(string listURL,string kpiName,string description,LocationManagement.Location displayFolder)
{Kpi newKpi = Kpi.CreateNew();
newKpi.Name.Text = kpiName ;
newKpi.Description.Text = description;
// Set the DisplayFolderif (displayFolder != null)
{newKpi.Folder = displayFolder.Path;
}
// Fixed value actual newKpi.Actual.DataSourceLocation = new RepositoryLocation(Constants.FixedValuesDataSourceLocationKey); newKpi.Actual.ModelCurrent = 80; // this sets the value for the actual // Fixed value target Target target1 = new Target();target1.Guid = Guid.NewGuid();
target1.Name.Text = "Target";target1.DataSourceLocation = newKpi.Actual.DataSourceLocation;
target1.ModelCurrent = 100; // this sets the value for the targettarget1.IndicatorLocation =
BuiltinIndicators.GetIndicatorByCode(BuiltinIndicators.IndicatorCode.ShapesJagged3Small).Location;
target1.Pattern = KpiPattern.IncreasingIsBetter;
target1.RelatedActualId = newKpi.Actual.Guid;
// set up the banding; 3 bands: < .5; .5 - 1.0; > 1.0target1.Banding.ActualWorst = 0;
target1.Banding.Type = BandType.Normalized;
target1.Banding.SpreadMaximum = 1.2M;
target1.Banding.SpreadMinimum = 0;
target1.Banding.CustomBoundary.Add(.50M);
target1.Banding.CustomBoundary.Add(1M);
newKpi.Targets.Add(target1);
newKpi = PPSWebService.GetInstance().WebService.CreateKpi(listURL, newKpi);
return new KPI(newKpi);
}
Part of the Question I always get is how can I create a new Performance Point KPI, The Above function will help you through it.

No comments:
Post a Comment