cancel
Showing results for 
Search instead for 
Did you mean: 

How to get to existing Webi prompt's operand?

Former Member
0 Kudos

I have several prompts in a filter of a Webi report. Some have an operand set to "In List", some have it set to "Equal", some to "Not Equal".

I would like via an SDK to get to that operand of the existing prompt and 1) see what it's set to, and 2) be able to dynamically change the value (i.e. sometimes I need to change it from "In List" to "Equal" or "Equal" to "Not Equal", etc.).

I have access to BO XI R2 and BO XI 3. Doesn't matter to me where I can get it to work as long as I can get it to work. I know there's limited .NET sdk's in 3.0 so if I can get it to work in BO XI R2 and it will later work with the 3.1 SDK's that's ok for me.

I thought of using the .Net Report Engine SDK and prototyped some code with BO XI R2. Am I wrong that it's impossible to that there? That the Java Report Engine SDK is the only one that lists anything in the API to deal with filters, queries, and operands? (Why is that if that's the case!)

So I turned to using .Net Web Services SDK with BO XI 3.0. But while I see how I can make a new query and filter and prompt I don't see how I can get to the existing operand's setting to both see what's it's currently set to (I need to display that) and then to change it.

I can get to the prompt's value, just don't see how to get to an existing operand. If it's possible please let me know and if at all possible if someone could provide some sample code that would be great! It just needs to be in .NET.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

For anyone else struggling with this... In my case this was not working due to a bug in XI R2, XI 3.0, and XI 3.1. QueryService modifyDataProvider (tracking ADAPT01113234) has been fixed with XI Release 2 FixPack 4.5 and I've tested that it did work for me. No such fix is available for XI 3.0 or XI 3.1 as of this post but I was told that it would get a fix in the next SP (fingers crossed)

ted_ueda
Employee
Employee
0 Kudos

For .NET, you'd need to go through the QueryService Web Services.

You'd retrieve the DataProviderInformation and the QueryBase from DataProviderInformation.QuerySpecification.QueryBase.

Then walk down the QueryBase tree. If a QueryBase is a CombinedQuery, then the operator is given by CombinedQuery.CombinedQueryOperator property.

Sincerely,

Ted Ueda

Former Member
0 Kudos

Thanks! I totally missed the QueryService ws before and I see exactly all the information I need in the QueryBase as you suggested and am able to retrieve it.

So now I need to take it further and I want to modify the values and then view the modified in-memory document as HTML.

I see that there's a ModifyDataProvider method which looks like exactly what I'd like to use - to modify the FilterOperator (i.e. from Equal to NotEqual) and the Operand value (i.e. from California to New York). This returns an updated DataProviderInformation that I tried using with the ReportEngine ws GetDocumentInformation but when it displays the HTML of the document I get a #SYNTAX displayed for the column headers and it shows only 1 row of data and each cell in the row is also #SYNTAX. The original webi document does return the values without issue and it contains multiple rows of data.

