BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Follow BOB on Twitter! 
Follow BOB on Twitter! (Opens a new window)  

General Notice: No events within the next 45 days.

Change XI 3.1 DeskI FullClient Refresh on Open via SDK


 
Search this topic... | Search SDK (VBA/ASP/JSP)... | Search Box
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Author Message
ntruhan
Forum Member
Forum Member



Joined: 14 Jul 2015

Posts: 5



PostPosted: Thu Jan 31, 2019 2:10 pm 
Post subject: Change XI 3.1 DeskI FullClient Refresh on Open via SDK

Hello,
Yes, this is a DeskI client in 2019. Doing a mass migration from 3.1 to 4.2 for a client and there are hundreds of reports coming out of the woodwork. Of course some of these have refresh on open and some have invalid local providers we can't use now. So one task is to turn off the refresh piece. Now yes, I could open each report in DeskI and goto Tools-> Options -> Save and uncheck the Refresh on open, but there are quite a few. So I am trying the old 3.1 SDK to do this.

I can connect to the system, load the FullClient Reports and iterate through them. I have a helper class that does all the queries, etc..

Code:

final String qry = "Select top 100000 * from CI_INFOOBJECTS where SI_KIND = 'FullClient' AND SI_INSTANCE = 0";
   
IInfoObjects objs = qh.run(qry);
for (int i = 0; i < objs.size(); i++) {
  IFullClient rpt = (IFullClient) objs.get(i);

   if (rpt != null) {
     if (rpt.getRefreshOnOpen()) {
         rpt.setRefreshOnOpen(false);
         rpt.save();
      }
   }
}

...

Now this actually iterates through, checks a flag in the query, supposedly sets the flag and saves. I can see the date updated on the report in the CMC after the save. And if I query on a report by its name in the AdminTools, I see the SI_ISREFRESHONOPEN is set to false if it was true, so that updates. BUT if I open a report in DeskI that was changed, the report itself didn't actually change and going to Tools-> Options -> Save still shows the Refresh Document When Opening Flag checked. banghead.gif

Has anyone done this before in SDK?
Thanks,
Nathan
Code:
Back to top
joepeters
Forum Fanatic
Forum Fanatic



Joined: 29 Aug 2002

Posts: 6535
Location: Connecticut, USA


flag
PostPosted: Thu Jan 31, 2019 2:50 pm 
Post subject: Re: Change XI 3.1 DeskI FullClient Refresh on Open via SDK

You are using the BI Platform SDK. This does enable access to objects in the CMS, but for document types (DeskI, WebI, CR, Universes, etc.) you only have access to the object metadata. So you can see (and change) things like parent folder, owner, etc., but you cannot see or change stuff that's stored in the document itself -- this would include the query definition, report structure, variables, options, and more. SOME of the document properties are copied into the CMS object upon save -- this includes the Refresh On Open property that you found. But, since this is a copy of the property in the CMS, modifying it will not actually do anything.

In order to modify the ROO property in the DeskI documents, you will need to use the DeskI COM library. This might not be as hard as it sounds. The DeskI application includes a VBA editor. You will just need to write a script to open a document from the CMS, do a "Save As" without ROO, and re-publish.

