Tuesday, April 26, 2016

Cognos picklist reports - javascript code

If user want to load file with multiple values to value prompt from desktop (local) and then select values after all values loaded into value prompt.

Browse value prompt input file in prompt page : java script - drop html item before value prompt in prompt page.

Copy and paste this script before value prompt.
Note : don't remove 123 points its within the script, entire code.
=====================================
<script>
function load()
{
var form = getFormWarpRequest();
var list1 = form._oLstChoicesABC;
var name= form.cmuds.value;
upload(list1, name);
function upload(listPrompt, fileName) {
            var objFSO, objTextFile;
            var sReadLine, exception;
            var ForReading = 1, ForWriting = 2, ForAppending = 8;
            while (listPrompt.options.length != 0) {
listPrompt.options.remove(0);}
            try{               objFSO = new ActiveXObject("Scripting.FileSystemObject");
                        objTextFile = objFSO.OpenTextFile(fileName, ForReading);
                        while (!objTextFile.AtEndOfStream) {
                                    sReadLine = objTextFile.ReadLine();
                                    listPrompt.options[listPrompt.options.length] = new Option(sReadLine, sReadLine);
}
objTextFile.close();                              
            } catch (exception) {
                        alert("Invalid file name" + fileName);
            }
}}
</script>
1- Click "Browse" to select text file required:<br>
<input type=file name="cmuds"><br><br>
2- Click "Open File" to load data:
<input type=button onClick="load()" value="Open File">
<br><br>
3- Select required Data Item(s) and click "Finish":<br>
=====================================

Cognos PDF report columns page breaking

PDF reports all columns not showing in 1st page its going to second page: please do pagesetup paper size : custom, define height and width more as per need.

Cognos Cross tab row header

Add cross tab header on row columns : add 1 table with two columns > create two crss tab pointing to your 1 query > in second cross tab select rows data items, cross tab corner then boxtype: none >> in 1st cross tab select columns, measures,cross tab corner then boxtype: none > 1st cross tab align to right top and second cross tab align to left top > run report its done.

Cross tab measure use text value as data iteam

Text item in crosstab measure are : Change the property *Define Contents* to '*YES*" for crosstab Fact cells.

Convert cognos drop down prompt to type in / text box prompt

Convert cognos drop down prompt to type in / text box prompt

If you wants add drop down to type in prompt use caption() : Caption([Query1].[SR_AREA])=?prompt?

Wildcard text prompt - use like in prmpt

You are not sure what user is going to enter values in prompt, so design like this way.

Wildcard text prompt: [Query1].[SR_SUB_AREA] like '%'+ ?Parameter1? + '%'