Intellicus Enterprise Reporting and Business Insights 18.1

Integrating Intellicus into your application

0 views June 28, 2020 0

Intellicus Native Library (INL) allows developers to provide access and analysis of Intellicus servers’ entities, data objects (Query and Cube objects) as well as formatted reports (Standard/ Ad hoc/ High Speed) and dashboards in mobile application. By utilizing rich and user-friendly visualizations provided by INL in applications, developers can help users make better decisions on the go.

Follow the below mentioned steps to add “IntellicusiOSLib framework” to your application:

  1. Copy “IntellicusiOSLib.framework” to your code directory, intellicusiOSResource.bundle, “Default*.illtheme.plist” to the resource directory of your app.
  2. Edit Project setting for “All” Configurations.
    • Select project target and go to “Build Phase” tab.
      1. Add “IntellicusiOSLib.framework” in project.
        • Select “Link Binary with Libraries” section.
        • Press “+” button.
        • Press “Add Other…” button visible at the left bottom corner of the new pop-up window.
        • Select “IntellicuiOSLib.framework” from the location where it was copied previously in project code directory.
      2. Add other frameworks (required for the Intellicus framework) in project.
        • Select “Link Binary with Libraries” section.
        • Press “+” button.
        • Type framework’s name (that you want to add in project) in search bar visible in the new pop-up window, and add all the following frameworks in succession,
          • AudioToolbox.framework
          • CoreText.framework
          • CoreGraphics.framework
          • ImageIO.framework
          • MessageUI.framework
          • OpenGLES.framework
          • Security.framework
          • SystemConfiguration.framework
          • libz.dylib. Because of a known issue in Xcode7 if you don’t find libz.dylib in the iOS framework section, you can go to the build settings and in “Other Linker Flags” section you can add –lz for all the configurations
          • libsqlite3.0.dylib. Because of a known issue in Xcode7 if you don’t find libsqlite3.0.dylib in the iOS framework section, you can go to the build settings and in “Other Linker Flags” section you can add -lsqlite3 for all the configurations
      3. Add intellicusiOSResource.bundle file in the project.
        • Select “Copy Bundle Resources” section.
        • Press “+” button.
        • Press “Add Other…” button visible at the left bottom corner of the new pop-up window.
        • Select “intellicusiOSResource.bundle” file from the location where it was copied previously in project code directory.
        • Choose Create Folder references option from the dialog box and click Finish.
      4. Select “Build Settings” tab.
        • Add linkers flag required to map Intellicus library to project.
          • Type “Other Linker Flags” in the search bar visible at the top right corner of the build settings tab.
          • Add “-ObjC” and “-all_load” flags.
      5. Add Launch images for all the supported iOS versions and devices
         
        You need to add launch images for all the iOS versions and devices that are supported. If launch images are missing, then you do not get the actual size of the views required for the devices.

