Exemple #1
0
        private static int GetSelectAndCreateSnapshots(IApp app, ISheet sheet, string region, out ISnapshot top5CustomersSnapshot, out ISnapshot quarterlyTrendSnapshot)
        {
            // Select region
            int    selectedIndex = 0;
            IField field         = null;

            foreach (var item in app.GetFieldList().Items)
            {
                if (item.Name == "Region")
                {
                    field = app.GetField(item.Name);
                }
            }
            var res         = field != null && field.Select(region);
            var extendedSel = app.GetExtendedCurrentSelection();

            foreach (var nxDataPage in extendedSel.GetField("Region").DataPages)
            {
                foreach (var rows in nxDataPage.Matrix)
                {
                    var cell = rows.FirstOrDefault();
                    if (cell != null)
                    {
                        if (cell.State == StateEnumType.SELECTED)
                        {
                            selectedIndex = cell.ElemNumber;
                        }
                    }
                }
            }

            // Get the Top 5 Customers on the sheet
            var top5Customers = GetVisualisationWithTitle(sheet, "Top 5 Customers");

            // Take a snapshot of Top 5 Customers
            top5CustomersSnapshot = app.CreateSnapshot(region + "Top5Customers", sheet.Id, top5Customers.Id);

            // Get the Quarterly Trend on the sheet
            var quarterlyTrend = GetVisualisationWithTitle(sheet, "Quarterly Trend");

            // Take a snapshot of Quarterly Trend
            quarterlyTrendSnapshot = app.CreateSnapshot(region + "QuarterlyTrend", sheet.Id, quarterlyTrend.Id);
            return(selectedIndex);
        }
Exemple #2
0
        private static void TakeSnapshots(ISheet sheet, IApp app, out ISnapshot nordicTop5, out ISnapshot nordicQuarterly, out ISnapshot usaTop5, out ISnapshot usaQuarterly, out ISnapshot japanTop5, out ISnapshot japanQuarterly)
        {
            // Get the Sales per Region on the sheet
            var salesPerRegion = GetVisualisationWithTitle(sheet, "Sales per Region");

            // Take a snapshot of SalesPerRegion
            if (salesPerRegion != null)
            {
                app.CreateSnapshot("SDK_SalesPerRegion", sheet.Id, salesPerRegion.Id);
            }

            // Select a region an take a snapshot of Top5Customers and QuarterlyTrend
            GetSelectAndCreateSnapshots(app, sheet, "Nordic", out nordicTop5, out nordicQuarterly);
            app.ClearAll();

            GetSelectAndCreateSnapshots(app, sheet, "Usa", out usaTop5, out usaQuarterly);
            app.ClearAll();

            GetSelectAndCreateSnapshots(app, sheet, "Japan", out japanTop5, out japanQuarterly);
            app.ClearAll();
        }