Example #1
0
            public void TestParseSimpleInstruction()
            {
                String      instruction = @"<div style=""display:none;"">~ http://r/role/RiskReturnDetail column period compact * row dei_LegalEntityAxis compact * row rr_ProspectusShareClassAxis compact * row primary compact * ~</div>";
                EmbedReport thisReport  = EmbedReport.LoadAndParse(instruction);

                Assert.AreEqual(1, thisReport.ColumnIterators.Length);
                CommandIterator thisIterator = thisReport.ColumnIterators[0] as CommandIterator;

                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                Assert.AreEqual(3, thisReport.RowIterators.Length);
                thisIterator = thisReport.RowIterators[0] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.AxisName == "dei_LegalEntityAxis");
                thisIterator = thisReport.RowIterators[1] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.AxisName == "rr_ProspectusShareClassAxis");
                thisIterator = thisReport.RowIterators[2] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.Filter == "*");

                Assert.AreEqual(@"http://r/role/RiskReturnDetail", thisReport.Role);
                Assert.IsFalse(thisReport.IsTransposed);
            }
Example #2
0
        public async Task <EmbedReport> GetEmbedReportAsync(int reportId, string userName)
        {
            var report = _reportingContext.Report.SingleOrDefault(r => r.ReportId == reportId);

            var embedReport = new EmbedReport();

            if (report == null)
            {
                embedReport.Errors = new List <string> {
                    "Report not found!"
                };
            }
            else
            {
                embedReport = report.ReportSecurityRole.Any() ?
                              await _powerBIEmbedService.GetEmbeddedReportAsync(AuthenticationType.MasterAccount, report.PowerBIReportId, report.PowerBIGroupId, userName, report.ReportSecurityRole.Select(rsr => rsr.SecurityRoleName).ToArray())
                    : await _powerBIEmbedService.GetEmbeddedReportAsync(AuthenticationType.MasterAccount, report.PowerBIReportId, report.PowerBIGroupId);

                foreach (var viz in report.ReportVisual)
                {
                    embedReport.Visuals.Add(new EmbedVisual()
                    {
                        VisualName = viz.VisualName, PageName = viz.PageName, SortOrder = viz.SortOrder
                    });
                }
            }

            return(embedReport);
        }
Example #3
0
            public void TestParseComplexInstruction()
            {
                String      instruction = @"~ http://europa.eu/role/R4041 column primary compact * row us-gaap_DerivativeByNatureAxis grouped * row us-gaap_InvestmentSecondaryCategorizationAxis grouped * row invest_InvestmentAxis unitcell * ~";
                EmbedReport thisReport  = EmbedReport.LoadAndParse(instruction);

                Assert.AreEqual(2, thisReport.ColumnIterators.Length);

                CommandIterator thisIterator = thisReport.ColumnIterators[0] as CommandIterator;

                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Filter == "*");
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                thisIterator = thisReport.ColumnIterators[1] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPrimary);
                Assert.IsTrue(thisIterator.Filter == "*");
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                Assert.AreEqual(3, thisReport.RowIterators.Length);
                thisIterator = thisReport.RowIterators[0] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Grouped);
                Assert.IsTrue(thisIterator.AxisName == "us-gaap_DerivativeByNatureAxis");
                thisIterator = thisReport.RowIterators[1] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Grouped);
                Assert.IsTrue(thisIterator.AxisName == "us-gaap_InvestmentSecondaryCategorizationAxis");
                thisIterator = thisReport.RowIterators[2] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.UnitCell);
                Assert.IsTrue(thisIterator.AxisName == "invest_InvestmentAxis");

                Assert.AreEqual(@"http://europa.eu/role/R4041", thisReport.Role);
                Assert.IsFalse(thisReport.IsTransposed);
            }
