I'm thinking about this solution yet.
To avoid Cognos being a direct source of other tools, rds location is blocked in my environment by Apache directive
In meanwhile, thanks for your ideas.
Original Message:
Sent: Tue June 07, 2022 03:26 AM
From: Paul Mendelson
Subject: Custom button to run report in other outputs
That's pretty much exactly what I do in the script. If you need the display values, make sure to pass the use and display in the promptAnswers xml block.
&xmlData=<promptAnswers><promptValues><name>Product Line</name><values><item><SimplePValue><inclusive>true</inclusive><useValue>12345</useValue><displayValue>ReplaceAmpersandsWith%26amp;</displayValue></SimplePValue></item></values></promptAnswers>
Also, if all of the prompts are optional, I recommend passing a dummy parameter value. Even if all of the prompts are optional, and you're passing prompt=false, you'll still get the stupid "required parameters not provided" error.
`p_dummy=false&prompt=false&async=off&xmlData=${params.xml}`
Have you tried the script I provided above? It should do all of the things you're asking for now.
------------------------------
Paul Mendelson
Original Message:
Sent: Mon June 06, 2022 06:20 PM
From: JEAM COELHO
Subject: Custom button to run report in other outputs
Hi, Paul!
Thanks for your support! It's a pleasure to be helped by you.
So, I guess I got your point!
Using getAllPromptControls() and getValues(), I could get select values of a page and then build an URL (based on Cognos Mashup - rds) with theses values.
I think that it will work fine.
Best regards,
------------------------------
JEAM COELHO
Cognos Solution Architect
LinkedIn: https://www.linkedin.com/in/jeamcoelho/
Original Message:
Sent: Wed June 01, 2022 05:44 PM
From: Paul Mendelson
Subject: Custom button to run report in other outputs
Hey Jeam.
You are absolutely correct. The version of export report doesn't meet your needs. That being said, it now does. If one of my scripts is missing an important feature like this, let me know, I'll get it in.
I've added a new parameter "Use Prompts". If set to true, it will collect all of the prompts on the page and generate the promptAnswers based on that. If you set "Use Prompts" to an array of prompt names, it will pull the parameters only from those. So you could have three prompts on the page. "Use Prompts":true would get them all. "Use Prompts":["Prompt 1","Prompt 3"] would only get two of them.
{ "Button Icon": "fa-solid fa-file-excel", "Button Text": "", "Button Class": "myCustomClass", "Button Custom CSS": { "border": "1px solid transparent", "padding": 0, "cursor": "pointer", "font-size": "20pt", "background": "transparent" }, "Button Hover CSS": { "color": "#1D6F42!important" }, "Export Format": "Excel", "Interactive Export": false, "Server": "", "Target Report": "", "File Name": [ { "type": "reportName" }, " - Exported by ", { "type": "username" }, " - ", { "type": "date" } ], "Use Prompts": true}
- Button Icon - CogBox uses font-awesome icons. You can use any of the free icons listed here: https://fontawesome.com/search?q=file&s=solid
- Button Text - If you don't want to use an icon, just put some text in here. Icons take preference.
- Button Class - You can manually assign a class to the icon. Useful if you're using stylesheets.
- Button Custom CSS - if you're not using a style sheet, you can assign whatever CSS you want directly to the button. The style listed above is the default if the Button Custom CSS property is removed.
- Button Hover CSS - What do you want the button to look like if the user hovers over it. Again, the style in the example is the default
- Export Format - Can be excel, pdf, csv, or xml. Not case sensitive.
- Interactive Mode - True/false. In this version I've had to change the logic so it's exactly replicating a user clicking on run->excel from the menu. This will preserve interactive mode changes like sorting and filtering, but it will ignore the file name and target report settings below.
- Server - <https://servername/ibmcognos/bi/v1/disp/rds/outputFormat/searchPath/" You can safely leave this blank, it will use the hostname from the browser session. I added it for some test cases I needed to do at a client.
- Target Report - Use the search path of the desired report, if null it will use the search path of the current report. If left blank you will not be able to click the button when run from report studio.
- File Name - Uses addText syntax
addTextArray syntax:
This is an array of items that will be converted into a string. It is possible to stack static strings
with text inside a block or a text item, parameter value use/display, prompt use/display.
1. "static text"
2. {"type":"variable","name":"variable name"}
3. {"type":"text","name":"text item name"}
4. {"type":"block","name":"block name"}
5. {"type":"prompt","name":"prompt name"} returns the selected display values from the prompt
6. {"type":"promptDisplay","name":"prompt name"}
7. {"type":"promptUse","name":"prompt name"}
8. {"type":"parameter","name":"parameter name"} unlike the prompt, this is a parameter value from the report. this is more likely to reflect the current state of a report.
9. {"type":"parameterDisplay","name":"parameter name"}
10. {"type":"parameterUse","name":"parameter name"}
11. {"type":"username"}
12. {"type":"user display name"}
13. {"type":"date"}
14. {"type":"reportName"} important note! this only works when the report is run from the report page. - Use Prompts - As mentioned above. true will return all of the prompts, array of prompt names to limit to a set.
I'm probably going to do the next release later this month, so I've attached the latest exportReport here. Just replace the file in the js\controllers\Controls folder in the zip file. Also attached is a quick test report I made to confirm it's actually working.
Contact me at cognospaul@gmail.com if you need any more help with it.
BTW: It is obfuscated for legal reasons (so I'm told, it's above my pay grade).
------------------------------
Paul Mendelson
Original Message:
Sent: Tue May 31, 2022 09:51 AM
From: JEAM COELHO
Subject: Custom button to run report in other outputs
Hi, René.
Thanks for your help.
Although Cogbox export does not met my needs.
The custom control code is javacript obfuscated, but I could see that it is calling report itself by SOAP request, passing the format output parameters.
It is not my case, because report is not generated yet, I'm at prompt page. If reports has already executed, drill thru would solve.
------------------------------
JEAM COELHO
Cognos Solution Architect
LinkedIn: https://www.linkedin.com/in/jeamcoelho/
Original Message:
Sent: Tue May 31, 2022 02:20 AM
From: René Kent Nielsen
Subject: Custom button to run report in other outputs
Hi
Take a look at cogbox, in the free version you have pdf and excel export
Br
René
------------------------------
René Kent Nielsen
Brand manager
CogniTech A/S
Herning
Original Message:
Sent: Mon May 30, 2022 04:27 PM
From: JEAM COELHO
Subject: Custom button to run report in other outputs
Hi, guys!
Did anyone write a custom control that execute a report in another outputs like PDF or CSV?
My need is: in prompt page, add a "Finish" button that executes a report in CSV, PDF, or Excel.
Kind of "Finish CSV", "Finish "PDF", etc.
I don't need the entire custom control, but the method that I should call to change report output format.
For example, we have "oControlHost.next()" to submit the report or prompt page.
Drill thru does not meet my need, because in prompt page level, prompts are not passed (if the report/prompts was not submitted yet).
------------------------------
JEAM COELHO
Cognos Solution Architect
LinkedIn: https://www.linkedin.com/in/jeamcoelho/
------------------------------
#CognosAnalyticswithWatson