(I don't have DeskI installed here, but I'm pretty sure the ROO property is set during Save As. It might be a document property, but it's in there somehwere).
Back to top
ntruhan
Forum Member
Forum Member



Joined: 14 Jul 2015

Posts: 5



PostPosted: Mon Feb 04, 2019 1:34 pm 
Post subject: Re: Change XI 3.1 DeskI FullClient Refresh on Open via SDK

So I cobbled something together in VBA that opens the report and can remove the flag. However, one issue I have is that the report will auto-refresh the first time it opens and if there are prompts it can get stuck waiting for prompts until you switch over and cancel out of them to continue.

I tried to use the OpenFromEnterprise function to do this and it does open the report and I can use the SaveToEnterprise to republish the report.

The only way I can see to do it is to to retrieve the file using a oInfoObject.Files.Item(1).CopyTo ... Then opening the local copy using:
Application.Documents.Open(FileName, True, False, "","")

This provided a NoAutomaticRefresh flag which I set to true. So it will retrieve them all and open them; however, for each of them it doesn't seem to pull in the correct value for Automatic Refresh, it is always False, so I never can set the value properly.

Is there a hidden or alternate way to pull this so I don't get stuck on reports doing a OpenFromEnterprise?

Thanks,
Nathan
Back to top
joepeters
Forum Fanatic
Forum Fanatic



Joined: 29 Aug 2002

Posts: 6535
Location: Connecticut, USA


flag
PostPosted: Mon Feb 04, 2019 2:19 pm 
Post subject: Re: Change XI 3.1 DeskI FullClient Refresh on Open via SDK

Just a guess, but what if you open it (with NoAutomaticRefresh set to true), then just Save?
Back to top
SuKA
Forum Member
Forum Member



Joined: 20 Oct 2018

Posts: 12



PostPosted: Sat Feb 23, 2019 8:45 am 
Post subject: Re: Change XI 3.1 DeskI FullClient Refresh on Open via SDK

Hi,
here is my code solving this issue.
It automates Deski from Excel (2007 or above). You may find instructions in the comments.


Code:

'Use this code in Excel2007 or above
'Prerequisite: BusinessObjects XI 3.1 properly installed on your PC
'You MUST add reference to "BusinessObjects 12.0 Object Library" prior to use the code below (Tools\References)
'You should paste this code into an Excel worksheet (or ThisWorkbook) code module (Excel2007 or above)
'If the Immediate window not seen in your VBIDE then: View\Immediate Window
'Change CMSSourceFolder, CMSDestinationFolder, RepName
'Save your workbook as a Macro-Enabled Workbook (i.e. ROOtest.xlsm)
'Run the SetROO subroutine
Option Explicit
Option Base 1
'This macro implements Deski Application & Document level events as described in the following document:
'"Desktop Intelligence Developer Guide BusinessObjects XI 3.1" , Chapter: "Desktop Intelligence events"
Private WithEvents iDoc As busobj.Document      'Deski Doc with events
Private WithEvents boApp As busobj.Application  'Deski App with events
Dim bAuth As Boolean                            'Logon success
Private CMSSourceFolder As String, CMSDestinationFolder As String
Private RepName As String, RepFullName As String
Private CategoryList As String
Private bDebug As Boolean               'Show/suppress event messages
Private bboApp_DocumentBeforeRefresh As Boolean
Private DPIsRefreshable() As Boolean    'Stores dataproviders' IsRefreshable property
Private i As Long                       'For DPs cycle

Private Sub SetROO()
    On Error GoTo ErrorHandler
    Application.DisplayAlerts = False
    bDebug = True   'If you do not want to see the event messages change it to False
    Set boApp = New busobj.Application
    boApp.Visible = True    'We shall see what's going on in Deski
    boApp.Interactive = True   'For LogonDialog
    bAuth = boApp.LogonDialog
    CMSSourceFolder = "XARCH/ROO"   'Change your source folder path
    CMSDestinationFolder = "XARCH/ROO"  'Change your destination folder path (may be same as source folder)
    RepName = "D01Toroltek_3"   'Change your test report name here
    bboApp_DocumentBeforeRefresh = False
    Debug.Print Time, "Action: OpenFromEnterprise" & " ,CMSSourceFolder - " & CMSSourceFolder & " ,RepName - " & RepName
    Set iDoc = boApp.Documents.OpenFromEnterprise(RepName, CMSSourceFolder, BoEnterpriseFolderKind.BOFolder)
    boApp.Interactive = False   'Suppress alerts, questions,...
    RepFullName = iDoc.FullName
    CategoryList = iDoc.DocAgentOption.CategoryList & "|AutoRefreshDisabled"
    Debug.Print Time, "Action: AutoRefreshWhenOpening set to False", iDoc.FullName
    iDoc.AutoRefreshWhenOpening = False 'ROO set False explicitly
    Debug.Print Time, "Action: iDoc.SaveToEnterprise - " & CMSDestinationFolder & "/" & RepName, iDoc.AutoRefreshWhenOpening
    iDoc.SaveToEnterprise CMSDestinationFolder, BoEnterpriseFolderKind.BOFolder, CategoryList, "", True
    Debug.Print Time, "Action: iDoc.Close (boDontSave)", iDoc.FullName, iDoc.AutoRefreshWhenOpening
    iDoc.Close (boDontSave)
    Debug.Print Time, "Action: ReOpenFromEnterprise - " & CMSDestinationFolder & "/" & RepName
    Set iDoc = boApp.Documents.OpenFromEnterprise(RepName, CMSDestinationFolder, BoEnterpriseFolderKind.BOFolder)
DocClose:
    Debug.Print Time, "Action: iDoc.Close (boDontSave)", iDoc.FullName, iDoc.AutoRefreshWhenOpening
    iDoc.Close (boDontSave)
CleanUp:
    On Error Resume Next
    Application.DisplayAlerts = True
    Set iDoc = Nothing
    If Not boApp Is Nothing Then boApp.Quit
    Set boApp = Nothing
Exit Sub
ErrorHandler:
    Debug.Print "ERROR! Err.Number: " & Err.Number & ",Err.Description: " & Err.Description & ". Going to clean up."
    Err.Clear
    Resume CleanUp
End Sub

'----------------------------------------------------
'Implementing Deski Document level events
Private Sub iDoc_Activate()
    If bDebug Then Debug.Print Time, "Event : iDoc_Activate", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_AfterRefresh()
    If bDebug Then Debug.Print Time, "Event : iDoc_AfterRefresh", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_BeforeClose(Cancel As Boolean)
    Debug.Print Time, "Event : iDoc_BeforeClose", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_BeforeRefresh(Cancel As Boolean)
    If bDebug Then Debug.Print Time, "Event : iDoc_BeforeRefresh", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_BeforeSave(Cancel As Boolean)
    If bDebug Then Debug.Print Time, "Event : iDoc_BeforeSave", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_Deactivate()
    If bDebug Then Debug.Print Time, "Event : iDoc_Deactivate", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub
Private Sub iDoc_Open()
    If bDebug Then Debug.Print Time, "Event : iDoc_Open", iDoc.FullName, iDoc.AutoRefreshWhenOpening
End Sub

'----------------------------------------------------
'Implementing Deski Application level events
Private Sub boApp_DocumentActivate(ByVal doc As busobj.IDocument)
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentActivate - " & doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Private Sub boApp_DocumentAfterRefresh(ByVal doc As busobj.IDocument)
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentAfterRefresh", doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Private Sub boApp_DocumentBeforeClose(ByVal doc As busobj.IDocument, Cancel As Boolean)
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentBeforeClose", doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Private Sub boApp_DocumentBeforeRefresh(ByVal doc As busobj.IDocument, Cancel As Boolean)
'If ROO (AutoRefreshWhenOpening property) is True than this is the very first event
'1. All DataProviders IsRrefreshable property stored in DPIsRefreshable()
'2. All DataProviders IsRrefreshable property set to False so the DOCUMENT WILL NOT BE REFRESHED ANYWAY
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentBeforeRefresh", doc.FullName, doc.AutoRefreshWhenOpening
    ReDim DPIsRefreshable(doc.DataProviders.Count)
    bboApp_DocumentBeforeRefresh = True
    For i = 1 To UBound(DPIsRefreshable)
        With doc.DataProviders(i)
        If bDebug Then Debug.Print Time, "Action: DataProvider " & .Name & " IsRefreshable property stored & set to False."
        DPIsRefreshable(i) = .IsRefreshable
        .IsRefreshable = False
        End With
    Next i
End Sub
Private Sub boApp_DocumentBeforeSave(ByVal doc As busobj.IDocument, Cancel As Boolean)
'All DataProviders IsRrefreshable property restored from DPIsRefreshable()
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentBeforeSave", doc.FullName, doc.AutoRefreshWhenOpening
    If bboApp_DocumentBeforeRefresh Then
        For i = 1 To UBound(DPIsRefreshable)
            With doc.DataProviders(i)
            If bDebug Then Debug.Print Time, "Action: DataProvider " & .Name & " IsRefreshable property restored - " & DPIsRefreshable(i)
            .IsRefreshable = DPIsRefreshable(i)
            End With
        Next i
   End If
End Sub
Private Sub boApp_DocumentDeactivate(ByVal doc As busobj.IDocument)
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentDeactivate", doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Private Sub boApp_NewDocument(ByVal doc As busobj.IDocument)
    If bDebug Then Debug.Print Time, "boApp_NewDocument", doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Private Sub boApp_DocumentOpen(ByVal doc As busobj.IDocument)
    If bDebug Then Debug.Print Time, "Event : boApp_DocumentOpen", doc.FullName, doc.AutoRefreshWhenOpening
End Sub
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0326 seconds using 17 queries. (SQL 0.0025 Parse 0.0009 Other 0.0292)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo