locked
Programmatic changes to briefing books. RRS feed

  • Question

  • I have downloaded the Proclarity SDK and would like to use it to write a C# application to retrieve a template briefing book (from Library X), customise it based on a given set of criteria, and then publish it to Library Y.

    Effectively I would like to take a template briefing book that, for example, has been sliced by "Product A" and would now like to create multiple versions of that briefing book for 10 users where each user is responsible for their own product. As such I would read in a mapping file (of user to their product) and want to customise the template briefing book before publishing it to the server for that specific user. Am I making sense? As new users come and go and/or products change I would merely regenerate the briefing books by updating the mapping file (or table).

    Using PBS I can retrieve the PBooks and PLibraries collections as well as the PBook and PLibrary objects and have written convenience methods to be able to retrieve these by name instead of by ID. Creation of a library within a PStore is also no problem. But now the issue is how to open the book in a ProClarity professional kind of way, manipulate the settings, and publish the result. From previous experience I know things break if you just customise the briefing book's MDX so I presume that there must be a "better" way.

    As another thought, can i "search and replace" within the XML for each report (page) within each folder within the briefing book or is this likely to break something? Basically, is there a link between what has been selected (or not selected) on the background, the MDX, slicing selections and "ProClarity specific stuff" in the XML that one should be aware of when doing this?

    Any ideas?

    Cheers,
    Phil
    Tuesday, January 22, 2008 5:05 PM

Answers

  • Okay, I think I have a little better understanding now.  Thanks.

     

    I think the fundamental issue is that a book and view are fundamentally seperate until you choose to add a view to a briefing book, at which point it turns from a view to a page in the book.  Notice the behavior of the ProClarity client.  If you open a book, choose a page, make some changes to that page, save the book, and re-open the book, the changes that were made are not shown.  After you make changes you have to explicitly choose to add the new view to the briefing book, and if you want to overwrite the existing page with your changes, you provide the same caption name and the page is overwritten.

     

    It seems that what may be happening is you open a page, make changes to it, and then expect the briefing book to be aware of the changes that have been made.  The briefing book object will have no understanding of the view until that view is saved to the book as a page.  I suspect this is why when you "addviewtobook", things seem to work (other than the annoyance of having to deal with the old page).

     

    When you call the AddViewToBook method, what happens if you provide the same caption for the new page as exists for the old page?  Does that allow you to overwrite it?

     

    Thursday, February 28, 2008 1:02 AM

