Custom Search

Wednesday, June 18, 2008

upcoming blog topics

Real estate
World Tour
New Mobile Technologies
Provisions of current Financial Year for Income Tax saving

Tuesday, June 10, 2008

Cognos 8- Java script for removing query item name from value prompts

In Cognos 8, when value prompts are used, query item name comes at first, then a dotted line and then values start.

If user doesn't want to see the query item name and dotted line, it can be removed by using Java script.

To achieve this follow below steps-

1. Insert an HTML item just before the value prompt.

2. Write in HTML item. (Here "sample_span" is the id of the
span which can be changed.

3. Insert another HTML item just after the value prompt.

4. Write
in it. (It is actually the closing tag of the previous HTML tag.)

5. Now insert another HTML item in the footer of the prompt page.

6. Write following Java Script in it

var theSample = document.getElementById("sample_span");

// Replace "sample_span" by the id given in step 2.

var theSelectSample = theSample.getElementsByTagName("select");

theSelectSample[0].remove(0);

theSelectSample[0].remove(0);

//2 removes are used to remove query item name and dotted line from value
//prompt

Cognos 8- Java Script for Date Validation

If data range needs to be passed for any Report studio report, 2 date prompts are required.
If user should not be allowed to 'Run' the report if period begin date is greater than period end date, then follow below listed steps.

Steps-


1. Give name 'txt_o_b_dt' to the date prompt which belong to period begin date.
(Shown in italics in below java script)

2. Give name 'txt_o_e_dt' to the date prompt which belong to period end date.
(Shown in italics in below java script)

3. Drag an HTML item to the footer of the prompt page.

4. Paste below java script in to that.


var bgn_dt= new Date(document.formWarpRequest.txtDatetxt_o_b_dt.value);

var end_dt= new Date(document.formWarpRequest.txtDatetxt_o_e_dt.value);

if (bgn_dt>end_dt)

alert("End date should be greater than Begin date.");

else
{
promptButtonFinish();
}

Here values from the date prompts(those are of string type) are converted into date type and stored in 2 variables- bgn_dt and end_dt.

If bgn_dt>end_dt and user clicks on Finish or Next button, he will get a message box saying that selection is wrong.

Only after making right selection he will be allowed to run the report or move to the next page.