If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Retrieving url for XLS/CSV render

Started by PEB, 29 Jun 2017 07:47:51 AM

Previous topic - Next topic

PEB

Hi,

I am about to celebrate my first year with cognos so it is time to write my first topic on this marvelous site !

First of all I am using Cognos 10.2.2

Now my trouble :
I am currently trying to create some buttons on a report to export my report into PDF, XLS or CSV.
My main issue is that I cannot use the friendly toolbar because the users are viewing the reports throught an application based on chromium and the tool bar is hidden.

- At first I have used the SDK to create a servlet to register the file in the wanted format on the drive and then launch the proper application to open it.
It is working great but it generates the file without keeping the dimension drills that the users may do. (I don't know if there is a way to pass the drills as parameters ...)

- Then I simply tried to make the report calling itself thanks to a drill-throught with all the parameters available and changing the output format, but had the same issue : the dimensional drills were lost

- After some research I was able to find some very simple javascript function to do what I want :
<input type='Button' value="Report in PDF"  onclick="javascript:gCognosViewer.getRV().viewReport('Format that I want')">  8)

- But an other issue appeared : the application can handle very well the PDF format but not the others, so I am ending up with a new window telling me that everything is okay and that I just have to wait for the download to begin ..... and of course that never happen  :'(

- After some extra research on the code, I was able to find that the new window generate a link like : "/cognos/cgi-bin/mod2_2_cognos.dll?b_action=rc&rsid=6764&f=MUZBMEEyMjA6Mk1HMmg5cXNqMnEyTTQ0R01NTTlqZGRzZHk4aHc0cUdNTU1oNHNoTQ__&k=FAAAAATs3GyBnPmU9vowJib2kKiRiUWo*VA0ldA308cbtX-SmXeqgAbyBSU_&s=FAAAAATs3GyBnPmU9vowJib2kKiRiUWoypZBi5MlpmlOg1sEJRXYS4m*GjI_&did=1" into an iframe
And this URL gave me access "directly" to the document (I should be able with that url to register the document thanks to a servlet and then open it with javascript)
I am not a javascript/html/php guru but I have digged into cognos javascript function to understand what is done (and make a function that return the link) and have found this :
A serie of functions are called : viewReport() => viewInExcel() => viewInNewWindow() => generation of a form with various element and calling to rv/blankNewWin.html (new window) which itself submit the form to the gateway (/cognos/cgi-bin/mod2_2_cognos.dll in my case) => the url i am loonking for is generated and the file is downloaded (but not in my case)

So far what I wasn't able to understand what is going on after submitting the form so I don't know how to retrieve the URL.
My idea was to simulate the call to the gateway with a XMLHttpRequest() and look into the response, but I am outside of my competency zone here so I am a bit lost...

Finally what I need is either a way to pass the drill navigation to the SDK (to generate a report at the same state that the user's) or a button to register the converted HTML version on the drive (either directly or throught an URL)

I hope my post is clear, maybe I am missing a point here and there is a very simple solution that my troubled mind could not see ?   :o

Thanks for reading me,
PEB

CognosPaul


PEB

Hello CognosPaul,

Thanks for your reply ;)
Yes I have seen this, it was already open in one of my tab  ;D

It is working fine for PDF format since PDF is handle. But it doesn't help for Excel and CSV since they are not supported by the browser.
The function used is viewPDFInNewWindow() and it call the same function as I am already using : viewInNewWindow()

Maybe if I find a way to put some code inside the new window I would be able to do what I want.
The other solution that might work is finding a way to extract the URL generated for the iframe of the new window

I hope my explanations are not too tortuous  :-\

CognosPaul

I don't have any experience with Chromium unfortunately, I use the good ol' regular Chome.

This works for me:
<script>
CViewerManager.prototype.runExcel = function ()
{
  var oReq = new ViewerDispatcherEntry(this.getCV());
  oReq.addFormField("ui.action","render");
  oReq.addFormField("run.outputFormat","spreadsheetML");
  this.viewInNewWindowWithResize(oReq);
};

var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if (!fW || fW == undefined) {
  fW = (formWarpRequest_THIS_ ? formWarpRequest_THIS_:formWarpRequest_NS_);
}

  var preFix = "";
  if (fW.elements["cv.id"]) { preFix = fW.elements["cv.id"].value;}
  var nameSpace = "oCV" + preFix;

 

