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 5 Next »

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.

last()

persons.last()

last(Predicate)

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

lastOrDefault()

persons.lastOrDefault()

lastOrDefault(Predicate)

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

max(ComparableSelector)

persons.max(p => p.age)

min(ComparableSelector)

persons.min(p => p.aage)

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.

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