Information is up-to-date
Note: Jama versions prior to 8.42 will require an old version of Velocity which uses different syntax.
Report Parameters (or
Criteria) allow user-defined values to be passed into a report. An example scenario is to allow users to choose a specific Release or Test Plan to report on.
- Available parameter types can be found at
http://help.jamasoftware.com/report_parameters.htm.
- The parameters that will be passed to the report are defined when a report is created in Jama (
http://help.jamasoftware.com/adding_custom_reports.htm).
Examples of Using Parameters in Velocity CodeThese examples demonstrate using each parameter type in a Velocity report. In each case, the parameter's Name is set to "." For example, "" or "myBoolean" (the name must be a
valid Velocity variable name).
Baseline ParameterReport Code:
Value from Jama: $myBaseline (Type: $myBaseline.getClass())<br>
#set($baseline = $baselineSource.getBaseLine($mathTool.abs($myBaseline)))
Baseline object: $baseline.getName()<br>
Result:
Value from Jama: 1 (Type: class java.lang.String)
Baseline object: B1 - 01/29/2016
Boolean ParameterReport Code:
Value from Jama: $myBoolean (Type: $myBoolean.getClass())<br>
Boolean object: $myBoolean<br>
Result:
Value from Jama: true (Type: class java.lang.Boolean)
Boolean object: true
Date ParameterReport Code:
Value from Jama: $myDate (Type: $myDate.getClass())<br>
#set ($secondsFromEpoch = $mathTool.abs($myDate))
#set ($dateObject = $dateTool.toDate($secondsFromEpoch))
Date object: $dateObject<br>
Result:
Value from Jama: 1454400000000 (Type: class java.lang.String)
Date object: Tue Feb 02 00:00:00 PST 2016
Location ParameterReport Code:
Value from Jama: $myLocation (Type: $myLocation.getClass())<br>
#set($document = $documentSource.getDocument($mathTool.abs($myLocation)))
Document object: $document.getName()<br>
Result:
Value from Jama: 1758 (Type: class java.lang.String)
Document object: Business Requirements
Release ParameterReport Code:
Value from Jama: $myRelease (Type: $myRelease.getClass())<br>
#set($release = $releaseSource.getRelease($mathTool.abs($myRelease)))
Release object: $release.getName()<br>
Result:
Value from Jama: 37 (Type: class java.lang.String)
Release object: Spring 2016 release
Review ParameterReport Code:
Value from Jama: $myReview (Type: $myReview.getClass())<br>
#set($review = $reviewSource.getReview($mathTool.abs($myReview)))
Review object: $review.getName()<br>
Result:
Value from Jama: 1 (Type: class java.lang.String)
Review object: Set: Business Requirements
String ParameterReport Code:
Value from Jama: $myString (Type: $myString.getClass())<br>
String object: $myString<br>
Result:
Value from Jama: test (Type: class java.lang.String)
String object: test
Test Plan ParameterReport Code:
Value from Jama: $myTestplan (Type: $myTestplan.getClass())<br>
#set($testPlanDao = $applicationContext.getBean("testPlanDao"))
#set($testPlan = $testPlanDao.getTestPlan($mathTool.abs($myTestplan)))
TestPlan object: $testPlan.getName()<br>
Result:
Value from Jama: 1850 (Type: class java.lang.String)
TestPlan object: Spring 2016 Test Plan
Questions and AnswersQ: Can I Have More Than One Parameter of a Given Type?
A: Yes, just make sure the Name is different for each parameter.
Q: Do I Have to Name the Variables ""?
A: No, though it is a good idea to have some kind of naming convention. The name must be a
valid Velocity variable name.
#tutorial #velocity