/// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 protected BaseReportDefinition(DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
 {
     this.HierarchyFilter  = hierarchyFilter;
     this.Core             = core;
     this.IdHierarchies    = new List <Guid>();
     this.FilterCategories = new List <FilterCategoryOperator>();
 }
        public ReportDefinition(
            DatabaseCore.Core core,
            string fileName,
            string fileNameWorkflow,
            string fileNameWeighting,
            HierarchyFilter hierarchyFilter,
            string userDefaultSettings = null
            )
            : this(core, hierarchyFilter)
        {
            this.FileName = fileName;

            XmlNode xmlNodeWeighting = null;

            if (fileNameWeighting != null)
            {
                XmlDocument xmlDocumentWeighting = new XmlDocument();
                xmlDocumentWeighting.Load(fileNameWeighting);

                xmlNodeWeighting = xmlDocumentWeighting.DocumentElement;
            }

            // Create a new report definition xml file.
            Create(fileNameWorkflow, xmlNodeWeighting, userDefaultSettings);

            //this.Workflow.SelectAll();

            // Save the report definition.
            Save();
        }
        /// <summary>
        /// Creates a new instance of a report definition.
        /// </summary>
        /// <param name="core">The used database core.</param>
        public BaseReportDefinition(DatabaseCore.Core core, XmlDocument document, HierarchyFilter hierarchyFilter)
            : this(core, hierarchyFilter)
        {
            this.FileName = "";

            // Create a new xml document.
            this.XmlDocument = document;

            // Parse the report definition xml file.
            ParseBase();
        }
