Outils pour utilisateurs

Outils du site


dse:data_query_expression_language

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())};

stateful map()

snapshotTuples : List<Tuple<week: String, current: String>> = 
    $Year_Weeks
        .map(
            initialState: issue.current
            , updateState: (x, previousState) => transitionsMap[x].current IS NOT NULL?transitionsMap[x].current:previousState
            , function: (x, currentState) => {week:x, current:x>=originatedWeek?currentState:NULL}
        )
        .filter(x => x.current IS NOT NULL);

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.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki