Outils pour utilisateurs

Outils du site


dse:data_query_expression_language

Ceci est une ancienne révision du document !


Data Query / Expression Language

Examples

Divers

transitionTuples : List<Tuple<event: String, datetime: DateTime, current: String>> = 
    List.range(startInclusive: 0, endExclusive: issue._history_event.length, step: 1 )
        .map(index => issue._history_event[index] IN ["create", "promote","demote"]? 
            {event:issue._history_event[index], datetime:issue._history_time[index],current:issue._history_state[index]}
            :NULL
        ).filter(x => x IS NOT NULL);
durationsByTransition : List<Tuple<state: String, duration: Integer>> =
    List.range(startInclusive: 1, endExclusive: transitionTuples.length, step: 1 )
        .map(index =>{state: transitionTuples[index - 1].current, duration: Date.daysBetween(start: transitionTuples[index - 1].datetime, end: transitionTuples[index].datetime)})
    + {state: transitionTuples[transitionTuples.length - 1].current, duration:Date.daysBetween(start: transitionTuples[transitionTuples.length - 1].datetime, end: Date.today())};

toMap

transitionsMap : Map<String, Tuple<event: String, datetime: DateTime, current: String>> =
    List.range(startInclusive: 0, endExclusive: issue._history_event.length, step: 1 )
        .map(index => issue._history_event[index] IN ["create", "promote","demote"]?
            {event: issue._history_event[index], datetime:issue._history_time[index], current: issue._history_state[index]}
            :NULL)
        .filter(x => x IS NOT NULL)
        .toMap(
            keyFunction: x => Date.format(date: x.datetime, format:"yyyy_ww")
            , valueFunction: x => x
        );

Map.mapValues

allDurationsByStatus : Map<String, List<Tuple<state: String, duration: Integer»>

durationsByStatus : Map<String, Integer> =
    Map.mapValues(
        map: allDurationsByStatus
        , function: (list => list.sum(x => x.duration))
    )
;

ou

durationsByStatus : Map<String, Integer> =
    allDurationsByStatus.mapValues(list => list.sum(x => x.duration));
dse/data_query_expression_language.1742397075.txt.gz · Dernière modification : (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki