Skip to main content



      Home
Home » Archived » BIRT » Obtain Script var to pass a java var
Obtain Script var to pass a java var [message #74880] Fri, 16 September 2005 10:20 Go to next message
Eclipse UserFriend
Hello group,
How can i obtain the value of javascript var like row.colName and then pass
this value to a java var?

Thanks
Re: Obtain Script var to pass a java var [message #74934 is a reply to message #74880] Fri, 16 September 2005 11:36 Go to previous messageGo to next message
Eclipse UserFriend
You should be able to pass it in normally.
like if my class is Car and it takes a String parameter in the constructor.

var test = new Packages.com.acme.auto.Car( row["colName"] );

Jason Weathersby
BIRT PMC

"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgekb4$l13$1@news.eclipse.org...
> Hello group,
> How can i obtain the value of javascript var like row.colName and then
> pass this value to a java var?
>
> Thanks
>
Re: Obtain Script var to pass a java var [message #74956 is a reply to message #74934] Fri, 16 September 2005 11:59 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, but maybe you can help me with my problem.

I have a column that return html code and i need that report can display the
result of the html, (not the html code).

Iam doing the report programatically.
Iam using Birt 1.0.1

Thanks for your help.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75101 is a reply to message #74956] Fri, 16 September 2005 14:18 Go to previous messageGo to next message
Eclipse UserFriend
Andres,

I dont think thats going to be possible without changing the source for
BIRT.
There is code in BIRT to specifically convert < and > to display equivalent.
The reason for this is probally because, the data could cause problems for
the HTML output.

The function I believe is getEscapedStr in the HTMLWriter.java. If you have
to have this you may consider building your own BIRT and replacing this
call.

Jason Weathersby
BIRT PMC

"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgeq4q$t4o$1@news.eclipse.org...
> Thanks, but maybe you can help me with my problem.
>
> I have a column that return html code and i need that report can display
> the
> result of the html, (not the html code).
>
> Iam doing the report programatically.
> Iam using Birt 1.0.1
>
> Thanks for your help.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75135 is a reply to message #75101] Fri, 16 September 2005 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Ok Jason,
Then do you suggest modify the class HTMLWriter?

Can you give me a clue with respect what i need to modify?

Thanks.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75168 is a reply to message #75135] Fri, 16 September 2005 15:43 Go to previous messageGo to next message
Eclipse UserFriend
Andres,

There may be other ways of doing this, but you could modify
the getEscapedStr and comment the function out and return String s
that is passed in. I cant recomend this approach, because any changes in
the
future will require you to do this again.

Jason Weathersby
BIRT PMC

"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgf4td$bst$1@news.eclipse.org...
> Ok Jason,
> Then do you suggest modify the class HTMLWriter?
>
> Can you give me a clue with respect what i need to modify?
>
> Thanks.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75202 is a reply to message #75168] Fri, 16 September 2005 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Ok jason, I agree with you,
I thought other possible way but i dont know how to get it, i need to get
the column value and save it in a java var, but this must be done in the
class where i built the report.
Having the value stored in java var later i pass this value in the:
TextItemHandle tH = factory.newTextItem("");
th.setContent(valueStored);

What do you think?, Will be possible?

Thanks for help me, really i need to solve this problem because many data
are stored at format html, but this data must be displayed without code
html.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75252 is a reply to message #75202] Fri, 16 September 2005 17:32 Go to previous messageGo to next message
Eclipse UserFriend
Andres,

If valueStored has < or > they will be replaced I believe with &lt etc.
I believe the call getEscapedStr gets called later.

Jason Weathersby
BIRT PMC




"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgf8cg$gge$1@news.eclipse.org...
> Ok jason, I agree with you,
> I thought other possible way but i dont know how to get it, i need to get
> the column value and save it in a java var, but this must be done in the
> class where i built the report.
> Having the value stored in java var later i pass this value in the:
> TextItemHandle tH = factory.newTextItem("");
> th.setContent(valueStored);
>
> What do you think?, Will be possible?
>
> Thanks for help me, really i need to solve this problem because many data
> are stored at format html, but this data must be displayed without code
> html.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75269 is a reply to message #75252] Fri, 16 September 2005 17:43 Go to previous messageGo to next message
Eclipse UserFriend
Ok, lets see if i undertand you, the characters < or > from the data
obtained must be replaced by &lt etc, at runtime?

Having these data replaced should it be able to display in the report
without any problem?

Thanks for your time.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75493 is a reply to message #75269] Mon, 19 September 2005 09:55 Go to previous messageGo to next message
Eclipse UserFriend
Andres,
The html writer does this so it can display < or > in the output and the
browser want interpret the code. This is main problem you are having. I
believe using the engine is not going to fix this for you.

Jason Weathersby
BIRT PMC

"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgfe9s$nn9$1@news.eclipse.org...
> Ok, lets see if i undertand you, the characters < or > from the data
> obtained must be replaced by &lt etc, at runtime?
>
> Having these data replaced should it be able to display in the report
> without any problem?
>
> Thanks for your time.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75525 is a reply to message #75493] Mon, 19 September 2005 10:07 Go to previous messageGo to next message
Eclipse UserFriend
Ok jason, then i want try another option like iterate the resultset and
manually create the rows, but i have a problem i dont know how to get the
resultset from dataset (DatasetHandle object).

Thanks

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75573 is a reply to message #75525] Mon, 19 September 2005 12:02 Go to previous messageGo to next message
Eclipse UserFriend
Andres
Are you trying to get each row and then strip out the html?
If so take a look at the scripting reference in the help and look for the
Class DataRow under Understanding the data classes.
Jason Weathersby
BIRT PMC
"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgmgo3$cdu$1@news.eclipse.org...
> Ok jason, then i want try another option like iterate the resultset and
> manually create the rows, but i have a problem i dont know how to get the
> resultset from dataset (DatasetHandle object).
>
> Thanks
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75608 is a reply to message #75573] Mon, 19 September 2005 12:52 Go to previous messageGo to next message
Eclipse UserFriend
Jason
But I need the resultset like an java object, all the values i need will
store them into vars java.
Javascript is not useful for my problem by that i asked the way to obtain
the resultset or the values to be stored into java vars.


"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75644 is a reply to message #75608] Mon, 19 September 2005 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Andres,
I have a question into the developers on this. One other quick question
though.
Is the intent to get the rowset and rip out the html in them?
One other idea, may be to develop your own data control that does not call
the getEscapedStr
function. It could be identical in behavior as a data control, except for
that function. Look at the rotated text control for an example if this
sounds like something that would do what you want.

Jason Weathersby
BIRT PMC

"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgmqd2$rf6$1@news.eclipse.org...
> Jason
> But I need the resultset like an java object, all the values i need will
> store them into vars java.
> Javascript is not useful for my problem by that i asked the way to obtain
> the resultset or the values to be stored into java vars.
>
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75678 is a reply to message #75644] Mon, 19 September 2005 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Jason,
All that I want is display the value of data that was stored at html format
but not the tags.

For example, I use jdbc connection and all the process until to get the
resultset, I iterate the resultset, get the value of some columns and pass
the value as parameter into the TextItemHandle.seValueExpr(parameter) and
this works.

By that i want to know how to get the resultset as jdbc resultset. I want
try this method because i dont want to modify or create something in BIRT.

Is posible to get it ?

Thanks.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75953 is a reply to message #75644] Tue, 20 September 2005 12:03 Go to previous messageGo to next message
Eclipse UserFriend
Jason, I changed the class HTMLWriter and comment the function as you told
me before, but this change not works, the errors were the sames.

The text that the report try to display are:
<P align=center><STRONG><EM><FONT style="BACKGROUND-COLOR: #ffff33"
color=#ff0000>Test Document </FONT></EM></STRONG></P>
-----------------------------
There are errors on the report page:
+ There are error(s) in TextData:textData

I use the class TextData,
TextDataHandle dataHandle = factory.newTextData("textData");
dataHandle.setContentType("html");
dataHandle.setValueExpr("row[\"textFormat\"]");

I thought that the purpose of this class will fix my problem.

What do you think?

Really help me, i dont find other way.

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #75999 is a reply to message #75953] Tue, 20 September 2005 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Andres,

I just added a <b> </b> in my sample data. I then opened the
HTMLWriter.java file and
went to the function and changed to something like this.
protected String getEscapedStr( String s, boolean whitespace)
{
return(s);
/* comment everything else out */
}

Obviously this is not elegant, but when I ran it through the debugger this
worked.
Once you have changed the source and it is built you will need replace the
or.eclipse.birt.report.engine.emitter.html package with the the new one that
you have just created.

Jason Weathersby
BIRT PMC


"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgpbs5$bhg$1@news.eclipse.org...
> Jason, I changed the class HTMLWriter and comment the function as you told
> me before, but this change not works, the errors were the sames.
>
> The text that the report try to display are:
> <P align=center><STRONG><EM><FONT style="BACKGROUND-COLOR: #ffff33"
> color=#ff0000>Test Document </FONT></EM></STRONG></P>
> -----------------------------
> There are errors on the report page:
> + There are error(s) in TextData:textData
>
> I use the class TextData,
> TextDataHandle dataHandle = factory.newTextData("textData");
> dataHandle.setContentType("html");
> dataHandle.setValueExpr("row[\"textFormat\"]");
>
> I thought that the purpose of this class will fix my problem.
>
> What do you think?
>
> Really help me, i dont find other way.
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #76045 is a reply to message #75999] Tue, 20 September 2005 15:24 Go to previous messageGo to next message
Eclipse UserFriend
Jason, please give me an answer for this question, how i to get the jdbc
resultset from datasethandle?

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #76091 is a reply to message #76045] Wed, 21 September 2005 00:04 Go to previous messageGo to next message
Eclipse UserFriend
Andres,
I dont see a way of getting the rowset this way.
I am checking with the developers, but I dont think this is possible.
It is possible within the javascript objects to get the rows though.
Jason Weathersby
BIRT PMC
"Andres Gomez" <andresfelipegomezm@hotmail.com> wrote in message
news:dgpnld$t48$1@news.eclipse.org...
> Jason, please give me an answer for this question, how i to get the jdbc
> resultset from datasethandle?
>
> "Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #76320 is a reply to message #76091] Wed, 21 September 2005 16:34 Go to previous messageGo to next message
Eclipse UserFriend
Jason,
Is possible pass the javascript object of resultset to java object?,
Because if i have the object with all the data i can use TextItemHandle and
the html will be interpreted.

Andres

"Jason Weathersby" <jweathersby@actuate.com> escribi
Re: Obtain Script var to pass a java var [message #77482 is a reply to message #76320] Wed, 28 September 2005 09:56 Go to previous message
Eclipse UserFriend
Jason, In conclusion is posible or not make it?

What is the function of ItemDataHandle??

Thanks

"Andres Gomez" <andresfelipegomezm@hotmail.com> escribi
Previous Topic:Chart with GROUPING KEY and INCOMPLETE data
Next Topic:scripting with rows[]
Goto Forum:
  


Current Time: Thu Jul 17 19:41:57 EDT 2025

Powered by FUDForum. Page generated in 0.49347 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top