예제 #1
0
        /// <summary>
        /// Rearranges the variables making the creation of the SDMX file easier.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        internal static PXModel RearrangeVariables(PXModel model)
        {
            //Verify all preconditions are ok.
            if (!CanConvertModel(model))
            {
                throw new PXSerializationException();
            }

            Pivot pivot = new Pivot();

            PivotDescription[] pDesc;
            pDesc = new PivotDescription[model.Meta.Variables.Count];


            for (int i = 0; i < model.Meta.Variables.Count; i++)
            {
                Variable var = model.Meta.Variables[i];

                if (var.HasTimeValue)
                {
                    pDesc[i] = new PivotDescription(var.Name, PlacementType.Heading);
                }
                else
                {
                    pDesc[i] = new PivotDescription(var.Name, PlacementType.Stub);
                }
            }

            model = pivot.Execute(model, pDesc);
            return(model);
        }