0

We have a report with bursting query in OBIEE12c. We schedule report job using webservice via ScheduleService::scheduleReport() using web service client. In the Burst Query we set the TEMPLATE for the generated report. Every thing is working fine.

select  "invoice_table"."invid" as "KEY",
            **'invoice_template1' as "TEMPLATE",** 
            'en-US' as "LOCALE",
            'PDF' as "OUTPUT_FORMAT",
            'EMAIL' as "DEL_CHANNEL",
            'America/Los_Angeles' as "TIMEZONE",
             ...

The new requirement is to change the TEMPLATE in bursting query dynamically. Is there any way to change the TEMPLATE set in Bursting query dynamically while invoking ScheduleService::scheduleReport() so that the generated report changed according to requirement.

Chandu
  • 1,837
  • 7
  • 30
  • 51

1 Answers1

0

There are different ways to do it. It all depends on what is the condition to change the TEMPLATE. If it is within reach of your bursting select command then you can use CASE expression to select the right TEMPLATE. But it is probably not.
I do burstings combined with BI_BURST_CONTROL table created for different reports where are all the data needed to control the execution. That table is joined to and part of bursting query. One of such looks like below where I use CASE to either send the report by mail or to save it to the directory. The same way you can change the TEMPLATE but only if you can define the condition for the CASE expression.

SELECT 
    mb.MATBR "KEY",                                     -- DELIVER_BY Node beeing matched to KEY column 
    bc.TEMPLATE "TEMPLATE",                             -- Layout template to use (not name of Layout file)
    bc.LOCALE "LOCALE",                                 -- Localization (hr-HR)
    'PDF' "OUTPUT_FORMAT",                              -- (PDF)
    CASE mb.MATBR WHEN '000000' THEN 'File' ELSE 'Email' END "DEL_CHANNEL",                                             -- (Email)                  (File) for not existing MATBR
    CASE mb.MATBR WHEN '000000' THEN 'D:\File_Delivery' ELSE mb.MAIL END "PARAMETER1",                                  -- (Email)To                (File)Folder='D:\File_Delivery'
    CASE mb.MATBR WHEN '000000' THEN 'Ost_' || To_Char(bc.ID) || '_' || :PROLAZ || '.pdf' ELSE Null END "PARAMETER2",   -- (Email)Cc=Null           (File)FileName   
    CASE mb.MATBR WHEN '000000' THEN Null ELSE bc.PARAMETER3 END "PARAMETER3",                                          -- (Email)From              (File)Null
    CASE mb.MATBR WHEN '000000' THEN Null ELSE bc.PARAMETER4 END "PARAMETER4",                                          -- (Email)Subject           (File)Null
    CASE mb.MATBR WHEN '000000' THEN Null ELSE bc.PARAMETER5 END "PARAMETER5",                                          -- (Email)Message body      (File)Null
    CASE mb.MATBR WHEN '000000' THEN Null ELSE bc.PARAMETER6 END "PARAMETER6",                                          -- (Email)Attachment=true   (File)Null
    Null "PARAMETER7",                                      -- (Email)Reply to=Null     (File)Null
    Null "PARAMETER8",                                      -- (Email)Bcc=Null          (File)Null
    Null "PARAMETER9",                                      -- (Email)=Null             (File)Null
    Null "PARAMETER10",                                     -- (Email)=Null             (File)Null
    bc.OUTPUT_NAME || mb.MATBR "OUTPUT_NAME"                -- (Email)=AttFileName (with no extension)  (File)Null

FROM 
    (
        Select 
            MATBR "MATBR", 
            E_MAIL "MAIL" 
        From 
            SOME_TABLE@DBLINK 
        Where 
            DATE_START <= Last_Day(Add_Months(SysDate, -1)) And
            Last_Day(Add_Months(SysDate, -2)) < Nvl(DATE_END, To_Date('11.10.2062', 'dd.mm.yyyy'))  And
            E_MAIL Is Not Null
      UNION
        Select '000000' "MATBR", Null "MAIL" From DUAL
    ) mb
INNER JOIN 
    BI_BURST_CONTROL bc ON(bc.OWNER_ID = 'OWNER_ID' And bc.ID = :ID)

The other way depends on your definition of SOAP envelope to invoke a ScheduleService. That envelope, in my case, is created by a package handling all the conditions and decisions within PL/SQL where it is not a problem to change the TEMPLATE or whatever else. Sample envelope generated by the package is here:

<?xml version="1.0" encoding="utf-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap-env:Body>
        <ns0:scheduleReport xmlns:ns0="http://xmlns.oracle.com/oxp/service/v2">
            <ns0:scheduleRequest>
                <ns0:dataModelUrl>http://some.url.of.bi.server:9502/xmlpserver/xdmeditor.jsp?f=/%7Euser/DPOP/DataModels/Otpr/Analyze_DataModel.xdm</ns0:dataModelUrl>
                <ns0:jobLocale>hr-Hr</ns0:jobLocale>
                <ns0:repeatCount>1</ns0:repeatCount>
                <ns0:reportRequest>
                    <ns0:attributeCalendar>Gregorian</ns0:attributeCalendar>
                    <ns0:attributeFormat>pdf</ns0:attributeFormat>
                    <ns0:attributeLocale>hr-Hr</ns0:attributeLocale>
                    <ns0:attributeTemplate>Word_BI_PayListSQL_BLANK_7B.rtf</ns0:attributeTemplate>
                    <ns0:parameterNameValues>
                        <ns0:listOfParamNameValues>
                            <ns0:item>
                                <ns0:name>PASS_NUMBER</ns0:name>
                                <ns0:values>
                                    <ns0:item>1</ns0:item>
                                </ns0:values>
                            </ns0:item>
                            <ns0:item>
                                <ns0:name>STEP</ns0:name>
                                <ns0:values>
                                    <ns0:item>20</ns0:item>
                                </ns0:values>
                            </ns0:item>
                        </ns0:listOfParamNameValues>
                    </ns0:parameterNameValues>
                    <ns0:reportAbsolutePath>/~user/Payments/Reports/Work/PayListSQL_1_ver7_Report.xdo</ns0:reportAbsolutePath>
                </ns0:reportRequest>
                <ns0:scheduleBurstingOption>True</ns0:scheduleBurstingOption>
                <ns0:startDate>2020-10-08T09:00:00+02:00</ns0:startDate>
                <ns0:userJobName>PAYMENTS_2020-09_1</ns0:userJobName>
            </ns0:scheduleRequest>
            <ns0:userID>username</ns0:userID>
            <ns0:password>password</ns0:password>
        </ns0:scheduleReport>
    </soap-env:Body>
</soap-env:Envelope>

I know that this will not solve your problem but hopefully it will give you an idea how to do it in your specific context. In my experience one of the two or a combination of both can solve almost every possible problem of the kind as in your question. Regards...

d r
  • 3,848
  • 2
  • 4
  • 15