Outils pour utilisateurs

Outils du site


dse:data_query_expression_language

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
dse:data_query_expression_language [2025/03/19 13:05] – créée nicoantodse:data_query_expression_language [2025/03/19 15:14] (Version actuelle) – nicoanto
Ligne 1: Ligne 1:
 ====== Data Query / Expression Language ====== ====== Data Query / Expression Language ======
 +
 +===== Links =====
 +  * [[https://nexus.exalead.com/repository/public-site/dse-best-practice/01-BestPractices/02-DataPerspectiveStudio/02-DataQueries/04-ExpressionLanguage/01-Content/|NETVIBES Consulting - DSE Best Pratices / Expression Language]]
 +  * [[https://help.3ds.com/2025x/english/DSDoc/DaaUserMap/daa-m-appendix-expression-language-sb.htm?contextscope=cloud&id=59de7db3d7e3457485b3af4910de8979|DS Doc - Expression Language]]
 +
 +===== Examples =====
 +==== Divers ====
 +
 +<code>
 +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);
 +
 +</code>
 +
 +<code>
 +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())};
 +</code>
 +
 +====  stateful map() ====
 +
 +<code>
 +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);
 +</code>
 +
 +==== toMap ====
 +
 +<code>
 +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
 +        );
 +</code>
 +==== Map.mapValues ====
 +
 +//allDurationsByStatus// : Map<String, List<Tuple<state: String, duration: Integer>>>
 +
 +<code>
 +durationsByStatus : Map<String, Integer> =
 +    Map.mapValues(
 +        map: allDurationsByStatus
 +        , function: (list => list.sum(x => x.duration))
 +    )
 +;
 +</code>
 +
 +ou 
 +
 +<code>
 +durationsByStatus : Map<String, Integer> =
 +    allDurationsByStatus.mapValues(list => list.sum(x => x.duration));
 +</code>
  
dse/data_query_expression_language.1742389512.txt.gz · Dernière modification : (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki