Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Write parameter values to a text file
ajunuthula
Hi,
We need to write the parameter values to a text file.
Can anyone please help us here.
Thank you.
Find more posts tagged with
Comments
pricher
Hi,
You can adapt the attached example to suit your needs. Look at the different methods overridden at the report level.
Hope this helps,
P.
ajunuthula
Thank you so much for the reply, it helps.
Now is there a way that I can load the saved parameter values from the text file into the parameter(parameter console).
Thank you,
Aparna J
ajunuthula
To save the parameter values to a text file works from the script, but can I make it work when clicked on a button?
pricher
Hi,
The example I sent you is designed to work from the server side. The script in the initialize method makes use of the Java IO package, which is not available if you run the script from the client side.
If you want to execute the script from the client side from an HTML button, and still write the log file to the server, you will be better off writing a server-side servlet that will be called from the client side, but will write the file to the server. When calling the servlet, you could pass the report parameter value as a servlet parameter.
If you want to execute the script from the client side and still write the log file on the client machine, you will have to find another way than Java Io to write to the client.
P.
ajunuthula
Hi,
I can create the text file when clicked on a button using the code as below:
<head>
<script language="javascript">
function WriteToFile(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.CreateTextFile("C:\\Test.txt", true);
s.WriteLine(params["Author#1"]);
s.Close();
}</script>
<input type="button" value="Save" onclick="WriteToFile()"
But I cannot write the value of the parameter author#1 to the file.
Is the syntax "s.WriteLine(params["Author#1"])" correct?
Thank you.
pricher
In a text item, the correct syntax to get the value of a parameter is:
s.WriteLine("<VALUE-OF>params["Author#1"].value</VALUE-OF>");
P.
birtprofi
Hello guys,<br />
<br />
I need your help. I would like to save the information of a JavaScript Variable "output" as text file. For this I use following scripts:<br />
<br />
On Scripts - Report Design - intialize I set my variable output:<br />
(reportContext.setPersistentGlobalVariable("output","sample text");<br />
<br />
On Scripts - Report Design - <strong class='bbc'>after Render</strong> I set my log file:<br />
importPackage(Packages.java.io);<br />
var log = new FileWriter("c:\\" + params["Datei"] + ".p", true);<br />
<strong class='bbc'><span class='bbc_underline'>log.write(output);</span></strong><br />
log.flush();<br />
reportContext.setGlobalVariable("logWriter", log);<br />
<br />
<br />
but If I run the report with the Browser the log file will be created and the file contains "sample text" but not the text from variable "output".<br />
<br />
So I guess, I have to set the script for the log file on another position in the report, because I think the variable "output" is not generated or is already deleted.<br />
<br />
please give me your ideas.<br />
<br />
P.S. (If I run the report via designer then the log file contains the information of the variable "output"<br />
<br />
see also atached file. (at the time there is a uploed failure)<br />
<br />
best regards
birtprofi
any idea?