CViewerManager.prototype.viewInNewWindowWithResize = function(oReq, browserHandle)
{
var oldUnload=window.onbeforeunload;
window.onbeforeunload=null;

if (browserHandle != null) {
browserHandle.close();
}
var target = "winNAT_" + ( new Date() ).getTime();
var sPath = this.getCV().getWebContentRoot() + "/" + "rv/blankNewWin.html?cv.id=" + this.getCVId();

var sFormID = "viewForm" + this.getCVId();
var oForm = document.getElementById(sFormID);
if (oForm) {
oForm.parentNode.removeChild(oForm);
}

oForm = document.createElement("form");
oForm.setAttribute("method", "post");
oForm.setAttribute("id", sFormID);
oForm.setAttribute("action", this.getCV().getGateway());
oForm.style.display = "inline";

var oFWR = document["formWarpRequest" + this.getCVId()];
if (oFWR && oFWR["run.outputFormat"]) {
oReq.addFormField("previousFormat", oFWR["run.outputFormat"].value);
}


var formFieldNames = oReq.getFormFields().keys();
for (var index = 0; index < formFieldNames.length; index++)
{
var name = formFieldNames[index];

// we'll force the action and respons format later on so we don't indirectly send this request to the fragment server
// since we're now doing a render, don't pass along the tracking. We still need to pass the
// conversation since we want to reuse the parameters and options
if(name != "cv.responseFormat" && name != "b_action" && name != "m_tracking")
{
oForm.appendChild(createHiddenFormField(name, oReq.getFormField(name)));
}
}

oForm.appendChild(createHiddenFormField("cv.responseFormat", "page"));
oForm.appendChild(createHiddenFormField("b_action", "cognosViewer"));
oForm.appendChild(createHiddenFormField("BIline1", RV_RES.RV_RUNNING));
oForm.appendChild(createHiddenFormField("BIline2", RV_RES.RV_PLEASE_WAIT));


document.body.appendChild(oForm);
oForm.target = target;

browserHandle = window.open(sPath, target, "rv,resizable=1");

window.onbeforeunload=oldUnload;
};


</script>

<input type="button" onclick="window[nameSpace].getRV().runExcel()" value="10.2+"/>



In my test case, it generated a new window with an iframe with the following src (line breaks added by me, of couse):
/k12reporting/cgi-bin/cognos.cgi?b_action=rc
&rsid=30725
&f=MHgxMzYxYzdkMDpzaGQ4d2o0OXdsdzRzMnZsaEdNQ01kcUNHZGpkeUc4OGpsQ3M0amQy
&k=FAAAAI-By6lxKGLce*90qPYjxWdhRp2GUfuINMlNCR1Zy9DmaF57aKn6ehI_
&s=FAAAAI-By6lxKGLce*90qPYjxWdhRp2Gf3S43W5vhxCdsn-MvmcuCu*4bv4_
&did=23


Running it again, without changing anything, the iframe has this src:

/k12reporting/cgi-bin/cognos.cgi?b_action=rc
&rsid=30725
&f=MHhkZDczZjAwOnMyOXFqZHlqaENxeU1NaHMyeTk5ODg0bDQ4MnZoakNsR3MyNHd3ZHc_
&k=FAAAAI-By6lxKGLce*90qPYjxWdhRp2GcHGATrqLYkG8LLgiP9K5ZtsBGxQ_
&s=FAAAAI-By6lxKGLce*90qPYjxWdhRp2GCJOD6M1ltpYH7ANRMUGq1UopH5I_
&did=23


the f k and s parameters are different, and those appear to be the drivers. The first 32 characters in k and s are the same, so I'm guessing that's part of the report identifier.

I'm not sure what the encoding is, pretty sure it's not base64 as k decodes to:
r\JJb<Vvig먶$˂#+m


And these are the form fields that are passed to the new window and submitted. I'm not seeing a direct connection, I'm guessing it's possible

