COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => SDK => Topic started by: Sunchaser on 09 Mar 2009 11:17:33 AM

Title: How to get the same functionnality as ReportPath() ?
Post by: Sunchaser on 09 Mar 2009 11:17:33 AM
Hi,

I would like to know if it is possible to get the same functionnality as the layout calculation ReportPath(), in order ot use it in a QueryItem or pass the value of this function as a parameter to a query, etc ...
Anything that could "copy" this functionnality and gives me the same result, the same string of the path for cognos.

Thanks.
Regards.
vinc.
Title: Re: How to get the same functionnality as ReportPath() ?
Post by: xiska on 03 Apr 2009 05:24:46 PM
Hi,

your request is tricky but possible if it is a prompted one.

first output the reportpath to the promptpage
then add a html with the content "<input type='hidden' value='" before and a second html element with the content "'>" after the reportpath output. Also make sure that there are no format settings.
the result, interpreted by your browser is: "<input type='hidden' name="param" value='/content....'>"
now you are may facing the problem of names like "1'st reports". the single quote changes the seachpath and you need to take out or escape the single quote in order to change from "<input name="param" type='hidden' value='/content..1'st reports..'>" to "<input name="param" type='hidden' value='/content..1\'st reports....'>" in a escaped way.
By now you have variable which is not visible in the reportstudio but you can use it - you need to know that the engine is clever enough.

now one way to use regular prompts and fill them automatc:
Lets make sone steps ahead: make a block put a text - prompt inside, add a html element.
The content of the html element is a java script code which uses the already defined variables for the reportpath (you can choose the escaped or non escaped one) and put the value into the text-prompt.
looks like
<javascript>
try{
document.getElementbyName(promptname).value = Variable;
}catch...
you simply need to html of the promptpage.

for reports without a prompt - bad news.
I'm with you with your idea, but these are layout calculations (almost without calculation opportunities) and not somethng for the background so far.

this egg

Title: Re: How to get the same functionnality as ReportPath() ?
Post by: Sunchaser on 10 May 2009 12:40:18 PM
Hi Xiska,

First thank you and sorry, I didn't see there was an answer for my message (too busy the last weeks).
I'll test you idea of : " <input type='hidden' name="param" value='/content....'> ", this is a thing I have experienced for other subjects and I didn't realized I could try it for this purpose.
The more important to me is that I can pass it ( its value ) as a "real" parameter to a query.

I'll try and tell if it works as expected for me.
Thanks,
vinc.