Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Bonsoir,
Je reviens avec une nouvelle question... Voici un exemple de MAIN_COURANTE auquel j'ai à faire:
| MAIN_DATE_DEBUT | MAIN_USER | MAIN_TYPE | MAIN_TYPE_LIBELLE | MAIN_COMMENTAIRE |
| 30/06/2022 21:51:25 | 26677015 | 102 | Mise en dossier | - |
| 30/06/2022 21:53:35 | 26677015 | 551 | Affichage post-it | - |
| 30/06/2022 21:53:37 | 26677015 | 551 | Affichage post-it | - |
| 30/06/2022 21:53:39 | 26677015 | 551 | Affichage post-it | - |
| 30/06/2022 21:53:40 | 26677015 | 551 | Affichage post-it | - |
| 30/06/2022 21:54:26 | 26677015 | 557 | Téléphonie entrante | 232523136, Durée de communication de l'appel:474 (en secondes) |
| 30/06/2022 21:54:38 | 26677015 | 103 | Commentaire opérateur | AE cliente : Pense qu'on l'a appeler / avisée mdp ok |
| 30/06/2022 21:54:44 | 26677015 | 101 | Acquittement alarme | BAppel téléphonique entrant |
Je cherche à créer dans ce tableau un champ "DUREE" qui contiendrait différentes durées selon le MAIN_TYPE du tableau ci-dessus.
Par exemple comme le montre l'exemple ci-dessus selon les MAIN_TYPE j'aurai dans "DUREE" des valeurs différentes:
SI MAIN_TYPE = 551 alors DUREE = 00:00:02
Si MAIN_TYPE = 557 alors DUREE = Extraire le nombre de secondes de MAIN_COMMENTAIRE (déjà réussi)
SI MAIN_TYPE = 103 alors DUREE = nombre de caractère du champs MAIN_COMMENTAIRE / 4 (en secondes)
SI MAIN_TYPE.... etc
AUTRE = 00:00:00
Ce qui me donnerait en résultant quelque chose comme cela:
| MAIN_DATE_DEBUT | MAIN_USER | MAIN_TYPE | MAIN_TYPE_LIBELLE | MAIN_COMMENTAIRE | DUREE |
| 30/06/2022 21:51:25 | 26677015 | 102 | Mise en dossier | - | 00:00:00 |
| 30/06/2022 21:53:35 | 26677015 | 551 | Affichage post-it | - | 00:00:02 |
| 30/06/2022 21:53:37 | 26677015 | 551 | Affichage post-it | - | 00:00:02 |
| 30/06/2022 21:53:39 | 26677015 | 551 | Affichage post-it | - | 00:00:02 |
| 30/06/2022 21:53:40 | 26677015 | 551 | Affichage post-it | - | 00:00:02 |
| 30/06/2022 21:54:26 | 26677015 | 557 | Téléphonie entrante | 232523136, Durée de communication de l'appel:474 (en secondes) | 00:07:54 |
| 30/06/2022 21:54:38 | 26677015 | 103 | Commentaire opérateur | AE cliente : Pense qu'on l'a appeler / avisée mdp ok | 00:00:15 |
| 30/06/2022 21:54:44 | 26677015 | 101 | Acquittement alarme | BAppel téléphonique entrant | 00:00:00 |
Ma question est de savoir comment cela serait-il envisageable à mettre en place directement dans le script? en imbriquant plusieurs if?
J'ai déjà essayé pas mal de choses mais je ne tombe pour l'instant pas sur le résultat souhaité....
Merci de votre aide. Et j'espère pouvoir rapidement venir en aide aux autres sur QlikSense...
Bonne soirée,
Etienne
temp:
load
timestamp#(MAIN_DATE_DEBUT,'DD/MM/YYYY hh:mm:ss') as MAIN_DATE_DEBUT
,MAIN_USER
,MAIN_TYPE
,MAIN_TYPE_LIBELLE
,MAIN_COMMENT
,TextBetween(MAIN_COMMENT,'time:','(in') as seconds
inline [
MAIN_DATE_DEBUT,MAIN_USER,MAIN_TYPE,MAIN_TYPE_LIBELLE,MAIN_COMMENT
30/06/2022 21:51:25,26677015,102,Filing,-
30/06/2022 21:53:35,26677015,551,Affichage post-it,-
30/06/2022 21:53:37,26677015,551,Affichage post-it,-
30/06/2022 21:53:39,26677015,551,Affichage post-it,-
30/06/2022 21:53:40,26677015,551,Affichage post-it,-
30/06/2022 21:54:26,26677015,557,Incoming telephony,232523136 Call talk time:474 (in seconds)
30/06/2022 21:54:38,26677015,103,Operator comment,AE client: Thinks we called/notified mdp ok
30/06/2022 21:54:44,26677015,101,Alarm acknowledgment,BIncoming phone call
];
NoConcatenate
fact:
Load *
,pick(Wildmatch(MAIN_TYPE,'102','551','557','103','101')
,interval(0,'H:mm:ss')
,interval(2/(24*60*60),'H:mm:ss')
,interval(trim(TextBetween(MAIN_COMMENT,'time:','(in seconds)'))/(24*60*60),'H:mm:ss')
,interval(len(MAIN_COMMENT)/4/(24*60*60),'H:mm:ss')
//,interval(MAIN_DATE_DEBUT-peek('MAIN_DATE_DEBUT'),'H:mm:ss')
,interval(0,'H:mm:ss') ) as Duration
Resident temp
Order by MAIN_USER,MAIN_DATE_DEBUT ASC;
drop table temp;
temp:
load
timestamp#(MAIN_DATE_DEBUT,'DD/MM/YYYY hh:mm:ss') as MAIN_DATE_DEBUT
,MAIN_USER
,MAIN_TYPE
,MAIN_TYPE_LIBELLE
,MAIN_COMMENT
,TextBetween(MAIN_COMMENT,'time:','(in') as seconds
inline [
MAIN_DATE_DEBUT,MAIN_USER,MAIN_TYPE,MAIN_TYPE_LIBELLE,MAIN_COMMENT
30/06/2022 21:51:25,26677015,102,Filing,-
30/06/2022 21:53:35,26677015,551,Affichage post-it,-
30/06/2022 21:53:37,26677015,551,Affichage post-it,-
30/06/2022 21:53:39,26677015,551,Affichage post-it,-
30/06/2022 21:53:40,26677015,551,Affichage post-it,-
30/06/2022 21:54:26,26677015,557,Incoming telephony,232523136 Call talk time:474 (in seconds)
30/06/2022 21:54:38,26677015,103,Operator comment,AE client: Thinks we called/notified mdp ok
30/06/2022 21:54:44,26677015,101,Alarm acknowledgment,BIncoming phone call
];
NoConcatenate
fact:
Load *
,pick(Wildmatch(MAIN_TYPE,'102','551','557','103','101')
,interval(0,'H:mm:ss')
,interval(2/(24*60*60),'H:mm:ss')
,interval(trim(TextBetween(MAIN_COMMENT,'time:','(in seconds)'))/(24*60*60),'H:mm:ss')
,interval(len(MAIN_COMMENT)/4/(24*60*60),'H:mm:ss')
//,interval(MAIN_DATE_DEBUT-peek('MAIN_DATE_DEBUT'),'H:mm:ss')
,interval(0,'H:mm:ss') ) as Duration
Resident temp
Order by MAIN_USER,MAIN_DATE_DEBUT ASC;
drop table temp;
Merci beaucoup cela fonctionne parfaitement 😁.
Etienne