b_action - cognosViewer
cv.catchLogOnFault - true
cv.header - true
cv.id - RS
cv.responseFormat - data
cv.showFaultPage - true
cv.toolbar - true
errURL - javascript:window.close()
executionParameters - CAFS6000000100AhQAAACPwcupcShi3HvvdKj2I8VnYUadhgcAAABTSEEtMjU2IAAAAN9R-JI6kzZ-kLgMU-DYxi7sxipMdXx9v1MaydetNCwoH4sIAAAAAAAAAFWPzQqDMAyAX2V417h5K3MgY7f9gWMMxg5Vgxa0LU2d*varosJOCUm*L8k*a4lpbniDFg1t*qaWxFwx9iprNQMo8Iu10miCXJVSkQsNUF5hwwky4UYhAm8GexIr2HVd0EWBMiXswnALr8s5nTBfSLJc5ugoEswOGmMvvSV3-3Q9ssQYPiy*pbpK58WBa5PierKPCaDMVSFk6U5ZVXxUPSb935tPXrf4Dj8eHH7WTuKpAAEAAA__
m_tracking - CAFS600000017cAhQAAACPwcupcShi3HvvdKj2I8VnYUadhgcAAABTSEEtMjU2IAAAACJ6MmRDwiZmMzmpnWYmXVPkkMdQ2lQZG6gbojSX4tfEH4sIAAAAAAAAAHWRsW6DMBCG5-YpKvZiCkQFRFhSqapUT1m6EnwBR2BT7oLh7evEVUQr4sWS7-v*s8-54YxZpdUIA5YktdppRTDR09S1CjNb3XoNUZ8xJmCEVvcw*JWulUa7dQyrBroS2UFalEXM*xUnlDfRGOObyNdDzcIgeGFf-HN-1Z6lQipVBdZCmdHcw9a7cyGveHy4rPxSL49HqSTNexpA1dQs9AkzqSy9CYIgZ2vwMkiKvyrSIFXtFSlPE4FJksymwe-YcJ7OYZqk42meefx*MjzdtSI2roMUy0ylBXy8reeGkTMcs7T6QVeA*F*8viUKXsONE2-Y0rVDpDOud7Sf1LdA4HRHOtedrIy6*AGUprjvFQIAAA__
previousFormat - HTML
run.outputFormat - spreadsheetML
ui.action - render
ui.cafcontextid - CAFW000000a0Q0FGQTYwMDAwMDAwMDlBaFFBQUFDUHdjdXBjU2hpM0h2dmRLajJJOFZuWVVhZGhnY0FBQUJUU0VFdE1qVTJJQUFBQUpQZDZYTTQ4MFMxTko2eS0waEJzSlhhWkwwZDFtcHpWeE9ZcG41M2xDNk40MTYzNDN8cnY_
ui.conversation - CAFS60000011a8AhQAAACPwcupcShi3HvvdKj2I8VnYUadhgcAAABTSEEtMjU2IAAAAMnftJyF9Q31mINZS9i5UU71PZKn4QSDMJmp*3azUC08H4sIAAAAAAAAANUbaXPauvZz8itc3swdMgQMhCwl5d5HWBoaSAhL6DKdjLAFGIztWDJL7*1-f0eSbWwgCZA0vS8zHUA**6ZzJPdD1yFZy9bGyJ438IODCZVmY90gWXiQiwwotbKyrOIJ1k0L2wnF7BsmgY*xTJQBHiMidzUAlY-kiIs4I5qPOJ1OE9OjhGn35XQymZI-16pNjhbXDEKRoWDAIlqWzi2cizBZEJkbysAVJfLn-h77*8CeGGiMA8AzkiXU1ox*5E-bMZoWVrSepiCqmcYH2YMP4psWe0YCJJo3*Xq8dF3I5m0bzT35vVVfCVfRBDwmJrK4NuyLjA3FVEECUN0nhRiplq*OYPotlfnu6bL3QaN4vKQ1aHDDIS9MU8fI8IHXqh7CKBnOGEyAqWMbNw61HNoZYCM-QZqOujpesYVLcoJ0Z8mcXY83tR0Xj0P5gstM8qfUEM4TclUM*rwWQQShiBuLHaTR1sDGZGDq6hY6aIzr0U7C97GBbU3Zwg*BEHwqURTcRbJi8oCn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9riWVTqaO48lMPHXcSr3PZpLZzGni*Ozs64KDvNYOwsmskWUrJZ7yrJOpF8sSq2aBSPCAAkvs52bvb4TudkOvS0BNwczSS28VzMY6fwURqyC3eKvAB2VsLzOkknf-5Ey6cduRu7X8vCxnLKdz*7786ZrOuvlMsfPwo6yO*51K*rjeuD0hP6o2*loat74Wjo7fZ*rKBR3MMiUjczkxMleFUemybt*kz4zyER602sqnflE9ujlTUicf6fHFYH5T1qeDpn6Z7389OiLzpqJfKY467DS1W5oGQiMt1jjLtL-2M-2L23KyoJ-0qsXhQ23*pUOKA*e4rc5sNVZJ56mtGNcnKWxfyNX69fSLEbOrJ2ikDvMxOlHfHxV73bMT28JjNVZvT8e3l0k6HnZPe3JduRrIlfbwc087qsPe1E4XesmrfOxi1nHuSC9Vm4y0TuPE-jKrKKc1Wh8Ny5PLz1cPt2bxBxp9kuu0OBm3r85mFzUdFSdOWf48TN99NOtnJ3eNavK2MTsZkjG66Jz25dHX6bCPfuQHsUZz2vnYvzuepU7Bdj9q9m07dauMBvkpvvqcGp06P3pn85vb9EO*pd32Uu3GxV2h8EDHxhW2619740zXsJT0*LqZcSqdhwtSKl0d618exvnyMSTbGfrifOzFDHtYH7aqxfZtbdgYFm71s*H7eeHTwKwnlaNGpiCX*meXWqtdAJfn-A3Jjwg30LwlEWRiMfyfDv-8H29RV0yJOAAA
ui.primaryAction - runSpecification


