Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Validate input parameter in script
Validate input parameter in script [message #363455] Tue, 24 June 2008 13:12 Go to next message
Lars Johansson is currently offline Lars JohanssonFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

A discussion arose around input parameters in BIRT and how to validate
them. I've tried to use scripting for this as it seems to be a good idea.
However, no success as yet.

I selected one parameter in the data explorer view, chose script tab, made
sure it read validate in the Script combo box. From documentation I read
that this function is supposed to return a boolean value.

Neither returning boolean values worked, nor doing simple variable
assignments. There are some suggestions / a few links on the web but I
haven't found concrete examples or how-to.

Anyone familiar with using Javascript or similar to validate input
parameter in BIRT?


Best regards
Lars

(BIRT all in one, 2.3RC3)
Re: Validate input parameter in script [message #363457 is a reply to message #363455] Tue, 24 June 2008 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: loic_malassis.yahoo.fr

Hello

I have been investigating to reach a somehow similar objective.

I came up with this solution:
1) Calling an event handler at the initialize time of the report
2) Recuperate the parameters
3) Call any verification functionI want using java
4) Decide what to do based on the result of this function

I came up with a solution for parts 1), 2) and 3) and I am expecting help
on the part 4).

Maybe this could be of some help to you.

If you wish, give a look at my post, ant is eventual follow-ups.

http://www.eclipse.org/newsportal/article.php?id=28829&g roup=eclipse.birt#28829

Best regards

