Clarity

Expand all | Collapse all

MS Products as 'Reports' - Word/Excel being called from Clarity

Jump to Best Answer
  • 1.  MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-22-2016 04:39 AM

    Hello - dunno if this is possible and dunno quite what to "Google" in order to find out...

     

    I have some MS-Office things (Word documents, Excel spreadsheets) that pull data out of Clarity via web-services (Query API) - this all works OK, apart from the fact that the user has to "log into Clarity" from within the Word document and "select" the data somehow that they want to pull out (all powered by VBA macros and the web-services).

     

    My question is, is it possible to host that Word document/Excel spreadsheet somewhere (sharepoint site, random webpage) such that I can open it via a URL and provide parameters to it.

     

    I would like to construct the URL dynamically in Clarity and let users click a Clarity link to seamlessly launch Word/Excel in order to present their data (i.e. without having to prompt them in VBA for various details)

     

    ?



  • 2.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-22-2016 07:38 PM

    David,

     

    "I doubt it" sprigs to mind, basically because of the potential security issues that controlling Word/Excel by url parameters could produce. So while the Word and Excel executables will accept command line parameters (in a Windows environment) I just doubt you can send parameters whilst opening a Word/Excel file via a URL.

     

    Could "Office Online" help? ("Google Docs" but in Microsoft style) They may enable a SOA style document maybe?

     

    Few years ago I managed to work in the opposite direction, creating Word documents from within Clarity, using a third party java library (Aspose for Word). In that approach a word file is used as the template which embeds tags that the api replaces with relevant Clarity data producing a new Word document instance. Those document templates are stored as attachments in Clarity. This wasn't a trivial amount of development where I did concept design only, not the coding.



  • 3.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-31-2016 01:51 AM

    Hi Paul,

    I created somewhat same kind of API, can you please help me telling how were you able to save the new document as an attachment ?

    1. If you were using XOG for that can you please help me with that XOG file, as i am not able to save the new document as an attachment.

    2. How were you able to get the data for the dynamic query lookups, as this is something which is troubling me for a long time.

     

    I would really appreciate if you could provide me any pointers on this.



  • 4.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 02-01-2016 05:40 AM

    I no longer have access to any of that code which I did not develop; as I said previously; I designed it, that's all.

     

    The overall solution had several parts, a major component was building a solution for queries that would suit each need (this was done via custom objects) these held sql (similar, but not the same, as queries available as part of Studio). Those queries built views in the underlying dbms and through the object structure each query got its unique identity - which could then be used as a "tag" in a document. Some tags provided singular data items, some provided tables of data. A document template could then be associated to a particular data source (e.g. project) and then that template was permitted to use any available tags (queries) for that source in any way the author wanted, All of the features needed to build a workable template were standard MS Word features so anyone (with permission) could create a template. We were even able to generate documents that documented the tags to make it even simpler to use.

     

    To generate a document a Clarity process instance was initiated via manually creating a sub-object instance and choosing some values (e.g. which document template to use) then when saved the process instance was triggered. That process instance called the Aspose library via GEL and through that api a new document instance was formed, based off the relevant template. This resulted in a file which, when complete could be attached like any other file (using XOG). I don't have a sample XOG file for this I'm afraid, but there wasn't anything unusual in the XOG portion (i.e. there only so much one can do in XOG anyway :-)

     

    note: I believe we may be staying too far away from Dave's original question.



  • 5.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-23-2016 10:41 PM

    Typically the way I do this is to set up a number of templates (Excel, Word, PowerPoint) and within these templates I insert tokens that are mapped to data elements which are extracted for a given request.  Depending on the template type, there are a number of components / libraries for updating an existing MS document types (ClosedXML, POI, OpenDocument…).

     

    The typical user experience is that they click on link or toolbar menu item.  The resulting action figures out which item the user’s UI is displaying and base on the URL parameters which template to use.  The server code pull the required data from the item the user is viewing then opens up the requested template.  The code then replaces all the tokens with extracted data based on the token-data element map. Once all the processing is completed the document is stream back to the user’s browser with the correct headers to provide them with the open/save dialog.  I haven’t done this with Clarity since we are in the On-Demand environment and have no ability to install custom code. 

     

    For Clarity, I have an email request processor.  The use’s runs a job which collects the required data to fulfill their request and sends an email to a request inbox.  This inbox is monitor by a scheduled job running on a VM.  The schedule job scans for any new emails and spins up a specific template process to handle the request.  For Word/Excel type of request, the newly created document file is email back to the requested as an attachment.

     

    V/r,

    Gene



  • 6.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 04:20 AM

    Hmmmmm thanks guys.

     

    Was rather hoping for a "quick and dirty" solution for my "quick and dirty" problem

     

    Think I'll stick with "nope, not going to happen" for the people wanting it (was only a little 'internal' request).



  • 7.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 11:59 AM

    you are going to hate my reply then...



  • 8.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 11:58 AM

    Whilst Paul and Gene have come up with some incredibly innovative ways to do this, I think there maybe a simpler way.

    Have you considered using jaspersoft (or business objects) to build these documents for you?

     

    UX: user clicks report icon (in object instance), report downloads (in format specified)

    I can do this right now in 13.3 with BO and appears possible with jaspersoft (don't have time to test right now), one for a future tuesday tip?

    (the report icon is dynamic and will generate the call to the reporting server to display the report, no amendments to source files)



  • 9.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 12:24 PM

    Actually the one artefact started out as a BO report (WEBI) - and we had issues because WEBI couldn't produce a word-editable version of the artefact (only a Excel one) and then there were limitations (embedded images) in the MS versions of the artefact anyway.

     

    Time moved on, Jaspersoft turned up but I just have not had the time to experiment with that, meanwhile to get our MS format artefact we built some macro-enabled Word/Excel stuff which meant we can basically design the artefact in Word/Excel (these artefacts were replacing legacy Word/Excel documents) and populate the data from Clarity - good stuff!

     

    Its just the "usability" of the things are a bit lacking, users having to "log into Clarity" from within Word/Excel document, its all just a little bit un-satisfying (from a techy point of view) - so I was just trying to get a "quick and dirty" way to get some better integration.



  • 10.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 12:30 PM

    Yes can be a bit hit and miss with business objects exporting reports, crystal is close though. RTF format is editable.

    In jaspersoft the export of the report is "pixel perfect" so will look great.

     

    I'd still recommend the report route, with the icon linking it's a seamless experience.



  • 11.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 12:34 PM

    Don't get me started on Crystal - ugh thats a horrible exercise (we did experiment with that a bit but was neither "quick" nor "dirty")

     

    I agree you are "right" - its a report I'm after, thats just not where I'm starting from!



  • 12.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 12:44 PM

    I would disagree, crystal is a great quick and dirty tool

    just a bit of a steep learning curve!



  • 13.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-27-2016 06:33 PM

    Andrew Mowlam wrote:

     

    [the Crystal] RTF format is editable.

     

    Andrew, it was because that RTF format did not produce a true "document flow" that I needed to adopt the external java library I mentioned. The RTF produced by Crystal (when I last looked at this some years ago)  used fixed positioning of elements per page and hence only suitable for very minor edits. I needed real documents (e.g. similar to contracts) that had only some Clarity data in it but a lot of textual content, and the generated document also needed to be extensively edited by users in Word. Not all "editable formats" all equally capable of editing, if the RTF/Word export uses fixed positioning of elements it is probably unable to dynamically rearrange content over multiple pages as a "single document flow".



  • 14.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-28-2016 02:37 AM

    Yes with crystal, it's not a "real document" as such.

    If you just need to update a few text boxes then it works fine, but for extensive editing you are right it wouldn't work.

     

    Robert_Ensinger, that's got to be in the realms of possible. Like you don't have the innovation time at the moment to give it a try!



  • 15.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 02:36 PM

    Possibly a stupid question, but most places have a generic "xog user" with credentials for executing processes, etc.  Could you hard-code these into your Word/Excel templates, or set up a WSDL query to retrieve them? That would avoid the UX issue of having to log in (you may cause your security folks to have kittens, of course!)



  • 16.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-25-2016 02:54 PM

    Instead of using a generic user and wanting to stay with running VBA code, I would suggest that on the first time executing the VBA code gathers the login information and does the login.  If successful, write this information into the current user registry (encrypted if required).  Then the next time the user executes the VBA code it would first try the value saved in the registry and if successful it wouldn't need to prompt for a login otherwise re-prompt the user.

     

    V/r,

    Gene



  • 17.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-27-2016 10:34 PM

    Suuuuper late to this conversation... have only a hypothetical solution from my new, brief understanding of Jaspersoft's capability...

     

    - Jaspersoft jars are open source (simple jars available to anyone today in any Java, regardless of CA PPM version and whether or not you have Advanced Reporting installed.)

    - Jaspersoft's ability to generate a document (such as your word or excel file) is available from those jars - the input is an JXML (XML). No Jaspersoft server or infrastructure needed. The methods and functions are in the jar.

     

    Is it possible for one to create an object action or a process that one can initiate a 'create word doc using jasper jar libraries from XML data I've generated and fed to it via GEL'?

     

    Click a button (Object Action? OK - drop down, then click) - word doc is generated based on parameters from that?

     

    Dave, you didn't specify where the data needs to come from or what context it's sensitive to (projects, program, etc), or if you require user interactivity (picking parameters) - but its possible the above is possible. My brain has already jumped here (I'm gonna do GREAT things with Pentaho too!) - I just haven't had the innovation time I've needed lately to pursue these ideas.

     

    Jasper's Docx Exporter

    3rd party libs

     

    HTH



  • 18.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-28-2016 04:39 AM

    Well my existing Word/Excel process goes something like this;

     

    User opens Word/Excel document, user presses a button, VBA prompts for Clarity login and then for Clarity password.

    VBA then calls query web-service - either with a parameter picked from the spreadsheet or prompt user before the call for a "Project ID".

    VBA then calls lots of different query-web-services (dozens in fact) to pull back tons of disparate project-related data and copies the fields to relevant places in the Word Document/Excel sheet(s) (coping with multi-row blocks as well as flat-fields).

    VBA logs off Clarity (same session used for all the query-api calls)

     

    It works pretty well really, apart from the "clunkiness" of the initiation - I'd just like to 'inherit' a session and a parameter from Clarity somehow.

     

    (I could perhaps guess at a session id, using the login id of the Windows session and then grabbing an active session_id from Clarity (using a web-service call under an admin user, but unless I can pass a "project id" from Clarity to the Word/Excel document somehow I'm just not going to bother) - my hope was that since I can construct "any" URL in a NSQL portlet and then launch that URL from Clarity, I could piggy-back on that somehow....

     

     



  • 19.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-28-2016 11:39 AM

    We are doing the same in our company but avoiding a double login just in case the user is already logged into Clarity.

    In order to implement this functionality our VBA code uses OLE automation with Internet Explorer to check if the current user is logged into Clarity. You can do the same if you are able to automate your browser from VBA.

    If the user is not already logged, our VBA code shows a login form to get the username and password for Clarity.

    But If the user is already logged, we read the cookie session from Internet Explorer and send its content when making SOAP requests, so no additional login is needed. We also use this approach to get some url params from Clarity (object id, action, etc) to be able to make SOAP requests with filters automatically without user intervention. So the user perceives that after downloading an excel file from Clarity, the excel file is executed automatically downloading information from Clarity related to the screen he/she was seeing and showing corresponding data lists and charts.

    Below you can see the VBA functions we are using to get needed information from Internet Explorer (session, object id, action, etc).

    You should notice that in order to enable OLE automation with IE, your VBA project has to include references to these libraries (if I remember properly): "OLE Automation", "Microsoft Internet Controls" and "Microsoft HTML Object Library".

    VBA references.jpg

    I hope this helps:

     

    'Private Const c_urlPattern As String = "/niku/app?action="
    Private Const c_UrlPattern As String = "/niku/"
    Private Const c_AUTHCOOKIE_NAME As String = "sessionId"
    Private Const c_cookieSep As String = ";"
    Private Const c_urlparamSepsIni As String = "=:"
    Private Const c_urlparamSepEnd As String = "&"

    Private Function GetUrlparam(Curl As String, cUrlparamName As String, Optional cUrlparamSepsIni As String = c_urlparamSepsIni, Optional cUrlparamSepEnd As String = c_urlparamSepEnd) As String
    Dim nIni As Integer, nFin As Integer
       nIni = VBA.InStr(1, Curl, cUrlparamName, vbTextCompare)
       If nIni > 0 Then
           nIni = nIni + Len(cUrlparamName)
           ' comprueba si a continuación de cUrlparamName viene un carácter de cUrlparamSepsIni
           If VBA.InStr(1, cUrlparamSepsIni, VBA.Mid$(Curl, nIni, 1), vbTextCompare) > 0 Then
               nIni = nIni + 1
           End If
           nFin = VBA.InStr(nIni, Curl & cUrlparamSepEnd, cUrlparamSepEnd, vbTextCompare)
           ' si el valor es string delimitado por comillas las quitamos
           If VBA.Mid$(Curl, nIni, 1) = """" Then
               nIni = nIni + 1
               nFin = nFin - 1
           End If
           GetUrlparam = VBA.Mid$(Curl, nIni, nFin - nIni)
       Else
           GetUrlparam = ""
       End If

    End Function

    Public Function GetClarityInfo(cUrlPrefix As String, ByRef cSessionId As String, ByRef nId As Long, ByRef cAction As String, ByRef cView As String, Optional cCookieName As String = c_AUTHCOOKIE_NAME, Optional cIdParamName As String = "id") As Integer
          'find the right internet explorer webpage
          Dim allExplorerWindows As New SHDocVw.ShellWindows
          Dim IEwindow As SHDocVw.InternetExplorer
          Dim foundFlag As Boolean

    10    On Error GoTo ERROR_EXCEL
    20    Set allExplorerWindows = New SHDocVw.ShellWindows
    30    foundFlag = False

    40    For Each IEwindow In allExplorerWindows
    50        If InStr(IEwindow.LocationURL, cUrlPrefix) <> 0 Then
    60            foundFlag = True
    70            Exit For 'found the right IE window URL
    80        End If
    90    Next
    100   If Not foundFlag Then
              'DisplayBox = MsgBox("Could not find an open instance of ***." & vbNewLine & vbNewLine & " " & vbOKOnly + vbMsgBoxSetForeground, "Please try again.")
    110       GetClarityInfo = -1
    120       Exit Function
    130   End If
          'end find

        'get the session from cookie
        cSessionId = GetUrlparam(IEwindow.document.cookie, cCookieName, "=", ";")
        'get the id url param
        nId = VBA.val(GetUrlparam(IEwindow.LocationURL, cIdParamName, c_urlparamSepsIni, c_urlparamSepEnd))
        'get the action url param
        cAction = GetUrlparam(IEwindow.LocationURL, "action", c_urlparamSepsIni, c_urlparamSepEnd)
        'get the view url param
        cView = GetUrlparam(IEwindow.LocationURL, "odf_view", c_urlparamSepsIni, c_urlparamSepEnd)

    FIN:
    970   Set allExplorerWindows = Nothing
    980   Set IEwindow = Nothing
    985   GetClarityInfo = 0
    990   Exit Function

    ERROR_EXCEL:
    310   GetClarityInfo = -1
    320   If Err.Number <> 0 Then
    330       Call LogErrorToSheet("GetClarityInfo")
    340   End If
    350   Resume FIN

    End Function



  • 20.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-28-2016 11:58 AM

    I started to play around with this.  Building a simple template token replacement using Office 2003 XML formatted documents (Excel, Work). So I think the flow goes:

     

    1. A link off the PPM UI that pops open window pointing to our report HTML page with JavaScript to perform the following:
    2. Pull off the parent’s window id query value and yank the user’s session out of the PPM domain cookie.
    3. Load the XML template for the given report (with token names that match the web service response field names)
    4. Execute the XOG web services to pull the required data field values.
    5. Integrate through the XML template document replacing tokens with the matching data values keyed by the response field name.
    6. Create a new document object with the correct content type (word / excel) and load the updated XML template into it.
    7. Load the updated XML document in a new browser window object.

     

    At this point the browser should take over and ask the user to either open it in the content type associated application or save it to the user’s local hard drive.

     

    Now after reading your post this morning, I thought of another approach.  It still involves a two-step method but trades off the login for a file selection dialog box.

     

    The approach would be to develop a HTML/JavaScript page that performs the heavy lifting to pull the data values needed for a given report base on the user’s current PPM session / the id they are viewing.

    Wrap each of the XOG web service response in an overall XML document and pass that back to the user who would save it on their local hard drive.

     

    The user opens an application (MSOffice) and runs the report VBA which presents a file dialog for the wrapped XOG response XML file.  The VBA reads this XML file and processes it just like it the existing VBA is processing the XOG web services responses.

     

    Just Thoughts,

    Gene



  • 21.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-28-2016 06:14 PM

    Is it possible for one to create an object action or a process that one can initiate a 'create word doc using jasper jar libraries from XML data I've generated and fed to it via GEL'?

     

    I think it could be achievable. I previously used a "generate document" sub-object that would fire the process instance, GEL inside that process accessed a special jar that was built to access the third party library, then it merged the Clarity data with the (.doc) template and produced the new (.doc) document instance, and (in my case) it then attached that document to the object instance.

     

    So with many "miracle occurs here" caveats, it sounds feasible - very much dependent on what is in the jaspersoft jars of course and it would require a much deeper knowledge of java/gel than I posses to make it happen.



  • 22.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-29-2016 06:05 AM

    I'm using PHPWord and PHPExcel to generate Word or Excel documents with Clarity data.

    Since clarity offers the function to define URL Arguments via action menu it's very simple to implement and the document generation takes less than a second.

     

    Data passing between Clarity and PHP works with e.g. XOG (SOAP) or direct database connections for reading data.

     

    This solution has been used for e.g. project applications for over a years now and works perfect.

     

    1. The project manager enters all data into clarity.

    2. Clicks the link in the action menu.

    3. A word document get's generated.

    4. Done

     

    clarity-image.png



  • 23.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-29-2016 06:46 AM

    Thanks - will investigate that!



  • 24.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-29-2016 10:34 AM

    I am interested.  So when you define the url are you able to pass either the user login token or their currently valid session id?  I am assuming that you are able to get the project id that they are currently viewing.

     

    V/r,

    Gene



  • 25.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-29-2016 11:02 AM

    Hi Gene,

    it's very basic. For the e.g. Project Application report in Word I just use the Project Code (See image below).

     

    As soon as the user clicks on the link in the Action Menu, Clarity will generate a Instance-specific link.

    For example: http://clarityprod/projectAppl/?id=C123

     

    Based on the id that is forwarded I know which data to pull out of clarity.

    Since the report I'm using is not restricted to any user and read only, there is no need for a login token or valid session id in this case.

    Even if you need restricted user rights, you could forward the clarity session id and ask via xog if users have rights to see data.

     

    clarity-2.png



  • 26.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 01-29-2016 11:43 AM

    I guess I was hoping for some easy (hidden) method for getting either the user's session or the user's login token.  In has been a major challenge doing any seamless UI extensions to On-Demand PPM.

     

    For my application, I generate a financial spreadsheet for all the projects under a given OBS structure.  This spreadsheet can only be requested by authorized users and only for data within their OBS.  I do this today with an inbound email request processor. As I get a user's email address which I can look up and validate their authorization and OBS.  If I could pass on the user's login / session id, I could re-host this into an UI action which would be a great improvement in a user UI experience.

     

    V/r,

    Gene



  • 27.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 02-19-2016 09:56 AM

    OK so coming back to this ; if I understand what is happening, the URL that you call (the thing referenced in "Enter URL") - that is some PHP "code" which builds the word document programatically?

     

    (what I am still really looking for at the moment, is that the thing referenced in "Enter URL" is a Word document - a .docm file for example. I can create "Global Scope" links in Clarity that will open my .docm file from Clarity as an 'Action', but I want to open it in "Instance specific" mode and pass some context from Clarity. (The "Clarity-end" of my problem I know I can do, its the "Word-end" that I am a bit clueless with ))



  • 28.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity
    Best Answer

    Posted 02-19-2016 03:23 PM

    Dave,

     

    I played around with this idea as another option for our users.  Looks like it would work pretty well.

     

    So I setup an XAMPP (a PHP development environment) and downloaded the PHPWord library.

     

    So my php page looked like this (model after the template.php example in PHPWord download).

     

    <?php
    require_once 'PHPWord.php'; // The PHPWord library
    require_once 'XogQuery.php'; // A simple class for calling an NSQL
    
    $PHPWord = new PHPWord();
    $ActionQuery = new XogQuery();
    
    try {
        $ActionQuery->wsdl = 'https://cppm.ondemand.ca.com/niku/wsdl/query/mhs_all_ai?wsdl'; // The nsql query wsdl
        $session = $ActionQuery->login('admin', 'password'); // authorization to use
        $actionItems = $ActionQuery->query('mhs_all_ai'); // query code -- which I should figure out from the wsdl
        if ($actionItems == null) return; // check if we have a and records returned
        $firstRecord = $actionItems->Records->Record[0]; // I only need one record to test the template
    } catch (Exception $e) {
        die($e->getMessage());
    }
    
     // open our word document template as subsitute the token values
    $document = $PHPWord->loadTemplate('Template.docx');
    $document->setValue('Value1', $firstRecord->concatid);
    $document->setValue('Value2', $firstRecord->actionid);
    $document->setValue('Value3', $firstRecord->subject);
    $document->setValue('Value4', $firstRecord->description);
    $document->setValue('Value5', $firstRecord->actionstatus);
    $document->setValue('Value6', $firstRecord->createdby);
    $document->setValue('Value7', $firstRecord->createdby);
    $document->setValue('Value8', $firstRecord->status);
    $document->setValue('Value9', $firstRecord->type);
    $document->setValue('Value10', $firstRecord->duedate);
    $document->setValue('weekday', date('l'));
    $document->setValue('time', date('H:i'));
    
    $document->save('TestOutput.docx'); // save the word document -- would need to stream it back in the response to the end user.
    ?>
    

     

    My XogQuery class:

     

    <?php
    
    class XogQuery {
    
        var $client;
        var $activeSession;
        var $username;
        var $password;
        var $params;
        var $auth;
        var $nameSpace = 'http://www.niku.com/xog/Query';
        var $wsdl  = 'https://cppm.ondemand.ca.com/niku/wsdl/Query/NSQLQuery?wsdl';
    
        var $options = array(
        'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
        'style'=>SOAP_RPC,
        'use'=>SOAP_ENCODED,
        'soap_version'=>SOAP_1_1,
        'cache_wsdl'=>WSDL_CACHE_NONE,
        'connection_timeout'=>15,
        'trace'=>true,
        'encoding'=>'UTF-8',
        'exceptions'=>true,
        );
    
        //
        // Execute the xog login method
        //
        function login($username,$password) {
            $this->username = $username;
            $this->password = $password;
            $this->debug("logging on with $username and $password");
            $this->params = array('Username' => $username, 'Password' => $password);
    
            try {
                $soapClient = new SoapClient($this->wsdl, $this->options);
                $this->activeSession = $soapClient->Login($this->params);
                $this->client = $soapClient;
                $this->buildAuthHeader();
                return $this->activeSession;
            }
            catch(Exception $e) {
                die($e->getMessage());
            }
        }
    
        //
        // Execute the xog query method
        //
        function query($code) {
            $soapVar = new SoapVar($code, SOAP_ENC_OBJECT, '', $this->nameSpace, 'Code');
            $data =  $this->client->Query(new SoapParam($soapVar, 'Query'));
            return $data;
        }
    
        //
        // Buid the session header
        //
        private function buildAuthHeader(){
            $this->auth->SessionID = $this->activeSession;
            $authValues = new SoapVar($this->auth, SOAP_ENC_OBJECT, 'SessionID');
            $header =  new SoapHeader($this->nameSpace, "Auth", $authValues, false);
            $this->client->__setSoapHeaders(array($header));
        }
    
        function debug($text) {
            echo $text . "\n";
        }
    }
    

     

     

    So the Template.docx looks like this:

     

     

     

    The resulting TestOutput.docx looks like this:

     

     

    So in my deployment environment the URL is pointing to my XAMPP server asking for the BuildWordReport.php page.

    http://contessa:8080/TestReports/BuildWordReport.php

     

    The XogQuery class would need to be extended to handle filtering of the query result for using a url query value such as "project_id'.

     

    V/r,

    Gene

     

    If you would like, I can upload my php project as a zip.



  • 29.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 02-22-2016 03:55 AM

    Awesome Gene! - I've marked that as the "answer".    [ with to Sascha too for the original suggestion ]

     

    (however, since I only understand about 25% of the answer, its well outside my immediate "quick & dirty" requirements, so I'll just give up for now and tell anyone who is suggesting that this needs to work to me that it can't be done without giving me enough time to learn what that other 75% is all about! )



  • 30.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 12-17-2018 06:23 AM

    Is there is a Way we can read data from GEL and pass as parameter to jasperreport and upload the WORD doc in folder of clarity ?

     

    #jaspersoft #gelpredicate #file



  • 31.  Re: MS Products as 'Reports' - Word/Excel being called from Clarity

    Posted 12-17-2018 06:47 AM

    ^ You probably want to ask that as a new thread, rather than adding to an old, unrelated thread.