Can you run the attached report and tell me what happens when you click the button? It doesn't automatically download the spreadsheet?

PEB

Thank you for your response,

Well your javascript is working perfectly with firefox/I.E/Google (and even Opera !)
With my application based on chromium a new window open saying that the download will begin soon and then ... nothing as usual

The following text appears on the report :
b_action - cognosViewer
cv.catchLogOnFault - true
cv.header - false
cv.id - _NS_
cv.objectPermissions - execute read setPolicy traverse write
cv.responseFormat - data
cv.showFaultPage - true
cv.toolbar - false
executionParameters - CAFS60000001bcAhQAAAAE7NxsgZz5lPb6MCYm9pCokYlFqAcAAABTSEEtMjU2IAAAACxwN-AZOGeHLPPYdECsaKog0-LiDe-6PMEyZefN106RH4sIAAAAAAAAAH2SX2vCMBTFn7dPMfpuo-Ot1IIbfRDUCZUxGHuI9aKB-CM3tfrtl7Y2RufsS0ru*Z3cc5N0U2GiqaECLBh8OQouMXGbk2hvrU4I2cIBuNJg4lLtpEK3CILlHgRFsmFOSsYkOoNHZB6s6zqux7EyO-I6HI7I12JetNiASbRUluAoZIk9aZhExcd0NciX78nUGHrq-fpdb3o*OHZlVFS37s0PAVmqLZM714q3oo3VurW-ivlJeQXfo58oe35qv5RZEEEzf9Ve*pQ2RelKgf6ICVrjTo*yfD19m8*KIl-ky3VKevE1fmgsH4R-kEC07cxcv2GA*xGQCc1hFUIB0bXCZMkrZIebOBulOFAZZdZU0MXwyluLLUPN6en*PIajjj6LbtkK-5ljzzlBEJI0KS*zJH6Y-iZDRVe-vO7sF3yy*GvuAgAA
m_tracking - CAFS6000000178AhQAAAAE7NxsgZz5lPb6MCYm9pCokYlFqAcAAABTSEEtMjU2IAAAALmlZO1z7VOKrL8OO88DwRg5s2IlA-TxyILOg2Gf-AUpH4sIAAAAAAAAAHWRsW6DMBCG5-YpKvZiktDIIMJCJVSpTFm6EriAEdiEu2B4*zpxFdGKerHk*77-7HN0umJYKDnCgDkJJRMlCSZ6mbpWYmiqB6cm6kPGShihVT0MbqEqqdBsHcOihi5HdhIGZTvm-IgTioeotXb1zlVDxbaet2Ff2efxrr0KiZTLAoyFIqS5h4Pzz4Wc*PnptqJbPT*fhRQ0H2kAWVG90CcMhTT0m*d5EVuDl0Gi-K0iDUJWTry9JDPHGRvU3OeY*U2tgyAYWz5feDr6DU9TX2eJ7SDKZaZUJXy8r*durGCRpdQPqgDEv979Kftg71vvQS1VM0K64no-80V9CwRWt6R17cnKoONvnH4FWBMCAAA_
previousFormat - HTML
run.outputFormat - spreadsheetML
ui.action - render
ui.cafcontextid - CAFW000000a0Q0FGQTYwMDAwMDAwMDlBaFFBQUFBRTdOeHNnWno1bFBiNk1DWW05cENva1lsRnFBY0FB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oJpsUGjkHwPp2-OTnyFpEPO4dMD7pgL**VUP5k9qsWaE95X0T*buqD7CdXOlNwb4nu8yboZ6Vgy0cITm6bi-0f4XYYhCiCtud6RQl*3zgs2tb*IYCv9Ldz6ggeBhiWAQZPv2r-5eN-9qR-TfE-NR4Z6vajxJGZjiSrqWbVMT0Ob8x5qzLiarf*vDmqh4nIl5gyrCedbipclxukMxn4pnA9VNp0rT3getLtTbM0XVkUDXtMRamrrdUAsInI*TLX8roRM7fMm6XaWfl1RW8Bz7Dc9bVW08vuuHoRRmhQNzxuhjust*zF4WBYGy8yju7V4qR5owUmHHWiTHSMwXA4T2S8uBtp69lNVCvZ8eQmXRpeJrhRQ1NG2TjTK7Pr*VRyvTt2DqIJ7oZ33vJWTxsUU1qV1bktTJxKI6wPJC4NkdlksKmvS4NRe8D6dKOKRUu5A1LzojMKTPrGMnouWEPUR6JXXgLTmlDqWFfM9ZI1o3gk1tqsFwXs6lZoY9yCWcXt0dWEbk7iG66-vGiuF8vbKmgkfgu0Rxf6kNdvOlYJwsoYmJJlIqdhNpJOZ1JK1FAJFCPxb1EmzaiGAi5asM8lQhfC6lC*iLmuITiLTO86sonEDr12ZqRpwAPTgEP1bjFchnFkMq05y2Lg1jpoxoY6tCrNSQsg8WYis7raUbJxZCBz3FqPp3NMy0rirgR52piHSt20mmY46K9Tmq-NedX3ZxjoHa9rAykcdy9QDOZ*lfbHc9221WljOLTcRFmue5Jr06t1vdKuV5VhL*Wz2XVmr5V21m-V11mrEd6WJqXWqMkOU0NTBZDxazzToL0OlroQ3DYuxGDeaVSrdndyvZouWxPNWhtjumdMvBQLQVBqpoJcajq*nlghf*uH-W7YrY9LtIHLLb6zLM3Sa5*uD4yWKskyZXvj*VpWif9bI6umpqqaBz51FPlFsu*XimTa3gBHg*CX-wI1uDMs5h4AAA__
ui.object - /content/folder[@name='Report']/folder[@name='report']/folder[@name='Stat report']/report[@name="report"]
ui.objectClass - report
ui.primaryAction - run


