Friday, August 31, 2012

Need BI 4.0 WebIs from .NET Apps?

If you're investigating migration to BI 4.0, you probably already know that BI 4.0 doesn't include a plug-in to let you schedule Web Intelligence reports from .NET applications. If that's all that was keeping you from migrating, then we have good news: the APOS WebI .NET plug-in lets you schedule WebIs and manage defaults from .NET applications.
We created this plug-in to allow our own well managed BI solutions to work with BI 4.0, and now we're offering to the SAP BusinessObjects developer community. The APOS WebI .NET plug-in lets the developer handle format, prompt information, and other flags while scheduling Web Intelligence reports from .NET apps or saving report defaults.

Another issue that our plug-in solves is prompt reconstruction. When you create a new Web Intelligence report, or update an existing one, the prompt information on the report object becomes unavailable to the developer through the SDK. The APOS WebI .NET plug-in uses prompt reconstruction functionality to let the developer access the prompt information. You can schedule the report with the reconstructed prompts or save the report object for later use. You do not have to update the source report in order to schedule an instance.

You will notice that we are not using the GetPluginInterface method to initialize our plug-in. On a Web Intelligence object that method simply fails regardless of what you try to do with the returned object. We actually support using the plug-in interface to initialize our plug-in but this will not work with a Web Intelligence object. We tested it with other InfoObjects with no issues.

Example:

Using sm As CrystalDecisions.Enterprise.SessionMgr = New CrystalDecisions.Enterprise.SessionMgr
    Using es As CrystalDecisions.Enterprise.EnterpriseSession = sm.Logon("My Account", "My Password", "My CMS", "secEnterprise")
        Using iStore As CrystalDecisions.Enterprise.InfoStore = es.GetService("InfoStore")
            Using objs As CrystalDecisions.Enterprise.InfoObjects = iStore.Query("SELECT TOP 1 * FROM CI_INFOOBJECTS WHERE SI_NAME = 'My Report'")
                Using obj As CrystalDecisions.Enterprise.InfoObject = objs(1)
                    Using plg As APOSWebiPlugIn.webi = New APOSWebiPlugIn.webi(obj)
                        plg.WebiAPOSLicenseKey = "<your key here>"
                        'Choose to schedule to XLS format
                        plg.WebiFormat = APOSWebiPlugIn.CeWebiFormat.ceWebiFormatExcel
                        'Get the list of prompt names
                        Dim prompts As List(Of String) = plg.WebiGetPromptList()
                        'GEt the lsit of values for the first prompt
                        Dim vals As List(Of APOSWebiPlugIn.WebiPromptValue) = plg.WebiGetPromptValues(prompts(0))
                        'Clear the list of values
                        vals.Clear()
                        'Add Texas as the only value for the prompt
                        vals.Add(New APOSWebiPlugIn.WebiPromptValue("Texas"))
                        'Save the list of values back to the report
                        plg.WebiSetPromptValues(prompts(0), vals)
                        'Schedule the report
                        iStore.Schedule(objs)
                    End Using
                End Using
            End Using
        End Using
    es.Logoff()
    End Using
End Using

You are welcome to try it and let me know what you think. Just email webiplugin@apos.com to ask for the library or send in any comments.