MicroStrategy ONE

Open a Panel Stack as an Information Window in iOS

You can use the widgetHelper class to cause a widget to open a panel stack as an Information Window, by following the steps below:  

  1. Configure the widget to open a panel stack as an Information Window  

  2. Verify the widget target type to ensure that the widget has an Information Window enabled as its target  

  3. Configure the Information Window context  

  4. Call the API to trigger opening the Information Window

The following dataset and grid are used by the code samples in this topic:

      

There are two different types of axis cells in the grid:

  • ROW_AXIS cells

    The row axis cells correspond to the attributes that are placed in the rows of the grid. The row index and column index for the cells in the columns of the grid are color-coded in the two left columns of the table below.  

  • COLUMN_AXIS cells

    The column axis cells correspond to the attributes that are placed in the columns of the grid.  The row index and column index for the cells in the rows of the grid are color-coded in the top two rows of the table below.

 

Instructions and code samples for each step to open a panel stack as an Information Window are provided below:  

  1. Configure the widget to open a panel stack as an Information Window

To open a panel stack as an Information Window, add one or more panel stacks when you design the document in MicroStrategy Web and make them targets of the report grid.    

  1. Verify the widget target type to ensure that the widget has an Information Window enabled as its target

    Use the following API, declared in the MSTRWidgetHelper class, to verify that the target type of the widget column has one of the InfoWindow types defined in EnumSelectorTargetType:  

    Copy
    - (EnumSelectorTargetType) getSelectorTargetTypeFromAxis:(AxisType)type andUnitIndex:(int)index; 

    EnumSelectorTargetType is an enumeration that defines all the possible target types for a given cell in the widget and is declared in MSTRWidgetHelper.h as:  

    Copy
    typedef enum _targetType { 
        EnumSelectorTargetTypeWrongIndex = -1,
        EnumSelectorTargetTypeNoTarget = 0,
        EnumSelectorTargetTypeInfoWindowOnly,
        EnumSelectorTargetTypeSelectorOnly,
        EnumSelectorTargetTypeInfoWindowAndSelector,
        EnumSelectorTargetTypeMultiInfoWindow,
        EnumSelectorTargetTypeMultiInfoWindowAndSelector
    }EnumSelectorTargetType;

    For example, to verify that the Country column in the example grid is enabled to display an Information Window, use the following API, where 0 is the column index for Country:

    Copy
    EnumSelectorTargetType type = [widgetHelper getSelectorTargetTypeFromAxis:ROW_AXIS andUnitIndex:0];
  1. Configure the Information Window context

    Once you have verified that the widget has a panel stack configured to be an Information Window as its target, configure the context for the presentation of the Information Window. Use the following API, declared in MSTRWidgetHelper.h:

    Copy
    - (void) setupPopoverContext:(UIView*)targetView withFrame:(CGRect)targetFrame;

    In this API, you tell MicroStrategy which target View the Information Window will be shown on top of and which frame the Information Window will point to but not cover. For example, if you consider the widget’s view and frame as parameters for this API, you would call the API as follows, assuming that this code is inside the widget’s code: 

    Copy
    [widgetHelper setupPopoverContext:self withFrame:self.frame];
  1. Call the API to trigger opening the Information Window

    The widgetHelper class provides two methods to open a panel stack as an Information Window. When you tap an element or a row in the report grid, it displays a panel stack as an information Window. 

    • Single cell selection to open a panel stack as an Information Window  

      Copy
      -(void)handleCellSelectionbyAxisType:(AxisType)type andRowIndex:(int)rowandColIndex:(int)col  
    • Row selection to open a panel stack as an Information Window  

      Copy
      -(void)handleCellSelectionsForEntireRowbyAxisType:(AxisType)type andRowIndex:(int)rowandColIndex:(int)col 

    The following code snippets show how to use this API with the sample dataset and grid shown above:

    • To open a panel stack by selecting the element "111" (Country):

      Copy
      [self.widgetHelper handleCellSelectionByAxisType:ROW_AXIS andRowIndex:0 andColIndex:0];
    • To open a panel stack by selecting the element "bbb" (City):

      Copy
      [self.widgetHelper handleCellSelectionByAxisType:ROW_AXIS andRowIndex:1 andColIndex:1];
    • To open a panel stack by selecting the first row - "111" and "aaa" (Country and City in the same row):

      Copy
      [self.widgetHelper handleCellSelectionsForEntireRowByAxisType:ROW_AXIS andRowIndex:0];
    • To open a panel stack by selecting the first row - "111" and "bbb" (Country and City in the same row):

      Copy
      [self.widgetHelper handleCellSelectionsForEntireRowByAxisType:ROW_AXIS andRowIndex:1];
    • To open a panel stack by selecting several elements that are not in the same row - "111" and "ccc" (Country and City in different rows):

      Copy
      NSMutableArray *selections = [NSMutableArray arrayWithCapacity:3];
      // add element "111"
        {
            SelectionCoordinate *coord = [[SelectionCoordinate alloc] init];
            coord.selectionType = 1;
            coord.axisType = row_axis;
            coord.depth = 0;
            coord.ordinal = 0;
            [selections addObject:coord];
            [coord release];
        }
      // add element "ccc"
        {
            SelectionCoordinate *coord = [[SelectionCoordinate alloc] init];
            coord.selectionType = 1;
            coord.axisType = row_axis;
            coord.depth = 1;
            coord.ordinal = 2;
            [selections addObject:coord];
            [coord release];
        }
      [self.widgetHelper handleSelectionsForCoordinateArray:selections];