I am not allowed to access to the code of the new window with chromium so I can't read the URL in it's Iframe, but with Chrome for exemple, when I use the URL given into a new tab, it gives me access to the file. Does it work for you too ?
Do you know if there is a way to save the current report with the wanted format into the drive ? I might be able to reach it in that case.

As for the link between the form parameters and the s,f,k parameters of the URL, I don't think there is a direct connection between them.
My guess is that the Cognos dll uses the form parameters to generate the file and then it gives it a temporary identifier with the s,f,k parameters (one of the parameters given to the dll is a timestamp).
Plus it seems that the URL generated by one browser doesn't work for another one and it doesn't last long, so I would guess that cookies are involved.

It is a very specific need so thanks a lot for the time you spent on it as I'm not sure it would help a lot of people ..

CognosPaul

My guess is that when you submit the request with the form fields, the response should contain the correct values. Maybe you can encapsulate that.

Is your Cognos hooked up to SMTP? I wrote a solution that triggers the "email the report" screen. They could then have Cognos email it in whatever format they want. '

PEB

I agree, but so far I haven't succeed.
Yes my Cognos have a SMTP (but no in my developpment environnement ...), it's a good idea and it might work but seems not very interactive. I keep it in mind as a back-up plan
I was wondering about saving the current report as a version, then using the sdk to grab the last version of the report and then opening it. I think the javascript function to generate a version doesn't allow us to change the format but it might be possible to change that. I will try that on monday