All replies

  • To answer your question, I think you'll want to take a look at the KMemberSet object.

     

    However, I might suggest a less customized approach to the problem.  Have you considered useing cube security to attain this functionality?  Your "template" would simply become your book.  You would, to follow your example slice by descendants in the product hierarchy, so that without security the book would show all products in the slicer.  Then, you would set your cube security so that each user has access to only a certain product(s).  Now, when that user opens the book with all the products in the slicer, the query to the cube simply asks for all the products that particular user has access to, and so they see only "their" products in the slicer.  This essentially provides each user with a customized briefing book, but you only have to create and maintain one book, and then of course cube security.

     

    Hope that helps.

    Thursday, January 24, 2008 12:57 AM
  • Ah right, genius, thanks I'll have a look in more detail as a brief look at the documentation doesn't give me an indication how I might retrieve a KMemberSet object from a particular page in a briefing book. However, I presume that this will become self-evident when I dig a little deeper.

    With regards security, I understand the logic and this is generally my first choice. (i.e. Assign security closest to the data source and all that.) However, I must apologise for the poor example in this case then. My aim was merely to simplify the question, however, I appear to have over-simplified it.

    A long story short(er), we had an implementation of AS2000 on a 32 bit server with a dimension of over 1.3 million members. There are 440 users all of which require a view of only their members within that dimension. My choices would be to create 440 roles and assign a user per role but the replica dimensions alone would most likely cause AS to say "bye-bye, thanks for playing" and die with an OOM exception, if not straight away then as soon as we try and process. (Note: Testing in MS labs in Reading with expected workload caused the memory threshold to sit at 2.99Gb even after altering the cleaner thread to 10 seconds.) The overhead in maintaining that would also be a limiting factor. The other alternative is to use a security cube and implement cell level security but the performance hit of runtime evaluations would be too dire to even consider. (We actually tried anyway but the timeout setting for AS to evaluate the MDX across that number of dimension members caused the attempt of applying the security to fail. AS thus ignored the setting irrespective, which was a bit harsh. ) The use of 64 bit and 2005 would not be an option as this is not a standard within the infrastructure.

    Thus, other possibilities include the presentation of fixed reports (interactive RS or bursting) or lock down ProClarity for drilldown etc. and present each user with their own reports. At this stage I am just doing an investigation (but to more detail than mere hypothesis) on whether or not what I am trying to do is possible.

    I guess it would be nice to be able apply security in AS to limit connections based on the client application, but that's out of scope for this forum.

    Thanks again for your help.
    Thursday, January 24, 2008 1:31 PM
  • Okay, that makes more sense as to why you need something programmatic.  Of course what you really need is SSAS 2005 and 64-bit. 

     

    Apologies for not showing you the path from a briefing book to a kmemberset object...it is a little convoluted.  From the Application object (which is essentially the ProClarity application that is displaying the briefing book in which you're interested), grab the CurrentView property.  From there you can get the PageCtrl object.   From that object you can get the KPCommand object.  You can then use the GetAxisMemberSet method to retrieve the member set for the axis in which you're interested (row, col, or background).  Once you have the MemberSet you can add members, remove them, etc.  Then, once you've modified the member set to what you need, you'll re-execute the command, save the new view to the book, and republish the book.

     

    Let us know if you run into any trouble.

     

    Thursday, January 24, 2008 10:32 PM
  • Okay, I've pretty much got this working now. I can read in a recordset of required changes to a given template Briefing Book, apply "Search and Replace" type changes to members selected on the axes or merely overwrite the MDX with a new MDX statement etc. and the briefing book will accurately reflect those changes, to a point...

     

    What I am struggling with now, after quite a while and trying a number of ways but to no avail, is the following:

    I have done as you suggested above, effectively replacing the members on the axes based on the command from the current view and re-executed the resultant MDX. That's no problem. The KProclarityClass.Application object reflects this change within the method where the change is made. However, passing the KProclarityClass object into another method for publishing into a different library with a different name etc. results in an unchanged briefing book. On further investigation it appears that although the change is made, it isn't actually "saved". To test this, I used "CurrentView.AddViewToBook", passing in the BriefingBook object I have effectively changed. When the same KProclarityClass object is passed into the publish method I now get the original briefing book as well as the new, altered briefing book. I presume that this shows that the issue is not to do with passing by "ref" or anything but rather that the change is not being commited somehow. (Please correct me if I am wrong.)

     

    So, how do I commit a change to the current view object without republishing the current briefing book? (i.e. This is a template briefing book so I don't want to publish the change else the template will change.) I am presuming that there is a more elegant solution than "add new view and delete old"? In the meantime I'll carry on down the "add and remove" method but this is starting to get messy now with all the Elements[x].Folder.Elements.Remove() type evaluations to find for 'x'.

     

    Note:

    For anyone else trying something similar, please note that to get the KMemberSet as detailed in a previous post, you need to get the Axis first and then get the KMemberSet from that. Don't get the KMemberSet directly from the command object as this doesn't work.

     

    Cheers,

    Phil

    Tuesday, February 26, 2008 4:57 PM
  • If I'm following you, you have an existing briefing book you use as a template.  To create new briefing books you open the template book, make changes to the view(s), and then you want to be able to save the new view to a new briefing book and publish that book to a library on PAS.  Is this correct?

     

    If this is indeed the flow, you are correct that you need to save a view to a book for any changes you've made to that view to be saved permanently.  You would then publish that book to PAS to store the book.

     

    I'm assuming you've gone down the path of creating a new briefing book object, saving the current view into that new book, and then publishing the new book to PAS using the PClient2.PublishBriefingBook method, but I'm not completely clear on what's gone wrong with this or why it won't work.  Can you clear this up for me?

     

    Wednesday, February 27, 2008 12:18 AM
  • Ah right, I see the confusion. Your first paragraph is almost correct, insofar as the way I am going about this that is.

     

    I am indeed taking a template briefing book and making changes to the views based on information held in a relational database. However, I am doing this on the assumption that once the template briefing book has been loaded into an object in memory, I can manipulate this however I want without affecting the stored briefing book on the PAS server. So I load the briefing book I want, find the target page and manipulate this without writing the changes back to the PAS store. The idea is that I then create a new KProclarityClass object and connect it to another PAS store and using the associated "PESIntegration5.PClient2" object on the new ProClarity class, call the "PublishBriefingBook" method to publish the in-memory incantation of the briefing book to a different server. (i.e. Effectively open a briefing book, change it in memory and then publish it to a different server without affecting the original briefing book.)

     

    So, what I am seeing is as follows:

    • A KProClarityClass object is created in method (A).
    • The KProClarityClass object is passed into method (B).
    • Using the KProClarityClass object I retrieve the required "Page" object.
    • I retrieve the CurrentView.
    • I update the axes based on the command object from the current view's PageCtrl.
    • I call KPRefreshData() to apply the changes to the view.
    • Control is returned back to method A where the same KProClarityClass object is passed into method (C).
    • A new KProClarityClass object is created and a connection made onto a different/same PAS store.
    • Using the PES object derived from the new KProClarityClass object, I use the "PublishBriefingBook" method to publish the BriefingBook object retrieved from the KProClarityClass object passed into this method (i.e. the one that should have changed) into the library opened by the new KProClarityClass object.

    The above works fine but only if in method (B) I use "CurrentView.AddViewToBook" to duplicate the view that was changed and then delete the view that was changed (see Note below) leaving only the "duplicate" version of the view. What I don't understand is why I have to duplicate view "V1" to create view "V2" and then delete view "V1" in order to commit my changes to the briefing book. (Note: I still need to now move view "V2" into the correct place within the Elements collection to leave BriefingBook looking similar to the template version. The "Elements.MoveElement" appears to be the correct method but I am dubious as it appears to want to move elements between collections as opposed to within one.)

     

    Note:

    I have since discovered that I can potentially use "IPage.OwnerElement.ParentElement.Folder.Elements.Delete(x)" in order to delete the original view rather than enumerating the Elements collections for it. (I resolve 'x' before adding the new view on the understanding that new views are added to the end of the collection.)

     

    Cheers,

    Phil

    Wednesday, February 27, 2008 8:57 AM
  • Okay, I think I have a little better understanding now.  Thanks.

     

    I think the fundamental issue is that a book and view are fundamentally seperate until you choose to add a view to a briefing book, at which point it turns from a view to a page in the book.  Notice the behavior of the ProClarity client.  If you open a book, choose a page, make some changes to that page, save the book, and re-open the book, the changes that were made are not shown.  After you make changes you have to explicitly choose to add the new view to the briefing book, and if you want to overwrite the existing page with your changes, you provide the same caption name and the page is overwritten.

     

    It seems that what may be happening is you open a page, make changes to it, and then expect the briefing book to be aware of the changes that have been made.  The briefing book object will have no understanding of the view until that view is saved to the book as a page.  I suspect this is why when you "addviewtobook", things seem to work (other than the annoyance of having to deal with the old page).

     

    When you call the AddViewToBook method, what happens if you provide the same caption for the new page as exists for the old page?  Does that allow you to overwrite it?

     

    Thursday, February 28, 2008 1:02 AM
  • Ah, if you use "AddViewToBook" using the same caption then you get two pages within the briefing book and folder with exactly the same Caption and modified date (i.e. no way to distiguish between them) but with different contents within the page. (i.e. One page is the original page and the other is the modified version.)

     

    Note that either way, to publish the resultant book to a different library within the same PAS store requires all GUIDs for the elements within the briefing book to be reset, else an exception is thrown due to duplicate GUIDs.

     

    Anyhow, what you asked is exactly what I tried initially under the understanding that throughout the SDK it refers to the fact that using the same caption will cause the original items to be overwritten and thus I expected consistent behaviour. However, I concede that the specific documentation around the "AddViewToBook" method does not state it will be overwritten so I can't complain.

     

    I think the answer here is as you state, to add the view and delete the original page, which is a little different to the front-end (although it may well be doing this behind the scenes) but I'll live...

     

    Thanks for all your help!

    Thursday, February 28, 2008 6:21 PM
  • Hi,

    Given a .bbk file, I want to publish it to the Analytics Server (http://abc/pas).  While I know how to do this with some InterOp Dlls that come with ProClarity Desktop Professional,  I intend to do the deployment using only methods provided by the web service (http://abc/pas.wsdl) for a cleaner installer.  The WSDL has a rich set of methods using which I can create libraries, get connection information, get books, etc.  However I am unable to create a book.

    Can some one please tell me what the CreateBook function expects?
    store.CreateBook("book1", "desc", "1.0", "1.0.1.1", "PBook", "http://abc/pas", bbkstream, libraryGuid, Guid.NewGuid().ToString(), "Reserved1", "Reserved2");
    


    1.store is an object of type PStore exposed by the wsdl
    2.bbkstream is raw bytes of a sample .bbk file. What is expected here??
    3. Signature of CreateBook is
    public string CreateBook(string Caption, string Description, [System.Xml.Serialization.XmlElementAttribute(DataType="integer")] 
    string MajorVersion, [System.Xml.Serialization.XmlElementAttribute(DataType="integer")]
    string MinorVersion, string DocType, string LinkURL, object DocText, string LibraryID,
    string InsertID, string Reserved1, string Reserved2)


    Need help !
    Wednesday, March 3, 2010 8:57 AM