Here's my code:


            ' Retrieve the Query Service
            Dim queryServiceURL() As String
            Dim boQueryService As QueryService

            queryServiceURL = boSession.GetAssociatedServicesURL("QueryService")
            boQueryService = QueryService.GetInstance(boSession, queryServiceURL(0))

            ' Retrive the Data Providers
            Dim boDataProviders() As DataProviderInformation
            Dim boDataProvider As DataProviderInformation

            ' Retrieve the ReportEngine Service so it can be used to view the document
            Dim reportEngineURL() As String
            Dim boReportEngine As ReportEngine
            reportEngineURL = boSession.GetAssociatedServicesURL("ReportEngine")
            boReportEngine = ReportEngine.GetInstance(boSession, reportEngineURL(0))

            Dim boRetrieveData As RetrieveData

            boRetrieveData = New RetrieveData()
            boRetrieveData.RetrieveView = boRetrieveViewHTML

            Dim boDocumentInformation As DocumentInformation
            'boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, Nothing)
            boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, boRetrieveData)

            boDataProviders = boQueryService.GetDataProviderList(boDocumentInformation.DocumentReference, True)
            'temp support only 1 for now for testing
            boDataProvider = boDataProviders(0)

            ' Retrieve the Data Provider ID
            Dim boDataProviderID As String
            boDataProviderID = boDataProvider.UID

            ' Retrieve the Data Source ID
            Dim boDataSourceID As String = ""
            'boDataSourceID = boDataProvider.DataSourceUID

            ' Retrieve the Data Sources
            Dim boDataSources() As DataSource
            boDataSources = boQueryService.GetDataSourceList
            Dim boDataSource As DataSource
            Dim i As Integer
            For i = 0 To boDataSources.Length - 1
                If boDataSources(i).Name = boDataProvider.DataSourceUID Then
                    boDataSource = boDataSources(i)
                    boDataSourceID = boDataSources(i).UID.ToString
                    Exit For
                End If
            Next

            ' Retrieve the Query Specifiction
            Dim boQuerySpecification As QuerySpecification
            boQuerySpecification = boDataProvider.QuerySpecification

            ' Retrieve the Query Base
            Dim boQueryBase As New QueryBase
            boQueryBase = boQuerySpecification.QueryBase

            ' Retrieve the Query
            Dim boQuery As New Query
            boQuery = boQueryBase

            ' Retrieve the Query Conditions
            Dim boQueryCondition As QueryCondition
            boQueryCondition = boQuery.QueryCondition

            'Retrieve the Filter
            Dim boFilterInfo As Filter
            boFilterInfo = boQueryCondition.Item(0)

            Dim boFilteredObject As QueryObject
            boFilteredObject = boFilterInfo.FilteredObject

            ' Set Filter Operator to NotEqual - original webi is set to Equal
            boFilterInfo.FilterOperator = FilterOperator.NotEqual

            ' Retrieve the Operands
            Dim boOperands() As Operand
            boOperands = boFilterInfo.Operand
            Dim boOperand As Operand
            boOperand = boOperands(0)

            ' Set Operand Value
            Dim boValues As Values
            boValues = boOperand
            boValues.NativeFreeValue(0) = "New York"

            ' Set the Return Properties
            Dim boReturnProperties As New ReturnProperties
            boReturnProperties.IncludeDataSourceParameterValues = True
            boReturnProperties.IncludeQuerySpecification = True
            'boReturnProperties.NoData = False

            ' Modify the Data Provider
            Dim modifiedDataProvider As DataProviderInformation
            modifiedDataProvider = boQueryService.ModifyDataProvider(boDocumentInformation.DocumentReference, boDataProviderID, boDataSourceID, boQuerySpecification, boReturnProperties)

            'view report
            Dim boRetrieveViewHTML As RetrieveView
            boRetrieveViewHTML = New RetrieveCharacterView()
            
            Dim boViewSupportHTML As ViewSupport

            boViewSupportHTML = New ViewSupport()
            boViewSupportHTML.OutputFormat = OutputFormatType.HTML
            boViewSupportHTML.ViewMode = ViewModeType.REPORT_PAGE
            boViewSupportHTML.ViewType = ViewType.CHARACTER
            boRetrieveViewHTML.ViewSupport = boViewSupportHTML

            ' Retrieve the DocumentInformation, which contains all the information for a document.
            Dim oActions(0 To 0) As Action
            oActions(0) = New Refresh
            'boDocumentInformation = boReportEngine.GetDocumentInformation(modifiedDataProvider.DocumentReference, Nothing, Nothing, Nothing, boRetrieveData)
            boDocumentInformation = boReportEngine.GetDocumentInformation(modifiedDataProvider.DocumentReference, Nothing, oActions, Nothing, boRetrieveData)

            Dim boCharacterView As CharacterView
            boCharacterView = CType(boDocumentInformation1.View, CharacterView)

            Response.Write(boCharacterView.Content)

1. Am I going about viewing the modified in-memory document the right away?

2. If I am, then at the top of the code, I'm doing a:

boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, boRetrieveData)

to retrieve the DocumentInformation (that I need in order to do a GetDataProviderList), do I need to include the boRetrieveData? I don't need the data for anything that I'm doing with the Query Specification but if I leave it as Nothing in that call, later when I do another call to the boReportEngine.GetDocumentInformation to which I'm passing the modifiedDataProvider.DocumentReference and I do include it I get an error.

3. At the bottom of the code I'm setting the oActions to Refresh and passing that in to the boRepotEngine.GetDocumentInformatoin as well. Is that needed? Do I need to do that and still pass the boRetrieveData?

4. How is it possible to now save the updated provider info back in to the webi document?

Or am I going about this all wrong? How should I be trying to view the in-memory document now that I've modified it's data provider information?

Former Member
0 Kudos

Hello, David;

You can access the WebI Prompt in the Visual Studio .NET SDK but you cannot access the Filter to get the operands except through Java.

Elaine