esar

Quote from: CognosPaul on 30 Jun 2017 12:32:03 PM
My guess is that when you submit the request with the form fields, the response should contain the correct values. Maybe you can encapsulate that.

Is your Cognos hooked up to SMTP? I wrote a solution that triggers the "email the report" screen. They could then have Cognos email it in whatever format they want. '


Hi Paul,  Can you please share the solution that you have to trigger the "email the report". Can the report be triggered from prompt page taking all the parameter values from that prompt page to execute the report, and have it emailed to an email address specified in that prompt page as one of the prompt value?

Sorry for deviating from the current topic.. Apologies....

PEB

Hi esar,

I believe Paul is refering to that post http://www.cognoise.com/index.php?topic=24911.0

Maybe I am wrong since this code does not allow you to change the format ...

My current work is on stand-by due to some major crash on another part of the application, I'll keep you posted if I find a way to solve my case

CognosPaul

I could have sworn I wrote an article about this. Did I not publish it? Maybe for another blog? I can't find it anywhere!

Take a look at the attached report. Save it somewhere and run it from the connection - it won't work at all from report studio. I'm pretty certain it should export in excel.

esar

Quote from: PEB on 04 Jul 2017 10:54:48 AM
Hi esar,

I believe Paul is refering to that post http://www.cognoise.com/index.php?topic=24911.0

Maybe I am wrong since this code does not allow you to change the format ...

My current work is on stand-by due to some major crash on another part of the application, I'll keep you posted if I find a way to solve my case


The solution in the post - http://www.cognoise.com/index.php?topic=24911.0
allows one to email the report after it is run. But is it possible to submit(Finish button) the prompt page as a request to run the report and send the output as email.I want to have two buttons in prompt page where one allows me to run the report interactively, while the other one instructs the report service to email the report output by running the report on the background.

CognosPaul

The function can be set to run automatically when the page loads. Create a new prompt page that has the script. Put a render variable on the page.

On the first prompt page put a prompt in a hidden div that controls that variable, then you can have buttons that do something like:

<input type="button" onclick="
paulScripts.getControl('emailReport').setValues([{'use':'1'}]);
cognos.Report.getReport("_THIS_").sendRequest( cognos.Report.Action.NEXT);
"
value="email report"/>

<input type="button" onclick="
paulScripts.getControl('emailReport').setValues([{'use':'0'}]);
cognos.Report.getReport("_THIS_").sendRequest( cognos.Report.Action.NEXT);
"
value="run report"/>


esar

Quote from: CognosPaul on 25 Jul 2017 09:46:13 AM
The function can be set to run automatically when the page loads. Create a new prompt page that has the script. Put a render variable on the page.

On the first prompt page put a prompt in a hidden div that controls that variable, then you can have buttons that do something like:

<input type="button" onclick="
paulScripts.getControl('emailReport').setValues([{'use':'1'}]);
cognos.Report.getReport("_THIS_").sendRequest( cognos.Report.Action.NEXT);
"
value="email report"/>

<input type="button" onclick="
paulScripts.getControl('emailReport').setValues([{'use':'0'}]);
cognos.Report.getReport("_THIS_").sendRequest( cognos.Report.Action.NEXT);
"
value="run report"/>

Hi Paul,

I placed the below code in second prompt page
   
try   {window['oCV'+'_THIS_'].getRV().SendReport(false);}
catch (err) {}


First prompt page just had the next button. I ran the report and clicked next. It went to second prompt page and displayed the email report frame. When i clicked send, it gave the below error. Is it trying to email the current Prompt Page 2 page, instead of  emailing the final report page?

RSV-SRV-0001

      The request is missing the objectPath element.

     DetailsExpand
RSV-SRV-0042 Trace back:RSReportService.cpp(763): RSException: CCL_CAUGHT: RSReportService::processImpl()RSReportServiceMethod.cpp(259): RSException: CCL_RETHROW: RSReportServiceMethod::process(): reportEMail_RequestRSASyncExecutionThread.cpp(864): RSException: RSASyncExecutionThread::checkExceptionRSASyncExecutionThread.cpp(319): RSException: CCL_CAUGHT: RSASyncExecutionThread::runImpl(): reportEMail_RequestRSASyncExecutionThread.cpp(909): RSException: CCL_RETHROW: RSASyncExecutionThread::processCommand(): reportEMail_RequestExecutionContextImpl/RSReportDispositionExecutionContext.cpp(128): RSException: CCL_THROW: RSReportDispositionExecutionContext::run



