Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » how to use the validate event of parameter
how to use the validate event of parameter [message #669930] Thu, 12 May 2011 06:23 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 81
Registered: April 2011
Member
I want to validate the input date field is earlier than system date 12:00:00 am, I know there is a validate event for input parameter, but how to use this event? any example?

My birt designer version is 2.2.1

[Updated on: Thu, 12 May 2011 06:27]

Report message to a moderator

Re: how to use the validate event of parameter [message #670077 is a reply to message #669930] Thu, 12 May 2011 15:02 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Currently in BIRT the validate function throws an error if the function
returns a false statement:

if( paramval == notwhatitshouldbe ){
false;
}else{
true;
}

Generally the error is not very useful so you may just want to set a
variable in the validate parameter and use it in the report to forward.
Take a look at the attached report for an example.

Jason


<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.22"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.6.1.v20100902 Build &lt;2.6.1.v20100915-1750></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="myparm" id="7">
<method
name="validate"><![CDATA[//importPackage(Packages.javax.servlet);
//does not work

if( params["myparm"].value == "forward" ){
//reportContext.getHttpServletRequest().getRequestDispatcher ( "error/parmerror.jsp").forward(
reportContext.getHttpServletRequest(), null);
reportContext.setGlobalVariable("forw", true);
true;
}else{
reportContext.setGlobalVariable("forw", false);
true;

}

]]></method>
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="distinct">true</property>
<property name="paramType">simple</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<text id="8">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<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>]]></text-property>
</text>
</body>
</report>


On 5/12/2011 2:23 AM, forums-noreply@eclipse.org wrote:
> I want to validate the input date field is earlier than
> system date 12:00:00 am, I know there is a validate event
> for input parameter, but how to use this event? any
> example?
Previous Topic:Problem with input parameters like ?
Next Topic:Page N of M
Goto Forum:
  


Current Time: Fri Apr 19 14:29:41 GMT 2024

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

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

Back to the top