Example #4
0
        /// <summary>
        /// Looks through each segment of each axis in the given report to
        /// determine which is column/row based, then passes the results on for
        /// embed processing.  The result is stored in <see
        /// cref="EquityCandidate"/>.
        /// </summary>
        /// <param name="baseReport">The <see cref="InstanceReport"/> upon
        /// which to generate an equity style report.</param>
        /// <returns>A <see cref="bool"/> indicating success.</returns>
        public bool PopulateEquityReport(InstanceReport baseReport)
        {
            Dictionary <string, CommandIterator> columnCommands = new Dictionary <string, CommandIterator>();

            foreach (string axis in baseReport.AxisByPresentation)
            {
                bool axisFound = false;
                foreach (InstanceReportColumn segmentColumn in this.SegmentColumns)
                {
                    if (segmentColumn.Segments == null || segmentColumn.Segments.Count == 0)
                    {
                        continue;
                    }

                    foreach (Segment seg in segmentColumn.Segments)
                    {
                        if (string.Equals(seg.DimensionInfo.dimensionId, axis))
                        {
                            CommandIterator ci = new CommandIterator(CommandIterator.IteratorType.Column, axis, CommandIterator.StyleType.Compact, "*");
                            columnCommands[ci.AxisName] = ci;
                            axisFound = true;
                        }
                    }

                    if (axisFound)
                    {
                        break;
                    }
                }
            }

            CommandIterator unitCmd = new CommandIterator(CommandIterator.IteratorType.Column, "unit", CommandIterator.StyleType.Grouped, "*");

            columnCommands[unitCmd.SelectionString] = unitCmd;



            Dictionary <string, CommandIterator> rowCommands = new Dictionary <string, CommandIterator>();
            CommandIterator calCmd = new CommandIterator(CommandIterator.IteratorType.Row, "period", CommandIterator.StyleType.Grouped, "*");

            rowCommands[calCmd.SelectionString] = calCmd;

            CommandIterator elCmd = new CommandIterator(CommandIterator.IteratorType.Row, "primary", CommandIterator.StyleType.Compact, "*");

            rowCommands[elCmd.SelectionString] = elCmd;

            foreach (string axis in baseReport.AxisByPresentation)
            {
                if (columnCommands.ContainsKey(axis))
                {
                    continue;
                }

                if (rowCommands.ContainsKey(axis))
                {
                    continue;
                }

                CommandIterator specCmd = new CommandIterator(CommandIterator.IteratorType.Row, axis, CommandIterator.StyleType.Compact, "*");
                rowCommands[specCmd.AxisName] = specCmd;
            }


            EmbedReport            equityTransform = new EmbedReport();
            List <CommandIterator> colCmds         = new List <CommandIterator>(columnCommands.Values);

            equityTransform.ColumnIterators = colCmds.ToArray();

            List <CommandIterator> rowCmds = new List <CommandIterator>(rowCommands.Values);

            equityTransform.RowIterators = rowCmds.ToArray();

            equityTransform.AxisByPresentation = baseReport.AxisByPresentation;
            if (equityTransform.ProcessEmbedCommands(baseReport, null))
            {
                this.EquityCandidate = equityTransform.InstanceReport;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        private void SetValues( Cell rc )
        {
            this.ContextID = rc.ContextID;
            this.UnitID = rc.UnitID;

            this.DisplayDateInUSFormat = rc.DisplayDateInUSFormat;
            this.DisplayZeroAsNone = rc.DisplayZeroAsNone;

            this.FootnoteIndexer = rc.FootnoteIndexer;

            this.IsNumeric = rc.IsNumeric;
            this.IsRatio = rc.IsRatio;

            this.NonNumbericText = rc.NonNumbericText;
            this.NumericAmount = rc.NumericAmount;

            this.RoundedNumericAmount = rc.RoundedNumericAmount;
            this.ShowCurrencySymbol = rc.ShowCurrencySymbol;

            if( EmbedReport.HasMatch( rc.NonNumbericText ) )
                this.EmbeddedReport = EmbedReport.LoadAndParse( rc.NonNumbericText );
        }
Example #6
0
        public void Clear()
        {
            this.DisplayDateInUSFormat = false;
            this.DisplayZeroAsNone = false;

            this.EmbeddedReport = null;

            this.IsNumeric = false;
            this.IsRatio = false;

            this.NumericAmount = 0;
            this.NonNumbericText = string.Empty;
            this.RoundedNumericAmount = "0";
        }
Example #7
0
        /// <summary>
        /// Looks through each segment of each axis in the given report to
        /// determine which is column/row based, then passes the results on for
        /// embed processing.  The result is stored in <see
        /// cref="EquityCandidate"/>.
        /// </summary>
        /// <param name="baseReport">The <see cref="InstanceReport"/> upon
        /// which to generate an equity style report.</param>
        /// <returns>A <see cref="bool"/> indicating success.</returns>
        public bool PopulateEquityReport( InstanceReport baseReport )
        {
            Dictionary<string, CommandIterator> columnCommands = new Dictionary<string, CommandIterator>();
            foreach( string axis in baseReport.AxisByPresentation )
            {
                bool axisFound = false;
                foreach( InstanceReportColumn segmentColumn in this.SegmentColumns )
                {
                    if( segmentColumn.Segments == null || segmentColumn.Segments.Count == 0 )
                        continue;

                    foreach( Segment seg in segmentColumn.Segments )
                    {
                        if( string.Equals( seg.DimensionInfo.dimensionId, axis ) )
                        {
                            CommandIterator ci = new CommandIterator( CommandIterator.IteratorType.Column, axis, CommandIterator.StyleType.Compact, "*" );
                            columnCommands[ ci.AxisName ] = ci;
                            axisFound = true;
                        }
                    }

                    if( axisFound )
                        break;
                }
            }

            CommandIterator unitCmd = new CommandIterator( CommandIterator.IteratorType.Column, "unit", CommandIterator.StyleType.Grouped, "*" );
            columnCommands[ unitCmd.SelectionString ] = unitCmd;

            Dictionary<string, CommandIterator> rowCommands = new Dictionary<string, CommandIterator>();
            CommandIterator calCmd = new CommandIterator( CommandIterator.IteratorType.Row, "period", CommandIterator.StyleType.Grouped, "*" );
            rowCommands[ calCmd.SelectionString ] = calCmd;

            CommandIterator elCmd = new CommandIterator( CommandIterator.IteratorType.Row, "primary", CommandIterator.StyleType.Compact, "*" );
            rowCommands[ elCmd.SelectionString ] = elCmd;

            foreach( string axis in baseReport.AxisByPresentation )
            {
                if( columnCommands.ContainsKey( axis ) )
                    continue;

                if( rowCommands.ContainsKey( axis ) )
                    continue;

                CommandIterator specCmd = new CommandIterator( CommandIterator.IteratorType.Row, axis, CommandIterator.StyleType.Compact, "*" );
                rowCommands[ specCmd.AxisName ] = specCmd;
            }

            EmbedReport equityTransform = new EmbedReport();
            List<CommandIterator> colCmds = new List<CommandIterator>( columnCommands.Values );
            equityTransform.ColumnIterators = colCmds.ToArray();

            List<CommandIterator> rowCmds = new List<CommandIterator>( rowCommands.Values );
            equityTransform.RowIterators = rowCmds.ToArray();

            equityTransform.AxisByPresentation = baseReport.AxisByPresentation;
            if( equityTransform.ProcessEmbedCommands( baseReport, null ) )
            {
                this.EquityCandidate = equityTransform.InstanceReport;
                return true;
            }
            else
            {
                return false;
            }
        }