示例#4
0
        public LinkBiDefinitionSelector(string fileName, HierarchyFilter hierarchyFilter)
        {
            this.Definition = new LinkBiDefinition(
                base.Core,
                fileName,
                hierarchyFilter
                );

            this.UpToDate = this.Definition.IsUpToDate();

            this.Load += LinkBiDefinitionSelector_Load;
        }
        /// <summary>
        /// Creates a new instance of a report definition.
        /// </summary>
        /// <param name="core">The used database core.</param>
        /// <param name="fileName">The full path to the report definition xml file.</param>
        public BaseReportDefinition(DatabaseCore.Core core, string fileName, HierarchyFilter hierarchyFilter)
            : this(core, hierarchyFilter)
        {
            this.FileName = fileName;

            // Create a new xml document.
            this.XmlDocument = new XmlDocument();

            // Load the contents of the report definition
            // xml file into the xml document.
            this.XmlDocument.Load(this.FileName);

            // Parse the report definition xml file.
            ParseBase();
        }
        private void InitFilter(string source, DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
        {
            ReportDefinitionClasses.ReportDefinition definition = new ReportDefinitionClasses.ReportDefinition(
                core,
                source,
                hierarchyFilter
                );

            DataCore.Classes.ReportCalculator test = new ReportCalculator(
                definition,
                core,
                HttpContext.Current.Session
                );

            this.Filter = test.GetFilter();
        }
        public Workflow(
            DatabaseCore.Core core,
            string source,
            XmlNode xmlNode,
            string service,
            HierarchyFilter hierarchyFilter
            )
        {
            this.HierarchyFilter = hierarchyFilter;
            this.Source          = source;
            this.Editable        = false;
            this.Selections      = new Dictionary <string, WorkflowSelection>();
            this.Service         = service;
            this.Core            = core;

            this.XmlNode = xmlNode;

            // Set the on load event of the web control.
            this.Load += Workflow_Load;

            Parse();
        }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 public ReportDefinition(DatabaseCore.Core core, XmlDocument document, HierarchyFilter hierarchyFilter)
     : base(core, document, hierarchyFilter)
 {
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 /// <param name="fileName">The full path to the report definition xml file.</param>
 public ReportDefinition(DatabaseCore.Core core, string fileName, HierarchyFilter hierarchyFilter)
     : base(core, fileName, hierarchyFilter)
 {
 }
 /// <summary>
 /// Creates a new instance of a report definition.
 /// </summary>
 /// <param name="core">The used database core.</param>
 private ReportDefinition(DatabaseCore.Core core, HierarchyFilter hierarchyFilter)
     : base(core, hierarchyFilter)
 {
 }
        public override void Render(StringBuilder writer, HierarchyFilter hierarchyFilter)
        {
            string[] chartingColors = LoadChartingColors();
            int      i = 0;
            // Select the xml node that contains the chart's data.
            XmlNodeList xmlNodes = this.Document.SelectNodes(this.PathDimension + "/*[not(self::Variable)][not(self::MeanScore)]");

            // Open an array for the values.
            writer.Append("[");

            // FOR TEST ONLY:
            foreach (XmlNode xmlNodeCategory in xmlNodes)
            {
                if (xmlNodeCategory.ParentNode.Attributes["IsNestedBase"] != null &&
                    bool.Parse(xmlNodeCategory.ParentNode.Attributes["IsNestedBase"].Value) == true)
                {
                    continue;
                }

                if (xmlNodeCategory.Attributes["ShowInChart"] != null && bool.Parse(xmlNodeCategory.Attributes["ShowInChart"].Value) == false)
                {
                    continue;
                }

                DefinitionObject test = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable/{0}[@Id=\"{1}\"]",
                        xmlNodeCategory.Name,
                        xmlNodeCategory.Attributes["Id"].Value
                        )
                    );

                object enabled = test.GetValue("Enabled");

                if (enabled != null && bool.Parse((string)enabled) == false)
                {
                    continue;
                }

                writer.Append("{");

                Guid idCategory = Guid.Parse(xmlNodeCategory.Attributes["Id"].Value);

                string categoryName  = (string)test.GetValue("Name");
                string categoryLabel = (string)test.GetLabel(base.IdLanguage);

                XmlNode xmlNode = xmlNodeCategory.SelectSingleNode("Variable[@IsNestedBase=\"True\"]");

                if (xmlNode == null)
                {
                    xmlNode = xmlNodeCategory.SelectSingleNode("Variable");
                }

                if (xmlNode == null)
                {
                    xmlNode = xmlNodeCategory;
                }

                double value     = 0.0;
                double baseValue = 0;
                if (xmlNode.Attributes["Value"] != null)
                {
                    if (xmlNode.Attributes["Value"] != null)
                    {
                        value = double.Parse(xmlNode.Attributes["Value"].Value);
                    }

                    if (xmlNode.ParentNode.Attributes["Position"].Value == "Top")
                    {
                        if (xmlNode.ParentNode.Attributes["Base"] != null)
                        {
                            baseValue = double.Parse(xmlNode.ParentNode.Attributes["Base"].Value);
                        }
                    }
                    else
                    {
                        if (xmlNode.Attributes["Base"] != null)
                        {
                            baseValue = double.Parse(xmlNode.Attributes["Base"].Value);
                        }
                    }
                }
                else
                {
                    if (xmlNode.Attributes["Base"] != null)
                    {
                        value = double.Parse(xmlNode.Attributes["Base"].Value);
                    }
                    if (xmlNode.Attributes["VariableBase"] != null)
                    {
                        baseValue = double.Parse(xmlNode.Attributes["VariableBase"].Value);
                    }
                    else if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                    {
                        baseValue = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                    }
                }

                /*if (xmlNodeCategory.Attributes["Base"] != null)
                 *  value = double.Parse(xmlNodeCategory.Attributes["Base"].Value);
                 * else if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                 *  value = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                 *
                 * if (xmlNode.Attributes["Value"] != null)
                 * {
                 *  baseValue = value;
                 *  value = double.Parse(xmlNode.Attributes["Value"].Value);
                 * }
                 * else
                 * {
                 *  if (xmlNodeCategory.ParentNode.Attributes["Base"] != null)
                 *      baseValue = double.Parse(xmlNodeCategory.ParentNode.Attributes["Base"].Value);
                 * }*/

                if (baseValue != 0)
                {
                    value = value * 100 / baseValue;
                }
                else
                {
                    value = 0;
                }

                if (chartingColors.Length == i)
                {
                    i = 0;
                }

                writer.Append(string.Format(
                                  "\"dimension\": \"{0}\", \"value\": \"{1}\", \"Label\": \"{2}\",\"Color_{0}\": \"{3}\"",
                                  categoryName,
                                  value.ToString(new CultureInfo(2057)),
                                  HttpUtility.HtmlEncode(categoryLabel),
                                  chartingColors[i++]
                                  ));

                if (xmlNodeCategory.ChildNodes.Count > 0 && xmlNodeCategory.FirstChild.Attributes["Id"].Value != "00000000-0000-0000-0000-000000000000")
                {
                    writer.Append(string.Format(
                                      ", \"XPATH\": \"{0}\"",
                                      HttpUtility.UrlEncode(xmlNodeCategory.GetXPath(true) + "/Variable")
                                      ));
                }

                writer.Append("},");
            }

            if (xmlNodes.Count > 0)
            {
                writer = writer.Remove(writer.Length - 1, 1);
            }

            // Close the values array.
            writer.Append("]");
        }
 public LinkBiDefinition(DatabaseCore.Core core, XmlDocument xmlDocument, HierarchyFilter hierarchyFilter)
     : base(core, xmlDocument, hierarchyFilter)
 {
 }
示例#13
0
 public abstract void Render(StringBuilder writer, HierarchyFilter hierarchyFilter);
        public override void Render(StringBuilder writer, HierarchyFilter hierarchyFilter)
        {
            InitFilter(
                this.Source,
                this.Core,
                hierarchyFilter
                );

            // Open an array for the values.
            writer.Append("[");

            // FOR TEST ONLY:
            string variableName = (string)base.Core.TaxonomyVariables.GetValue("Name", "Id", this.IdVariable);

            Database storageMethod = new Database(
                base.Core,
                null,
                1
                );

            List <string> categories = storageMethod.GetTextAnswers(this.IdVariable, true, null, true);

            List <Task> tasks = new List <Task>();

            Dictionary <string, double> categoryValues = new Dictionary <string, double>();

            Dictionary <string, object> ignoreTexts      = new Dictionary <string, object>();
            Dictionary <string, object> ignoreCharacters = new Dictionary <string, object>();

            LoadTextAggregationDefinition(ignoreTexts, ignoreCharacters);

            int value;

            foreach (string category in categories)
            {
                string text = category;

                foreach (string ignoreCharacter in ignoreCharacters.Keys)
                {
                    text = text.Replace(ignoreCharacter, "");
                }

                text = text.ToLower().Trim();

                if (text.Length <= 1)
                {
                    continue;
                }

                if (int.TryParse(text, out value))
                {
                    continue;
                }

                if (ignoreTexts.ContainsKey(text))
                {
                    continue;
                }

                if (!categoryValues.ContainsKey(text))
                {
                    categoryValues.Add(text, 0);
                }
            }


            Guid[] idVariables;

            idVariables = this.Core.VariableLinks.GetValues(
                new string[] { "IdVariable" },
                new string[] { "IdTaxonomyVariable" },
                new object[] { this.IdVariable }
                ).Select(x => (Guid)x[0]).ToArray();

            Dictionary <Guid, List <string> > data = storageMethod.LoadTextAnswers(
                this.IdVariable,
                true,
                null,
                true
                );

            foreach (string category in categoryValues.Keys.ToList())
            {
                tasks.Add(Task.Factory.StartNew(() =>
                {
                    categoryValues[category] = GetTextCategoryCount(
                        category,
                        storageMethod,
                        idVariables,
                        data
                        );
                }));
            }

            Task.WaitAll(tasks.ToArray());

            StringBuilder test = new StringBuilder();

            foreach (string category in categoryValues.Keys.OrderByDescending(x => categoryValues[x]))
            {
                test.Append(category);
                test.Append("\t");
                test.Append(categoryValues[category]);
                test.Append(Environment.NewLine);
            }

            // System.IO.File.WriteAllText(@"E:\LiNKApplication\LinkLibraries\LinkManager\Clients\LinkOnline\LinkOnline\Fileadmin\Temp\WriteText.txt", test.ToString());

            foreach (string category in categoryValues.Keys)
            {
                if (categoryValues[category] == 0)
                {
                    continue;
                }

                writer.Append("{");

                string text = category;

                text = HttpUtility.HtmlEncode(text);


                writer.Append(string.Format(
                                  "\"text\": \"{0}\", \"value\": {1}",
                                  text,
                                  categoryValues[category].ToString(new CultureInfo(2057))
                                  ));

                writer.Append("},");
            }

            if (categories.Count > 0)
            {
                writer = writer.Remove(writer.Length - 1, 1);
            }

            // Close the values array.
            writer.Append("]");
        }
        public override void Render(StringBuilder writer, HierarchyFilter hierarchyFilter)
        {
            string[] chartingColors = LoadChartingColors();
            //Random rnd = new Random();
            //List<string> usedColors = new List<string>();
            int i = 0;

            // Select the xml node that contains the chart's data.
            XmlNodeList xmlNodes = this.Document.SelectNodes(this.PathDimension + "/*[not(self::Variable)][not(self::MeanScore)]");


            // Open an array for the values.
            writer.Append("[");

            foreach (XmlNode xmlNodeCategory in xmlNodes)
            {
                if (xmlNodeCategory.Attributes["ShowInChart"] != null && bool.Parse(xmlNodeCategory.Attributes["ShowInChart"].Value) == false)
                {
                    continue;
                }

                // if (xmlNodeCategory.Name == "MeanScore") continue;
                if (xmlNodeCategory.ParentNode.Attributes["IsNestedBase"] != null && bool.Parse(xmlNodeCategory.ParentNode.Attributes["IsNestedBase"].Value) == true)
                {
                    continue;
                }

                DefinitionObject variable = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable[@Id=\"{0}\"]",
                        xmlNodeCategory.ParentNode.Attributes["Id"].Value
                        )
                    );
                DefinitionObject category = new DefinitionObject(
                    base.Core,
                    this.Source,
                    string.Format(
                        "//Variable[@Id=\"{2}\"]/{0}[@Id=\"{1}\"]",
                        xmlNodeCategory.Name,
                        xmlNodeCategory.Attributes["Id"].Value,
                        xmlNodeCategory.ParentNode.Attributes["Id"].Value
                        )
                    );

                object enabled   = category.GetValue("Enabled");
                object _hasValue = category.GetValue("HasValues");

                ReportDefinition reportDefinition = new ReportDefinition(
                    base.Core,
                    this.Source,
                    hierarchyFilter
                    );

                //if (enabled != null && bool.Parse((string)enabled) == false)
                //    continue;
                bool hasValue = true;

                bool.TryParse(_hasValue != null ? _hasValue.ToString() : "true", out hasValue);

                if ((enabled != null && bool.Parse((string)enabled) == false) || (hasValue == false && reportDefinition.Settings.HideEmptyRowsAndColumns))
                {
                    continue;
                }

                string variableName  = (string)variable.GetValue("Name");
                string categoryName  = (string)category.GetValue("Name");
                string categoryLabel = (string)category.GetLabel(base.IdLanguage);
                if (String.IsNullOrEmpty(categoryName))
                {
                    categoryName = categoryLabel;
                }
                writer.Append("{");

                writer.Append(string.Format(
                                  "\"dimension\": \"{0}\", \"Label\": \"{1}\",",
                                  variableName + "_" + categoryName,
                                  categoryLabel
                                  ));

                //XmlNodeList xmlNodesMeasures = xmlNodeCategory.SelectNodes("Variable/TaxonomyCategory");
                XmlNodeList xmlNodesMeasures = xmlNodeCategory.SelectNodes(this.PathMeasure + "/*[not(self::Variable)]");

                foreach (XmlNode measure in xmlNodesMeasures)
                {
                    if (measure.Attributes["ShowInChart"] != null && bool.Parse(measure.Attributes["ShowInChart"].Value) == false)
                    {
                        continue;
                    }

                    if (measure.ParentNode.Attributes["IsNestedBase"] != null &&
                        bool.Parse(measure.ParentNode.Attributes["IsNestedBase"].Value) == true)
                    {
                        continue;
                    }

                    //usedColors.Add(measure.Attributes["Color"].Value);

                    DefinitionObject category2 = new DefinitionObject(
                        base.Core,
                        this.Source,
                        //xmlNodeCategory.GetXPath(true)
                        string.Format(
                            "//{2}[@Id=\"{3}\"]/{0}[@Id=\"{1}\"]",
                            measure.Name,
                            measure.Attributes["Id"].Value,
                            measure.ParentNode.Name,
                            measure.ParentNode.Attributes["Id"].Value
                            )
                        );

                    double value     = 0.0;
                    double baseValue = 0;

                    // Nested on the left.
                    if ((category2.XmlNode.ParentNode.Name != "ScoreGroup" && category2.XmlNode.ParentNode.Attributes["Position"] != null && category2.XmlNode.ParentNode.Attributes["Position"].Value == "Left") ||
                        (category2.XmlNode.ParentNode.Name == "ScoreGroup" && category2.XmlNode.ParentNode.ParentNode.Attributes["Position"] != null && category2.XmlNode.ParentNode.ParentNode.Attributes["Position"].Value == "Left"))
                    {
                        value     = double.Parse(measure.ParentNode.ParentNode.Attributes["Base"].Value);
                        baseValue = double.Parse(measure.ParentNode.ParentNode.ParentNode.Attributes["Base"].Value);

                        writer.Append(string.Format(
                                          "\"_{0}\": \"{1}\",",
                                          "",
                                          (value * 100 / baseValue).ToString(new CultureInfo(2057))
                                          ));

                        if (measure.ChildNodes.Count > 0)
                        {
                            writer.Append(string.Format(
                                              "\"XPATH_{0}\": \"{1}\", \"IsDimensionPath_{0}\": \"true\", \"Color_{0}\": \"{2}\"",
                                              "",
                                              HttpUtility.UrlEncode(measure.ParentNode.ParentNode.GetXPath(true) + "/Variable"),
                                              measure.Attributes["Color"].Value

                                              /*HttpUtility.UrlEncode(string.Format(
                                               *  "Variable[@Id='{0}']/{2}[@Id='{1}']/Variable",
                                               *  measure.ParentNode.Attributes["Id"].Value,
                                               *  measure.Attributes["Id"].Value,
                                               *  measure.Name
                                               * ))*/
                                              ));
                        }

                        break;
                    }

                    enabled = category2.GetValue("Enabled");
                    bool _enabled;
                    _hasValue = category2.GetValue("HasValues", false);

                    hasValue = true;

                    bool.TryParse(_hasValue != null ? _hasValue.ToString() : "true", out hasValue);

                    if (enabled != null && bool.TryParse(enabled.ToString(), out _enabled))
                    {
                        if ((_enabled == false) || (hasValue == false && reportDefinition.Settings.HideEmptyRowsAndColumns))
                        {
                            continue;
                        }
                    }

                    //if (enabled != null && bool.TryParse(enabled.ToString(), out _enabled))
                    //{
                    //    if (_enabled == false)
                    //        continue;
                    //}

                    string measureLabel = new DefinitionObject(
                        this.Core,
                        category2.Source,
                        category2.ParentPath
                        ).GetLabel(base.IdLanguage) +
                                          "###SPLIT###" + category2.GetLabel(base.IdLanguage);

                    if (category2.TypeName != "NumericValue")
                    {
                        if (measure.Attributes["Base"] != null)
                        {
                            value = double.Parse(measure.Attributes["Base"].Value);
                        }
                        else if (measure.ParentNode.Attributes["Base"] != null)
                        {
                            value = double.Parse(measure.ParentNode.Attributes["Base"].Value);
                        }

                        if (measure.Attributes["Value"] != null)
                        {
                            baseValue = value;
                            value     = double.Parse(measure.Attributes["Value"].Value);
                        }
                        else if (measure.ChildNodes.Count > 0)
                        {
                            if (measure.ChildNodes[0].Attributes["Base"] != null)
                            {
                                baseValue = double.Parse(measure.ChildNodes[0].Attributes["Base"].Value);
                            }
                        }
                        bool isFake = Guid.Parse(measure.Attributes["Id"].Value) == new Guid();

                        if (isFake)
                        {
                            baseValue = double.Parse(measure.ParentNode.Attributes["VariableBase"].Value);
                        }
                    }
                    else
                    {
                        value     = double.Parse(measure.ParentNode.ParentNode.Attributes["Base"].Value);
                        baseValue = double.Parse(measure.ParentNode.ParentNode.ParentNode.Attributes["Base"].Value);
                    }

                    if (chartingColors.Length == i)
                    {
                        i = 0;
                    }

                    writer.Append(string.Format(
                                      "\"_{0}\": \"{1}\", \"Color_{0}\": \"{2}\",",
                                      measureLabel,
                                      (value * 100 / baseValue).ToString(new CultureInfo(2057)),
                                      chartingColors[i++]//measure.Attributes["Color"].Value
                                      ));

                    if (measure.ChildNodes.Count > 0)
                    {
                        writer.Append(string.Format(
                                          "\"XPATH_{0}\": \"{1}\",",
                                          measureLabel,
                                          HttpUtility.UrlEncode(string.Format(
                                                                    "Variable[@Id='{0}']/{2}[@Id='{1}']/Variable",
                                                                    measure.ParentNode.Attributes["Id"].Value,
                                                                    measure.Attributes["Id"].Value,
                                                                    measure.Name
                                                                    ))
                                          ));
                    }
                }

                writer = writer.Remove(writer.Length - 1, 1);

                writer.Append("},");
            }

            if (xmlNodes.Count > 0)
            {
                writer = writer.Remove(writer.Length - 1, 1);
            }

            // Close the values array.
            writer.Append("]");
        }
        private void BindWeightingDefinition(ReportDefinition reportDefinition)
        {
            ddlDefaultWeighting.Items.Add(new ListItem()
            {
                Text  = Global.LanguageManager.GetText("None"),
                Value = (new Guid()).ToString()
            });

            HierarchyFilter hierarchyFilter = Global.HierarchyFilters[reportDefinition.FileName];

            // Get all as weighting variable defined variables.
            List <object[]> weightingVariables = Global.Core.TaxonomyVariables.GetValues(
                new string[] { "Id" },
                new string[] { "Weight" },
                new object[] { true }
                );

            // Run through all weighting variables.
            foreach (object[] weightingVariable in weightingVariables)
            {
                if (hierarchyFilter.TaxonomyVariables.ContainsKey(Guid.Parse(weightingVariable[0].ToString())))
                {
                    // Create a new list item for the weighting variable.
                    ddlDefaultWeighting.Items.Add(new ListItem()
                    {
                        Value = weightingVariable[0].ToString(),
                        Text  = (string)Global.Core.TaxonomyVariableLabels.GetValue(
                            "Label",
                            new string[] { "IdTaxonomyVariable", "IdLanguage" },
                            new object[] { weightingVariable[0], reportDefinition.Settings.IdLanguage }
                            )
                    });
                }
            }

            if (reportDefinition.WeightingFilters.DefaultWeighting.HasValue)
            {
                ddlDefaultWeighting.SelectedValue = reportDefinition.WeightingFilters.DefaultWeighting.Value.ToString();

                if (ddlDefaultWeighting.SelectedValue != reportDefinition.WeightingFilters.DefaultWeighting.Value.ToString())
                {
                    string label = "";

                    if (reportDefinition.WeightingFilters.XmlNode.Attributes["IsTaxonomy"] != null &&
                        bool.Parse(reportDefinition.WeightingFilters.XmlNode.Attributes["IsTaxonomy"].Value) == false)
                    {
                        label = (string)Global.Core.VariableLabels.GetValue(
                            "Label",
                            new string[] { "IdVariable", "IdLanguage" },
                            new object[] { reportDefinition.WeightingFilters.DefaultWeighting.Value, reportDefinition.Settings.IdLanguage }
                            );
                    }
                    else
                    {
                        label = (string)Global.Core.TaxonomyVariableLabels.GetValue(
                            "Label",
                            new string[] { "IdTaxonomyVariable", "IdLanguage" },
                            new object[] { reportDefinition.WeightingFilters.DefaultWeighting.Value, reportDefinition.Settings.IdLanguage }
                            );
                    }

                    // Create a new list item for the weighting variable.
                    ddlDefaultWeighting.Items.Add(new ListItem()
                    {
                        Value = reportDefinition.WeightingFilters.DefaultWeighting.Value.ToString(),
                        Text  = label
                    });

                    ddlDefaultWeighting.SelectedValue = reportDefinition.WeightingFilters.DefaultWeighting.Value.ToString();
                }
            }

            ddlDefaultWeighting.Attributes.Add(
                "onchange",
                "SetOverallWeightingVariable(this.value)"
                );
        }