How to integrate “IntellicusiOSLib framework” into your application

  1. Add following statement to project’s “.pch file” (If it exists) to use all public level header files of Intellicus framework,

     #import <IntellicusiOSLib/IntellicusiOSLib.h>” 
    

     
    If your project does not have .pch file, then you can ignore this step. You must import individual header files of Intellicus framework in each of your project’s file wherever you are using Intellicus framework functionality.

  2. Go to the App build settings under target and set “Allow Non-Modular Includes in Framework Modules” to YES for all the configurations.
  3. Initialize library. Preferably initialize library in “application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions”. You can add a Private method “initializeIntellicusiOSLibrary” to your app delegate class and can call “initializeIntellicusiOSLibrary” method from “application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions”.
     
    Please refer to the following piece of code:
  4. -(void)initializeIntellicusiOSLibrary
    {
        	// Create library default configuration information object
        IILLibInitializeInfo *pLibConfigInfo = [[IILLibInitializeInfo alloc]init];
        
        // Set keychain group name to application bundle identifier (like com.companyname.appname). Library uses this group name to store persistent information in keychain (library uses keychain to store sensitive information like user name, password etc.)
       pLibConfigInfo.keychainGroupName = [IILUtility bundleIdentifier];
        
       // Set application window
       pLibConfigInfo.appWindow = self.window;
        
        // Get librarys initializer shared object and store it
        // To store intellicusiOSApp object you need to add a (nonatomic, strong) property to appdelegate class
        self.intellicusiOSApp = [IntellicusiOSApp sharedInstance];
        
        //Initialize library
        [self.intellicusiOSApp initializeLibrary:pLibConfigInfo];
        
        pLibConfigInfo = nil;
        
        // Set the default theme to the library/framework
        // getDefaultTheme is a private method, sample implementation of this method is given below
        self.intellicusiOSApp.appLevelInfo.appTheme = [self getDefaultTheme];
    }
    
    -(IILTheme *)getDefaultTheme
    {
        // Get the file path of theme plist file
        // getDefaultThemeFilePath is a private method, sample implementation of this method is given below
        NSString *strThemePListFilePath = [self getDefaultThemeFilePath];
        
        // Create the frameworks theme object and return it
        IILTheme *pTheme = [[IILTheme alloc]initWithThemeName:@"Default"
                                               themePlistPath:strThemePListFilePath];
        
        return pTheme;
    }
    
    -(NSString *)getDefaultThemeFilePath
    {
        NSString *strThemeFileName = @"Default";
        
        // For iPad you will load default_iPad theme file
        if ([IILUtility isTargetDevicePad]) {
            
            strThemeFileName = @"Default_iPad";
        }
        
        // Get Main Bundle
        NSBundle *pMainBundle = [NSBundle mainBundle];
        
        // Theme files have iiltheme.plist extensions
        NSString *strThemeFilePath = [pMainBundle pathForResource:strThemeFileName
                                                                  ofType:@"iiltheme.plist"
                                                             inDirectory:nil];
        
        return strThemeFilePath;
    }
    

     

  5. Set up Intellicus Frameworks/library that includes two tasks:
    • Synchronizes and restores data base to saved state.
    • Read the persistent information (stored in keychain or other storage) in backend in secondary thread.

    Preferably setup of Intellicus Frameworks/library should be called from viewDidLoad method of first controller of the application. The first view controller should also show a waiting alert till the framework/library setup is finished.

    Please refer to the following piece of code:

  6. // readPersistentInformations is a private method, which should be implemented in the first view controller of the application
    -(void)readPersistentInformations
    {
        // Set subscribed report maximum screen shots property
        [self setSubscribedReportMaximumScreenshots];
        
        AppDelegate *pAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        
        pAppDelegate.intellicusiOSApp.delegate = self;
        
        // Setup intellicus framework/library. The setup method reads the persistent information from keychain and synchronizes database to valid state. The setup method reads the information in background thread and once finished, it informs using delegate method
        [pAppDelegate.intellicusiOSApp setUpIntellicusiOSLib];
    }
    // This method sets the subscribed report maximum snapshot property. This property is required if the application wants to use subscribed reports functionality of Intellicus Framework
    // This method is using hardcoded number for this property but if the application wants then application can ask this information from user and persist the value of this property in permanent storage like NSUserDefault, Sqlite database etc. 
    -(void)setSubscribedReportMaximumScreenshots
    {
    	//set this information in library
        AppDelegate *pAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        
        pAppDelegate.intellicusiOSApp.libConfigurationInfo.subscribedReportMaxScreenshots = 10;
    }
    // This delegate method is called by Intellicus framework when it finishes setting up the framework
    #pragma mark - IntellicusiOSApp delegate Methods -
    -(void)intellicusiOSAppDidRestorePersistentInfo:(IntellicusiOSApp *)pSender
    {
        [self performSelectorOnMainThread:@selector(stopLoadingAlert)
                               withObject:nil
                            waitUntilDone:YES];
    }
    

     

  7. If the application is using single sign-on, then application needs to set the server URL and user information to the Intellicus framework. This should be done after the Intellicus framework is setup successfully.

    Please refer to the following piece of code.

  8. -(void)addServerInformation
    {
        //Get the IntellicusiOSApp object
        AppDelegate *pAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
        
        IntellicusiOSApp *pIntellicusiOSApp = pAppDelegate.intellicusiOSApp;
        
        //Get server information collection from the app object
        ServerInformationCollection *pServerInfoCollection = pIntellicusiOSApp.libConfigurationInfo.serverInfoCollection;
        
        //If server is not already added then only add it
        if ([pServerInfoCollection serverInformationCount] == 0) {
        
            //Preparing user dictionary
            NSMutableDictionary *pUserDictionary = [[NSMutableDictionary alloc]init];
        
            //Set user ID
            [pUserDictionary setValue:@"Admin"
                               forKey:KEY_USERID];
        
            //Set User Password
            [pUserDictionary setValue:@"Admin"
                               forKey:KEY_PASSWORD];
            
            //Set Organization ID
            [pUserDictionary setValue:@"Intellica"
                               forKey:KEY_ORGID];
            
            //Set User ID
            [pUserDictionary setValue:@"Admin"
                               forKey:KEY_APPID];
            
            [pUserDictionary setValue:@""
                               forKey:KEY_VERSION];
            
            //Prepare server URL
            NSMutableString *strUrl = [[NSMutableString alloc]initWithString:@"http://127.0.0.1:8080/intellicus"];
            //Add the communication servlet string to the base URL
            [strUrl appendString:SERVLET_STRING];
            
            ServerInformation *pServerInformation = [[ServerInformation alloc] initWithServerURL:strUrl
                                                                                        userInfo:pUserDictionary
                                                                                    addTimeStamp:[IILUtility currentDate]
                                                                                  securityPolicy:nil
                                                                      lastCommunicationTimeStamp:[IILUtility currentDate]
                                                                                 connectedStatus:eSCS_CONNECTED
                                                                                           error:nil
                                                                    isValidBasedOnSecurityPolicy:YES
                                                                                   serverVersion:@"7.3"];
            
            
            [IILUtility addServerInformationIntoCollection:pServerInformation];
    //Set as default server
            [IILUtility setAppDefaultServer:pServerInformation];
        }
    }
    

     

  9. Call Intellicus servers’ synchronization that includes two tasks:
    • Check server’s connectivity with user authentication, and update security policy.
    • Apply server’s security policy on the entities imported from that server.

    If your application at any point of time (let’s say while starting) wants Intellicus mobile framework to synchronize entities downloaded on device with Intellicus server, this can be achieved using the following piece of code.

  10. //This method returns the array of Pair objects. Each pair object consists of server (from which you want to synchronize) and its corresponding array of entities which you want to synchronize
    -(NSArray *)serverEntitiesListForSynchronization
    {
        NSMutableArray *pTempCollection = [[NSMutableArray alloc]init];
        
        //get all servers added in list.
        AppDelegate *pAppDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
        
        ServerInformationCollection *pServersCollection =    pAppDelegate.intellicusiOSApp.libConfigurationInfo.serverInfoCollection;
        
        NSDictionary *pServerInfoDict = pServersCollection.serverInfoCollection;
        
        //Iterate on server collection to prepare list of servers and its entities to synchronize
        NSEnumerator *pEnumerator = [pServerInfoDict objectEnumerator];
        ServerInformation *pServerInfo = nil;
        
        while (pServerInfo = [pEnumerator nextObject]) {
            
            ESecurityPolicyType ePolicy = pServerInfo.securityPolicy.securityPolicyType;
            
            //Add server and its entities to list only when server status is connected, and server security policy allows to synchronize automatically
            if (pServerInfo.connectionStatus == eSCS_CONNECTED &&
                ePolicy != eSPT_NO_CHECK) {
                
                //Pair has server information as first object collection of filtered entities as second object. Passing nil for second object because here you want to check for all entities
                Pair *pPair = [[Pair alloc]initWithFirstObject:pServerInfo
                                               andSecondObject:nil];
                
                [pTempCollection addObject:pPair];
                
                pPair = nil;
            }
        }
        
        return pTempCollection;
    }
    
    -(void)synchronizeServersEntities:(NSArray *)pServerEntitiesCollections
    {
        //You will synchronize only when you have at least one server to synchronize from
        if (pServerEntitiesCollections.count > 0) {
            
            //If entities synchronizer object is not already created, create it
            if (self.entitiesSynchronizer == nil) {
                
                EntitiesSynchronizer *pTemp = [[EntitiesSynchronizer alloc]
                                               initWithServerEntitiesCollections:pServerEntitiesCollections];
                
                self.entitiesSynchronizer = pTemp;
                
                pTemp = nil;
            }
            else {
                
                //If already created, simply set the server entities collection to the synchronizer
                self.entitiesSynchronizer.serverEntitiesCollections =
                        pServerEntitiesCollections;
            }
            
            //Start synchronizing entities. This method synchrnizes entities in background and once finished, it informs via delegate method.
            [self.entitiesSynchronizer synchronizeEntities];
        }
        else {
            
            //If nothing is to synchronize then release the synchronizer
            [self releaseEntitiesSynchronizer];
        }
    }
    
    -(void)releaseEntitiesSynchronizer
    {
        self.entitiesSynchronizer = nil;
    }
    
    #pragma mark - EntitiesSynchronizer Delegate Methods -
    -(void)entitiesSynchronizerDidSynchronize:(EntitiesSynchronizer *)pSender
    {
        //Releasing EntitiesSynchronizer after a very short delay is preferable so that releasing will happen in next run loop and this run loop gives chance to EntitiesSynchronizer to clean up its stuff
        [self performSelector:@selector(releaseEntitiesSynchronizer)
                   withObject:nil
                   afterDelay:0.1f];
        
    }
    

     

  11. Load Intellicus Entities List

    You need to load a list of entities for Ad hoc analysis, multidimensional analysis, viewing reports and dashboards etc. Following piece of code loads the list of Datasets (query objects) for Ad hoc analysis.

  12. -(void)showIntellicusEntitiesList:(EILEntityType)eEntityType
    {
        //Create the Intellicus Entities list screen object
        NSString *strNib = @"LoginViewController_";
        
        strNib = [strNib stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
        
        LoginViewController *pLoginViewController = [[LoginViewController alloc]
                                                     initWithNibName:strNib
                                                     bundle:[IILUtility frameworkResourceBundle]];
        
        //Set the appropriate entity type
        //As of now possible entity types which can be set are eEntityType_DataSet, eEntityType_SubscribedReport, eEntityType_CubeObject, eEntityType_DashBoard
        pLoginViewController.entityType = eEntityType;
        
        //Show the Intellicus entities list screen
        [pLoginViewController showViewController:self.navigationController];
        
        pLoginViewController = nil;
    }
    

     

  13. Download and view specific Intellicus’s Entity (Entities)

    If you do not want to use Intellicus mobile application’s entity list screen, instead if you want to create your own listing screen to show Intellicus entities then you will need the logic to download and specific Intellicus Entities. Following piece of code downloads and views a specific dashboard.

  14. -(void)downloadSpecificDashboard
    {
        //Get the default server
        ServerInformation *pDefaultServer = [IILUtility getDefaultServer];
        NSString *strDefServerUniqueId = [pDefaultServer getUniqueKey];
        
        //Create a dashboard object, which you want to download
        //Entity id is the unique id of dashboard on Intellicus Report Server
        //Entity name is the name of dashboard
        //Parent Category id the unique id of folder on Intellicus Report Server in which dashboard is saved
        //Parent Category name the name of folder on Intellicus Report Server in which dashboard is saved
        //Source Server Unique id the unique id of the Intellicus Server from where you want to download the dashboard
        DashBoard *pDashboard = [[DashBoard alloc]initWithEntityId:@"13457234292692192168339847921678"
                                                        entityName:@"Demo Collection Details"
                                                  parentCategoryId:@"CE8B51F0-CF75-EF60-3E1B-0957AF1B895A"
                                                parentCategoryName:@"Mobile Demo"
                                           andSourceServerUniqueId:strDefServerUniqueId];
        
        pDashboard.containsParameters = TRUE;
        
        //Save the dashboard with us
        self.downloadedDashboard = pDashboard;
        
        //Create dashboard tasks executer. Task executer is responsible for downloading dashboard from Intellicus Server
        DBTasksExecuter *pTaskExecuter = [[DBTasksExecuter alloc]
                                         initWithTasksExecuterDelegate:self
                                         andDashBoard:pDashboard];
        
        //Set the server information to task executer from where you want to download the dashboard
        pTaskExecuter.serverInfo = pDefaultServer;
        pTaskExecuter.isRecursiveRefresh = TRUE;
        //start the task executer to start the download of dashboard
        [pTaskExecuter start];
        
        //Show the loading alert till you download the dashboard completely
        [self startLoadingAlertWithTitle:@"Downloading"
                                 message:@"Downloading Dashboard"
                                     tag:ALERT_TAG_DOWNLOAD_DASHBOARD];
    }
    
    -(void)viewDownloadedDashboard
    {
        //View dashboard only when you have successfully downloaded dashboard on device
        if (self.downloadedDashboard &&
            self.downloadedDashboard.updateStatus == eDSUS_UPDATE_COMPLETE) {
         
            //Create DashboardViewController object
            NSString *strNib = @"DashBoardViewController_";
            
            strNib = [strNib stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            DashBoardViewController *pDashboardViewController = [[DashBoardViewController alloc] initWithNibName:strNib
                                                                                                          bundle:[IILUtility frameworkResourceBundle]];
            
            //Set dashboard to view to dashboard view controller object
            pDashboardViewController.pDashBoard = self.downloadedDashboard;
            
            //Push Dashboard view controller
            [self.navigationController pushViewController:pDashboardViewController
                                                 animated:YES];
            
            pDashboardViewController = nil;
        }
        else {
            
            //As you have not successfully downloaded dashboard on device, show the message to the user
            [self showAlertMessage:@"Please download Dashboard to view it"
                         withTitle:@""];
        }
    }
    
    Following piece of code downloads a specific report and view it
    -(void)downloadSpecificReport
    {
        //Get the default server
        ServerInformation *pDefaultServer = [IILUtility getDefaultServer];
        NSString *strDefServerUniqueId = [pDefaultServer getUniqueKey];
        
        //Create a Report object which you want to download
        //Entity id is the unique id of report on Intellicus Report Server
        //Entity name is the name of report
        //Parent Category id the unique id of folder on Intellicus Report Server in which report is saved
        //Parent Category name the name of folder on Intellicus Report Server in which report is saved
        //Source Server Unique id the unique id of the Intellicus Server from where you want to download the report
        SubscribeReport *pSubReport = [[SubscribeReport alloc]initWithEntityId:@"Center wise Collection details"
                                                                    entityName:@"Center wise Collection details"
                                                              parentCategoryId:@"CE8B51F0-CF75-EF60-3E1B-0957AF1B895A"
                                                            parentCategoryName:@"Mobile Demo"
                                                       andSourceServerUniqueId:strDefServerUniqueId];
            
        pSubReport.isAllowedInListing = TRUE;
        pSubReport.containsParameters = TRUE;
        
        //Save the report with us
        self.downloadedReport = pSubReport;
        
        //Create report tasks executer. Task executer is responsible for downloading report from Intellicus Server
        SRTasksExecuter *pTaskExecuter = [[SRTasksExecuter alloc]
                                          initWithTasksExecuterDelegate:self
                                          andSubscribeReport:pSubReport];
        
        //Set the server information to task executer from where you want to download the dashboard
        pTaskExecuter.serverInfo = pDefaultServer;
        pTaskExecuter.isRecursiveRefresh = TRUE;
        
        [self setFetchReportTaskProperties:pTaskExecuter];
    
        //start the task executer to start the download of report
        [pTaskExecuter start];
        
        //Show the loading alert till you download the report completely
        [self startLoadingAlertWithTitle:@"Downloading"
                                 message:@"Downloading Report"
                                     tag:ALERT_TAG_DOWNLOAD_REPORT];
    }
    
    -(void)setFetchReportTaskProperties:(SRTasksExecuter *)pTaskExecuter
    {
        SubscribeReport *pSubReport = self.downloadedReport;
        
        //Get the fetch subsribed report task from task executer
        FetchSubscribedReportTask *pFetchTask = nil;
        for(ILTask *pILTask in pTaskExecuter.pendingTaskList)
        {
            if ([pILTask isKindOfClass:[FetchSubscribedReportTask class]]) {
                
                pFetchTask = (FetchSubscribedReportTask *)pILTask;
                break;
            }
        }
        
        //Set the properties to fetch subsribed report task
        pFetchTask.savedReportGetCriteria = eSRGC_LATEST;
        SavedReportGetFilters *pSavedReportGetFilters = [[SavedReportGetFilters alloc]init];
        
        //allocate user filters object.
        UserFilters *pUserFilters = [[UserFilters alloc]init];
        //Create and add REPORTID filter
        UserFilter *pUserFilter = [[UserFilter alloc]initWithName:TAG_SAVEDREPORT_FILTER_REPORT_ID
                                                               op:@"="
                                                         andValue:pSubReport.reportObjectId];
        [pUserFilters addUserFilter:pUserFilter];
        pUserFilter = nil;
        
        pSavedReportGetFilters.filters = pUserFilters;
        //Set the filters to fetch subsribed report task
        pFetchTask.savedReportGetFilters = pSavedReportGetFilters;
        
        pSavedReportGetFilters = nil;
        
        //Set the parameter form to task
        pFetchTask.parameterForm = self.latestParameterForm;
    
        pFetchTask.forcePublish = TRUE;
    }
    
    -(void)viewDownloadedReport
    {
        //View report only when you have successfully downloaded report on device
        if (self.downloadedReport &&
            self.downloadedReport.updateStatus == eDSUS_UPDATE_COMPLETE) {
            
            //Create SubscribeReportViewController object
            NSString *strNibName = @"SubscribeReportViewController_";
            
            strNibName = [strNibName stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            SubscribeReportViewController *pSubscribeReportViewController =[[SubscribeReportViewController
                                                                             alloc]
                                                                            initWithNibName:strNibName
                                                                            bundle:[IILUtility frameworkResourceBundle]];
            
            //Set report to subscribe report view controller object
            pSubscribeReportViewController.subscribeReport = self.downloadedReport;
            
            //Push subscribe report view controller
            [self.navigationController pushViewController:pSubscribeReportViewController
                                                 animated:YES];
            
            pSubscribeReportViewController = nil;
        }
        else {
            
            //As you have not successfully downloaded report on device, show the message to the user
            [self showAlertMessage:@"Please download Report to view it"
                         withTitle:@""];
        }
    }
    
    Following piece of code downloads a specific dataset and view (Analyze and Browse) it:
    -(void)downloadSpecificDataset
    {
        //Get the default server
        ServerInformation *pDefaultServer = [IILUtility getDefaultServer];
        NSString *strDefServerUniqueId = [pDefaultServer getUniqueKey];
        
        //Create a dataset object which you want to download
        //Entity id is the unique id of dataset on Intellicus Report Server
        //Entity name is the name of dataset
        //Parent Category id the unique id of folder on Intellicus Report Server in which dataset is saved
        //Parent Category name the name of folder on Intellicus Report Server in which dataset is saved
        //Source Server Unique id the unique id of the Intellicus Server from where you want to download the dataset
        DataSet *pDataset = [[DataSet alloc]initWithEntityId:@"13160878599703192168335794663846"
                                                                    entityName:@"Health Insurance Claim"
                                                              parentCategoryId:@"CE8B51F0-CF75-EF60-3E1B-0957AF1B895A"
                                                            parentCategoryName:@"Mobile Demo"
                                                       andSourceServerUniqueId:strDefServerUniqueId];
        
        //Save the dataset with us
        self.downloadedDataset = pDataset;
        
        //Create dataset tasks executer. Task executer is responsible for downloading dataset from Intellicus Server
        DSTasksExecuter *pTaskExecuter = [[DSTasksExecuter alloc]
                                          initWithTasksExecuterDelegate:self
                                          andDataSet:pDataset];
        
        //Set the server information to task executer from where you want to download the dataset
        pTaskExecuter.serverInfo = pDefaultServer;
        pTaskExecuter.isRecursiveRefresh = TRUE;
        
        //start the task executer to start the download of dataset
        [pTaskExecuter start];
        
        //Show the loading alert till you download the dataset completely
        [self startLoadingAlertWithTitle:@"Downloading"
                                 message:@"Downloading Dataset"
                                     tag:ALERT_TAG_DOWNLOAD_DATASET];
    }
    
    -(void)viewDownloadedDataset
    {
        //View dataset only when you have successfully downloaded dataset on device
        if (self.downloadedDataset &&
            self.downloadedDataset.updateStatus == eDSUS_UPDATE_COMPLETE) {
            
            //Create ChartViewController object
            NSString *strNibName = @"ChartViewController_";
            strNibName = [strNibName stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            ChartViewController *pChartViewController = [[ChartViewController alloc]
                                                         initWithNibName:strNibName bundle:nil];
            
            //Set dataset to chart view controller object
            pChartViewController.dataSet= self.downloadedDataset;
            
            //Push chart view controller
            [self.navigationController pushViewController:pChartViewController
                                             animated:YES];
        }
        else {
            
            //As you have not successfully downloaded dataset on device, show the message to the user
            [self showAlertMessage:@"Please download Dataset to view it"
                         withTitle:@""];
        }
    }
    
    -(void)browseDownloadedDataset
    {
        //Browse dataset only when you have successfully downloaded dataset on device
        if (self.downloadedDataset &&
            self.downloadedDataset.updateStatus == eDSUS_UPDATE_COMPLETE) {
            
            //Create GridViewController object
            NSString *strNibName = @"GridViewController_";
            strNibName = [strNibName stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            GridViewController *pGridViewController = [[GridViewController alloc]
                                                         initWithNibName:strNibName bundle:nil];
            
            //Set dataset to grid view controller object
            pGridViewController.dataSet= self.downloadedDataset;
            
            //Push grid view controller
            [self.navigationController pushViewController:pGridViewController
                                                 animated:YES];
        }
        else {
            
            //As you have not successfully downloaded dataset on device, show the message to the user
            [self showAlertMessage:@"Please download Dataset to browse it"
                         withTitle:@""];
        }
    
    }
    
    Following piece of code downloads a specific cube object and view it:
    -(void)downloadSpecificCubeObject
    {
        //Get the default server
        ServerInformation *pDefaultServer = [IILUtility getDefaultServer];
        NSString *strDefServerUniqueId = [pDefaultServer getUniqueKey];
        
        //Create a cube object which you want to download
        //Entity id is the unique id of cube on Intellicus Report Server
        //Entity name is the name of cube
        //Parent Category id the unique id of folder on Intellicus Report Server in which cube is saved
        //Parent Category name the name of folder on Intellicus Report Server in which cube is saved
        //Source Server Unique id the unique id of the Intellicus Server from where you want to download the cube
        CubeObject *pCubeObject = [[CubeObject alloc]initWithEntityId:@"5351C902-7169-C1C5-36F0-47C86394D866"
                                                  entityName:@"DemoSalesData"
                                            parentCategoryId:@"CE8B51F0-CF75-EF60-3E1B-0957AF1B895A"
                                          parentCategoryName:@"Mobile Demo"
                                     andSourceServerUniqueId:strDefServerUniqueId];
        
        //Save the cube with us
        self.downloadedCubeObject = pCubeObject;
        //This will list the cube object in listing screen
        pCubeObject.isAllowedInListing = TRUE;
        
        //Create cube object tasks executer. Task executer is responsible for downloading cube object from Intellicus Server
        //coFetchType: Specifies what kind of information you want to fetch
        //incrementalFetch: Specifies if part of data for the cube object is already fetched or not
        ECOFetchType fetchType = eCOFT_DATA | eCOFT_METADATA | eCOFT_BUILDINFO;
        COTasksExecuter *pTaskExecuter = [[COTasksExecuter alloc]
                                          initWithTasksExecuterDelegate:self
                                          coFetchType:fetchType
                                          incrementalFetch:FALSE
                                          andCubeObject:pCubeObject];
        
        //Set the server information to task executer from where you want to download the cube
        pTaskExecuter.serverInfo = pDefaultServer;
        pTaskExecuter.isRecursiveRefresh = TRUE;
        //Setting this property to TRUE will allow user to fetch the cube data only when cube is updated on server after it is downloaded on device
        pTaskExecuter.fetchIfUpdated = TRUE;
    
        //start the task executer to start the download of cube
        [pTaskExecuter start];
        
        //Show the loading alert till you download the cube completely
        [self startLoadingAlertWithTitle:@"Downloading"
                                 message:@"Downloading Cube"
                                     tag:ALERT_TAG_DOWNLOAD_CUBE_OBJECT];
    }
    
    -(void)viewDownloadedCubeObject
    {
        //View cube object only when you have successfully downloaded it on device
        if (self.downloadedCubeObject &&
            self.downloadedCubeObject.updateStatus == eDSUS_UPDATE_COMPLETE) {
            
            NSString *strNibName = @"CubeViewController_";
            
            strNibName = [strNibName stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            CubeViewController *pCubeViewController =[[CubeViewController alloc]
                                                      initWithNibName:strNibName
                                                      bundle:nil];
            
            pCubeViewController.cubeObject = self.downloadedCubeObject;
            
            [self.navigationController pushViewController:pCubeViewController
                                                 animated:YES];
                    pCubeViewController = nil;
        }
        else {
                    //As you have not successfully downloaded cube object on device, show the message to the user
            [self showAlertMessage:@"Please download Cube to view it"
                         withTitle:@""];
        }
    
    }
    

     

  15. Show and set parameters for specific Intellicus’s Entity (Report or dashboard)

    If you do not want to use Intellicus mobile application’s entity list screen, instead if you want to create your own listing screen to show Intellicus entities then you will need the logic to show and set parameters for specific Intellicus Entities (Report or dashboard). Following piece of code shows and sets parameters for a specific report which is already downloaded on device.

  16. -(void)setParametersForDownloadedReport
    {
        //Set Parameters only when you have successfully downloaded report on device
        if (self.downloadedReport &&
            self.downloadedReport.updateStatus == eDSUS_UPDATE_COMPLETE) {
                    
            //Create object of ParametersViewController
            NSString *strNibName = @"ParametersViewController_";
            strNibName = [strNibName stringByAppendingString:[IILUtility getNibSuffixForTargetDevice:FALSE]];
            
            ParametersViewController *pParametersViewController =[[ParametersViewController alloc]
                                                                  initWithNibName:strNibName
                                                                  bundle:nil];
            
            //Set the entity (which is already downloaded on device) for which you want to set parameters for. In our case set it with report which you have already downloaded on device
            pParametersViewController.entity = self.downloadedReport;
            //Set the delegate for ParametersViewController
            pParametersViewController.delegate = self;
            
            //Push ParametersViewController to navigation stack
            [self.navigationController pushViewController:pParametersViewController
                                                 animated:YES];
        }
        else {
            
            //As you have not successfully downloaded report on device, show the message to the user
            [self showAlertMessage:@"Please download Report to set parameters"
                         withTitle:@""];
        }
    }
    
    #pragma mark - ParametersViewControllerDelegate delegate -
    -(void)parametersViewController:(ParametersViewController *)pSender
               didSaveParameterForm:(ParameterForm *)pForm
    {
        //Save the parameter form locally with us
        self.latestParameterForm = pForm;
    }