CognosPaul

Are you running from Report Studio? Try running it from Connection.

PEB

Hi all,

Quote from: CognosPaul on 07 Jul 2017 09:34:12 AM
Take a look at the attached report. Save it somewhere and run it from the connection - it won't work at all from report studio. I'm pretty certain it should export in excel.

Thank you for the exemple Paul, I tried it but I can't see where you specified the format for the export ?
It is working well from connection (except that I don't receive anything since I don't have smtp configuration in my dev environment so I have an error in my export), but the log said that the format was html : Options -> Formats : HTML
If I send an e-mail with the cognos toolbar from an xml view for example, the log tell me that the format it was trying to send is XML (even if I also have an error that no deliveryservice is configured)

I will ask to add an smtp server in my environment to properly test the sending of report and avoid confusion

esar

Quote from: CognosPaul on 25 Jul 2017 02:12:00 PM
Are you running from Report Studio? Try running it from Connection.

Thanks Paul. It works fine when i run it from Cognos Connection.

Just one more question on this. Is it possible to send the email directly instead of getting the email options frame displayed in the second prompt page where you will have to click the send button again.

Thank you so much for all your help.


CognosPaul

I've been trying to find a way to do a one-click email, but I just haven't found a decent one. It may be possible to hide the email frame and programmatically click on the send button, but that might cause problems down the line.

PEB, the format is defined in the report expression HTML Item:

'<script>
CViewerManager.prototype.SendReport2 = function(bWaitPage){
  var bContinueConversation = !bWaitPage;
  var formFields = {"m":"portal/viewer-email.xts"};
  formFields["run.continueConversation"] = bContinueConversation;
  formFields["ui.routingServerGroup"] = this.getRoutingServerGroup();
  formFields["run.outputFormat"] = "spreadsheetML";
  formFields["email_to"] = "'+[user email]+'";
  cvLoadDialog(this.getCV(), formFields, 800, 550, RV_RES.IDS_JS_EMAIL_REPORT_IFRAME_TITLE);
  };

if(typeof oReq ==="undefined") oReq = new ViewerDispatcherEntry(window["oCV"+"_THIS_"].getRV().getCV());

window["oCV"+"_THIS_"].getRV().SendReport2(true);


var executeBackURL =function(){
var p = document.getElementById(''CMODAL_BK'').parentNode;

p.removeChild(document.getElementById(''CMODAL_BK''));
p.removeChild(document.getElementById(''CMODAL_TAB_LOOP_BEFORE''));
p.removeChild(document.getElementById(''CMODAL_FRAME''));
p.removeChild(document.getElementById(''CMODAL_AFTER_PLACEHOLDER''));
p.removeChild(document.getElementById(''CMODAL_TAB_LOOP_AFTER''));
p.removeChild(document.getElementById(''CMODAL_BK_IFRAME''));

}
</script>'


Where it says formFields["run.outputFormat"] = "spreadsheetML"; that is Excel. Try changing that to XML or PDF.

PEB

#17
 :o I must have read the script a thousand times and I haven't seen that part... Thank you Paul !

Edit : I was able to test it with a real smtp server and it doesn't work, it keeps sending me HTML format
I thought it was because the cvLoadDialog function was re-writting the run.outputFormat :
"if(typeof _d56.rvMainWnd!="undefined"){
_d60.appendChild(createHiddenFormField("run.outputFormat",_d56.rvMainWnd.getCurrentFormat()));
}"


I tried to force the current format :
"CViewerManager.prototype.SendReport2 = function(_342,_345){       
var _343=!_342;
var _344={"m":"portal/viewer-email.xts"};
_344["run.continueConversation"]=_343;
_344["run.outputFormat"] = _345;
_344["ui.routingServerGroup"]=this.getRoutingServerGroup();
this.getCV().rvMainWnd.setCurrentFormat(_345);
cvLoadDialog(this.getCV(),_344,800,550,RV_RES.IDS_JS_EMAIL_REPORT_IFRAME_TITLE);
}"
And it still send me HTML.. Yet I followed the code execution and it seems to me that the current format is indeed "PDF" or "XML" ...

Any idea why ?