Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Templates

...

OfSnippet
Normal string parameter, version: 1.0+
Code Block
titleLong form
 paramConfig:
  - type: String
    id: name
    name: "Full name"
    help: "Leave blank for any"
    placeholder: "Name"
Code Block
titleShort form
  paramConfig:
  - { type: String, id: name, name: "Full name", help: "Leave blank for any", placeholder: "Name" }
Date parameter, version: 1.0+
Code Block
titleLong form
paramConfig:
  - type: Date
    id: startDate
    name: "Start On Date"
    help: ""
    placeholder: ""
Code Block
titleShort form
 paramConfig:
  - { type: Date, id: startDate, name: "Start On Date", help: "", placeholder: "" }
Date time, version: 1.0+
Code Block
titleLong form
paramConfig:
  - type: DateTime
    id: startDate
    name: "Start at"
    help: ""
    placeholder: ""
Code Block
titleShort form
 paramConfig:
  - { type: DateTime, id: startDate, name: "Start at", help: "", placeholder: "" }
Boolean parameter, version: 1.0+
Code Block
titleLong form
paramConfig:
  - type: Boolean
    name: "Select one"
    help: "Just select something"
    placeholder: "No Value"
    value:
Code Block
titleShort form
paramConfig:
  - { type: Boolean, name: "Select one", help: "Just select something", placeholder: "No Value", value: } 
Number parameter, version: 1.0+
Code Block
titleLong form
paramConfig:
  - type: Number
    name: "Enter one"
    help: "Just type a number or something"
    placeholder: "3.14"
    value:
Code Block
titleShort form
 paramConfig:
  - { type: Number, name: "Enter one", help: "Just type a number or something", placeholder: "3.14", value: }
Ordinary combo box parameter, version: 1.1+
Code Block
titleLong form
paramConfig:
  - type: Combo
    name: "Select one"
    help: "Just select anything"
    placeholder: "asdfsdaef"
    from:
      list:
        values:
          - 2012
          - 2013
          - 2014
Code Block
titleShort form
 paramConfig:
  - { type: Combo, name: "Select one", help: "Just select anything", placeholder: "asdfsdaef",  from: { list: {values: [ 2012, 2013, 2014 ] } } }
  
Multi combo box, version: 1.1+
Code Block
titleLong form
paramConfig:
  - type: ManyCombo
    name: "Select many"
    help: "You can select more than 1"
    placeholder: ""
    from:
      list:
        values:
          - c1
          - v1
          - v2

Code Block
titleShort form
  paramConfig:
  - { type: ManyCombo, name: "Select many", help: "You can select more than 1", placeholder: "",  from: { list: {values: [ c1, v1, v2 ] } } }
Combo or Multicombo box with values from an SQL query, version: 1.1+
Code Block
titleLong form
 paramConfig:
  - type: Combo
    name: "An anonymous string"
    help: "Just put anything in"
    placeholder: "asdfsdaef"
    value:
    from:
      sql:
        selectedColumn: username
        report:
          type: "JDBC"
          jdbc: "jdbc:mysql://localhost:3306/test"
          sql: "SELECT id, email, enabled, username, version FROM User <#if param.User?has_content>WHERE username=${method.value(param.User)}</#if><@limit />;"
          username: root
          password:

Combo or Multicombo box with values from a groovy script, version: 1.1+
Code Block
  - type: Combo
    name: "Month"
    help: ""
    placeholder: ""
    from:
      groovy: "result.addAll(Arrays.asList(new java.text.DateFormatSymbols().getMonths()))"
Normal String Parameter, which is required for the report to run: (1.7+)
Code Block
titleLong form
 paramConfig:
  - type: String
    id: name
    name: "Full name"
    help: "Leave blank for any"
    placeholder: "Name"
    required: true
Code Block
titleShort form
  paramConfig:
  - { type: String, id: name, name: "Full name", help: "Leave blank for any", placeholder: "Name", required: true }

Freemarker Markup

OfSnippet
Freemarker if
Code Block
<#if param.appointment>1<#else>0</#if>
for each
Code Block
SELECT date AS 'Date'
<#list ["uniqueProperty1", "uniqueProperty2", "uniqueProperty3", "uniqueProperty4"] as x>
`${x}` AS '${x}'
</#list>
FROM dynamicTable WHERE category IS NULL
<#list param.selectedValues as x>
OR category=`${x}`
</#list>
<@limit />
Switch
Code Block
SELECT invoiceNumber, invoicePrice FROM invoice WHERE
<#switch param.mode>
  <#case "Test">
    category="TE"
  <#case "Customer 1">
    category="ON"
  <#default>
    category IS NOT NULL
</#switch>

...

ToDo
Get a parameter valueparam.paramName
Insert a value into the page - not recommended, see custom functions${param.paramName}
Boolean to stringparam.paramName?string("yes", "no")
Date to string

param.paramName?string("yyyy-MM-dd HH:mm:ss zzzz"}

String to date

param.paramName?date("MM/dd/yyyy")

Trim

param.paramName?trim

Capitalize the first letterparam.paramName?cap_first
Convert to uppercaseparam.paramName?upper_case
Capitalize the first letter of every wordparam.paramName?capitialize

...