Loic
Re: Validate input parameter in script [message #363476 is a reply to message #363457] Wed, 25 June 2008 08:04 Go to previous messageGo to next message
Lars Johansson is currently offline Lars JohanssonFriend
Messages: 18
Registered: July 2009
Junior Member
Thanks for the reply. I'm not sure the above reply helps me. I have to
catch up on reading about event handlers though. I'll investigate more.

Scenario:

when running a report, the parameter dialog is shown. After providing
content in the various fields, one clicks the Ok button to run the report.
What I would like to do is to validate user input here. If ok, go on. If
not ok, stop report work and present parameter dialog again. If possible
with a message.

Any experience with parameter dialog box and scripting?
Any example with Javascript and validate function?
-
Essentially have a gatekeeper between the parameter dialog box and the
running of the report.

Best regards
Lars
Re: Validate input parameter in script [message #363520 is a reply to message #363476] Thu, 26 June 2008 07:04 Go to previous messageGo to next message
Lars Johansson is currently offline Lars JohanssonFriend
Messages: 18
Registered: July 2009
Junior Member
I read about event handling,
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.p hp. Possible
to implement event handler in Java using scriptapi.jar in a new Java
project.

However, there doesn't seem to be anything about parameters or the
parameter dialog in the various event adapters in scriptapi.jar. Which
makes me wonder if event handler is a possible way forward.

An entry by Scott Rosenbaum about client-side expressions to validate
parameters: https://bugs.eclipse.org/bugs/show_bug.cgi?id=132883.

So it's back to the original post.

Is it possible to validate input in the parameter dialog?

Best regards
Lars
Re: Validate input parameter in script [message #553743 is a reply to message #363455] Wed, 18 August 2010 16:36 Go to previous messageGo to next message
Emily  is currently offline Emily Friend
Messages: 1
Registered: August 2010
Junior Member
Any update on this thread?

I have my report worked fine in the birt designer (2.5.1), but not after uploading in an application hosted by AIX (tomcat)
I use JNDI URL date source connection inthe application.

The report can handle smaller dataset, will break when the resultset becoming largeer.

Thanks,
Re: Validate input parameter in script [message #695634 is a reply to message #363457] Tue, 12 July 2011 08:05 Go to previous messageGo to next message
arlene86  is currently offline arlene86 Friend
Messages: 6
Registered: July 2011
Junior Member
Hi..

I need some help here..
I'm using BIRT 2.6.1..i have created one parameter with data type = String and display type = textBox. How to validate the paramater using validate event even though the parameter value is null (which means the radio button with Null Value is checked)?


thanks,
Arlene
Re: Validate input parameter in script [message #695852 is a reply to message #695634] Tue, 12 July 2011 16:43 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

I'm not sure I'm understanding completely. You want to validate a value in the textbox even though the null value radio button is selected? Is this the case? Or do you want to validate the null value? Let me know.

Michael

BIRT Evangelist on
http://www.birt-exchange.org


Michael

Developer Evangelist, Silanis
Re: Validate input parameter in script [message #696087 is a reply to message #695852] Wed, 13 July 2011 08:50 Go to previous messageGo to next message
arlene86  is currently offline arlene86 Friend
Messages: 6
Registered: July 2011
Junior Member
thanks for reply...

I want to validate the null value. If parameter with display type = textbox and isRequired = false, the parameter page will display Null Value radio button below the textbox.
As what i can see, when i checked the radio button (Null Value), parameter is not validated.

thanks,
arlene

[Updated on: Wed, 13 July 2011 08:51]

Report message to a moderator

Re: Validate input parameter in script [message #696291 is a reply to message #695634] Wed, 13 July 2011 16:02 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The validate script needs to return true or false. False will launch
the validation failure error. Do something like:

if( params["myparm"].value != whateveryouarechecking ){
true;
}else{
false;
}

Jason

On 7/12/2011 4:05 AM, arlene86 wrote:
> Hi..
>
> I need some help here..
> I'm using BIRT 2.6.1..i have created one parameter with data type =
> String and display type = textBox. How to validate the paramater using
> validate event even though the parameter value is null (which means the
> radio button with Null Value is checked)?
>
>
> thanks,
> Arlene
Re: Validate input parameter in script [message #696444 is a reply to message #696291] Thu, 14 July 2011 01:04 Go to previous messageGo to next message
arlene86  is currently offline arlene86 Friend
Messages: 6
Registered: July 2011
Junior Member
Hi Jason,

I still got a problem.When i checked the Null Value, i don't get any error message.
I want to allow blank for the input parameter but disallow null. How to do something like this? i'm using BIRT 2.6.1.


Thanks,
Arlene

Re: Validate input parameter in script [message #698051 is a reply to message #696444] Mon, 18 July 2011 16:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

It looks like the validate event is not being called if the parameter
value is null. Can you log a bug for this? You could check in the
beforeFactory and then add a script tag in a text element to forward to
another location:
//beforeFactory script:

if( params["NewParameter"].value == null ){
reportContext.setGlobalVariable("forw", true);
}else{
reportContext.setGlobalVariable("forw", false);
}

//Text element with type set to html
<script type="text/javascript">


function forward() {
if( <VALUE-OF>reportContext.getGlobalVariable("forw");</VALUE-OF>){
var temp = new String(location.href);
//var detailReport =
"nameofreportcontainingerrormessageyouwanttodisplay.rptdesign";
//var TargetURL = temp.replace(/forwarddetail.rptdesign/, detailReport);
//location.replace(TargetURL);

location.replace("http://www.google.com");
return false;
}
}
forward();
</script>

Jason

On 7/13/2011 9:04 PM, arlene86 wrote:
> Hi Jason,
>
> I still got a problem.When i checked the Null Value, i don't get any
> error message.
> I want to allow blank for the input parameter but disallow null. How to
> do something like this? i'm using BIRT 2.6.1.
>
>
> Thanks,
> Arlene
>
>
Re: Validate input parameter in script [message #699699 is a reply to message #698051] Fri, 22 July 2011 06:31 Go to previous message
arlene86  is currently offline arlene86 Friend
Messages: 6
Registered: July 2011
Junior Member
thanks jason..

I added script in beforeFactory and it works...
thanks alot..

arlene
Previous Topic:Can not load the report query: 160. Errors occurred when generating the report document for the repo
Next Topic:RCP Birt Designer and Database Server running SSL
Goto Forum:
  


Current Time: Thu Mar 28 22:04:30 GMT 2024

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

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

Back to the top