Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

Document generation for Jira enables you to perform common manipulations on sequential data. You can group, sort, and perform other sequential data manipulations in template expressions.

  • Selector stands for a lambda function returning a value and taking an enumeration item as its single argument. 
  • ComparableSelector stands for Selector returning IComparable.
  • Predicate stands for Selector returning a boolean value (true or false).
Extention methodExamples and notes

all(Predicate) 

persons.all(p => p.age < 50)

any()

persons.any()

any(Predicate)

persons.any(p => p.name == "John Smith")

average(Selector)

persons.average(p => p.age)
The input selector must return a value of any type that has predefined or user-defined addition and division operators.

concat(IEnumerable)

persons.concat(otherPersons)

An implicit reference conversion must exist between types of items of concatenated enumerations.

contains(Object)

persons.contains(otherPersons.first())

count()

persons.count()

count(Predicate)

persons.count(p => p.age > 30)
dayOfWeek

dayOfWeek(issue.created)

Human readable day of week. Ex: Monday

distinct()

persons.distinct()

first()

persons.first()

first(Predicate)

persons.first(p => p.age > 30)

firstOrDefault()

persons.firstOrDefault()

firstOrDefault(Predicate)

persons.firstOrDefault(p => p.age > 30)

formatDate

formatDate(issue.created)

will produce May/27/2019    Format can be changed on Configuration page of the app, the Date format setting.

formatDateTimeformatDateTime(issue.created)

will produce May/27/2019 10:18 AM      Format can be changed on Configuration page of the app, the Date time format setting.

groupBy(Selector)

persons.groupBy(p => p.age)

Or

persons.groupBy(
    p => new
    {
        age = p.age,
        count = p.children.Count()
    })
This method returns an enumeration of group objects. Each group has a unique key defined by the input selector and contains items of the source enumeration associated with this key. You can access the key of a group instance using the Key property. You can treat a group itself as an enumeration of items that the group contains.
indexOf()
{{foreach [issue in issues]}}{{[issue.indexOf() != 0 ? ", " : ""]}}{{[issue.issuekey]}}{{/foreach}}

Get index of element in list. Example above prints issue keys. If position of element in list not equal to zero, then comma will be printed before it.

last()

persons.last()

last(Predicate)

persons.last(p => p.age > 100)

lastOrDefault()

persons.lastOrDefault()

lastOrDefault(Predicate)

persons.lastOrDefault(p => p.age > 100)

max(ComparableSelector)

max(number1, number2)

persons.max(p => p.age)                     maximum age from the list of persons. Operates with lists

{{var [int result = max(60, seconds)]}}     maximum value of the two will be store in "result". Operates with two numbers

min(ComparableSelector)

min(number1, number2)

persons.min(p => p.age)                     minimum age from the list of persons. Operates with lists

{{var [int result = min(60, seconds)]}}     minimum value of the two will be store in "result". Operates with two numbers

orderBy(ComparableSelector)

persons.orderBy(p => p.age)

Or

persons.orderBy(p => p.age)
    .thenByDescending(p => p.name)

Or

persons.orderBy(p => p.age)
    .thenByDescending(p => p.name)
    .thenBy(p => p.children.count())

This method returns an enumeration ordered by a single key. To specify additional ordering keys, you can use the following extension methods of an ordered enumeration:

  • thenBy(ComparableSelector)
  • thenByDescending(ComparableSelector)

orderByDescending(ComparableSelector)

persons.orderByDescending(p => p.age)

Or

persons.orderByDescending(p => p.age)
    .thenByDescending(p => p.name)

Or

persons.orderByDescending(p => p.age)
    .thenByDescending(p => p.name)
    .thenBy(p => p.children.count())

See the previous note.

overtimeHours(seconds, hours)
{{[overtimeHours (numberInSeconds, 8)]}}

Prints overtime hours calculated from seconds. Second parameter, 8 in this case, stands for maximum regular hours. Everything over this number will be treated overtime.

regularHours(seconds, hours)
{{[regularHours (numberInSeconds, 8)]}}

Prints regular hours calculated from seconds. Second parameter, 8 in this case, stands for maximum regular hours. Everything over this number will be treated overtime.

single()

persons.single()

single(Predicate)

persons.single(p => p.name == "John Smith")

singleOrDefault()

persons.singleOrDefault()

singleOrDefault(Predicate)

persons.singleOrDefault(p => p.name == "John Smith")

skip(int)

persons.skip(10)

skipWhile(Predicate)

persons.skipWhile(p => p.age < 21)

sum(Selector)

persons.sum(p => p.children.count())

The input selector must return a value of any type that has a predefined or user-defined addition operator.

take(int)

persons.take(5)

takeWhile(Predicate)

persons.takeWhile(p => p.age < 50)
toHours

toHours(issue.timeSpentMilliseconds)

Converts number of seconds to hours/minutes, e.g. "3720" becomes "1h 2m"

union(IEnumerable)

persons.union(otherPersons)

An implicit reference conversion must exist between types of items of united enumerations.

weekOfYear

weekOfYear(issue.created)

Number of week in a year

where(Predicate)

persons.where(p => p.age > 18)
  • No labels