Bonjour à tous,

J'ai un fichier xml comme ci-dessous :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<configs>
<groups/>
<projects>
<project name="ETLTasks" version="5.1" modified="1417645720512" modifiedBy="" format="strict">
<headers>
<header name="comment" modified="1394702840960" modifiedBy="">
<comment>
<![CDATA[
Automated tasks for OLAP Server: - CubeCopy - CubeRulesCalc - CubeAnonymize - DatabaseBackup - DatabaseRestore - DatabaseCopy - DatabaseSave - DatabaseAnonymize - CreateOlap - RulesReplace - UpdateElementType - PopulateCube
]]>
</comment>
</header>
</headers>
<variables>
<variable name="SourceConn" modified="1394706494827" modifiedBy="">
<default>localhost_static</default>
</variable>
<variable name="SourceDB" modified="1417643556259" modifiedBy="">
<comment/>
<default>Caisse</default>
</variable>
<variable name="TargetConn" modified="1394706494827" modifiedBy="">
<default>localhost_static</default>
</variable>
<variable name="TargetDB" modified="1412795451370" modifiedBy="">
<comment/>
<default>Caisse</default>
</variable>
<variable name="FilePath" modified="1394706494827" modifiedBy="">
<default>.</default>
</variable>
<variable name="FileName" modified="1394706494827" modifiedBy="">
<comment/>
<default>Test.csv</default>
</variable>
<variable name="Cube" modified="1417643718803" modifiedBy="">
<comment/>
<default>Saisie_Caisse</default>
</variable>
<variable name="TargetCube" modified="1394706494827" modifiedBy="">
<default>SalesCopy</default>
</variable>
<variable name="Dimension" modified="1417643554902" modifiedBy="">
<comment/>
<default>Tiers</default>
</variable>
<variable name="RegExp" modified="1394706494827" modifiedBy="">
<default>Desktop Pro</default>
</variable>
<variable name="Replacement" modified="1394706494827" modifiedBy="">
<default>Desktop L</default>
</variable>
<variable name="TargetElementType" modified="1394706494827" modifiedBy="">
<default>N</default>
</variable>
<variable name="NumericLocale" modified="1394706494827" modifiedBy="">
<default>GERMAN</default>
</variable>
<variable name="NumberOfCells" modified="1394706494827" modifiedBy="">
<default>100</default>
</variable>
<variable name="Delimiter" modified="1394706494827" modifiedBy="">
<default>;</default>
</variable>
<variable name="_cellType" modified="1394706494827" modifiedBy="">
<default>only_string</default>
</variable>
<variable name="_elementType" modified="1394706494827" modifiedBy="">
<default>S</default>
</variable>
<variable name="_SourceRef" modified="1394706494827" modifiedBy="">
<default>Cube_Extract</default>
</variable>
<variable name="_Count" modified="1394706494827" modifiedBy="">
<default>0</default>
</variable>
</variables>
<connections>
<connection name="OlapSource" type="JedoxGlobal" modified="1394706494827" modifiedBy="">
<globalReference>${SourceConn}</globalReference>
<database>${SourceDB}</database>
<comment>
<![CDATA[
Reference to Jedox source connection defined in Connection Manager. Only Connections which don't use user credentials are allowed.
]]>
</comment>
</connection>
<connection name="OlapTarget" type="JedoxGlobal" modified="1394706494827" modifiedBy="">
<globalReference>${TargetConn}</globalReference>
<database>${TargetDB}</database>
<comment>
<![CDATA[
Reference to Jedox target connection defined in Connection Manager. Only Connections which don't use user credentials are allowed.
]]>
</comment>
</connection>
<connection name="DimFile" type="File" modified="1394706494827" modifiedBy="">
<database>${FilePath}\\${Dimension}.DIMENSION.TXT</database>
<header>true</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="DimFiles" type="Directory" modified="1394706494827" modifiedBy="">
<database>${FilePath}</database>
<pattern>.DIMENSION.TXT$</pattern>
<header>false</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="CubeFile" type="File" modified="1394706494827" modifiedBy="">
<database>${FilePath}\\${Cube}.CUBE.TXT</database>
<header>true</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="CubeFiles" type="Directory" modified="1394706494827" modifiedBy="">
<database>${FilePath}</database>
<pattern>.CUBE.TXT$</pattern>
<header>true</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="RuleFile" type="File" modified="1394706494827" modifiedBy="">
<database>${FilePath}\\${Cube}.RULE.TXT</database>
<header>true</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="RuleFiles" type="Directory" modified="1394706494827" modifiedBy="">
<database>${FilePath}</database>
<pattern>.RULE.TXT$</pattern>
<header>true</header>
<delimiter>${Delimiter}</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="GenericFile" type="File" modified="1394706494827" modifiedBy="">
<database>${FilePath}\\${FileName}</database>
<header>true</header>
<delimiter>;</delimiter>
<quote>"</quote>
<encoding>UTF-8</encoding>
<enableEscape>false</enableEscape>
</connection>
<connection name="Excel_file" type="ExcelFile" modified="1386070193188" modifiedBy="">
<database>${FileName}</database>
</connection>
</connections>
<extracts>
<extract name="DimFiles_Extract" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="DimFiles"/>
<query>
<selector>files</selector>
</query>
</extract>
<extract name="RuleFiles_Extract" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="RuleFiles"/>
<query>
<selector>files</selector>
</query>
</extract>
<extract name="CubeFiles_Extract" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="CubeFiles"/>
<query>
<selector>files</selector>
</query>
</extract>
<extract name="Dimension_Extract" type="Dimension" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<dimension name="${Dimension}"/>
</query>
<withAttributes>false</withAttributes>
</extract>
<extract name="Dimension_Filter_Extract" type="Dimension" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<dimension name="${Dimension}">
<condition operator="like" value="${RegExp}" mode="onlyNodes" type="accept"/>
</dimension>
</query>
<withAttributes>false</withAttributes>
</extract>
<extract name="Cube_Slice_Extract" type="CubeSlice" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query randomPaths="true" mode="generateBases">
<cube name="${Cube}" valuename="Value" fixValue="#random(-1000,1000)"/>
<dimensions/>
</query>
</extract>
<extract name="Cube_Extract" type="Cube" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query useRules="false" ignoreEmptyCells="true" onlyBasisAsDefault="true" celltype="both">
<cube name="${Cube}"/>
</query>
</extract>
<extract name="CubeRulesCalc_Extract" type="Cube" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query useRules="true" ignoreEmptyCells="true" onlyBasisAsDefault="true" celltype="both">
<cube name="${Cube}"/>
</query>
</extract>
<extract name="Rule_Extract" type="Rule" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<cube name="${Cube}"/>
</extract>
<extract name="DimFile_Extract" type="File" modified="1394706494827" modifiedBy="">
<connection nameref="DimFile"/>
<columns>3</columns>
</extract>
<extract name="CubeFile_Extract" type="File" modified="1394706494827" modifiedBy="">
<connection nameref="CubeFile"/>
</extract>
<extract name="RuleFile_Extract" type="File" modified="1394706494827" modifiedBy="">
<connection nameref="RuleFile"/>
</extract>
<extract name="Cubes" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<selector>cube</selector>
<filters>
<filter name="mask" value="11101"/>
</filters>
</query>
</extract>
<extract name="Dimensions" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<selector>dimension</selector>
<filters>
<filter name="mask" value="1101"/>
</filters>
</query>
</extract>
<extract name="NormalDimensions" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<selector>dimension</selector>
<filters>
<filter name="mask" value="1000"/>
</filters>
</query>
</extract>
<extract name="DimensionCubes" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query>
<selector>cube</selector>
<filters>
<filter name="mask" value="11101"/>
<filter name="dimension" value="${Dimension}"/>
</filters>
</query>
</extract>
<extract name="Cube_Type_Extract" type="Cube" modified="1394706494827" modifiedBy="">
<connection nameref="OlapSource"/>
<query useRules="false" ignoreEmptyCells="true" onlyBasisAsDefault="true" celltype="${_cellType}">
<cube name="${Cube}" valuename="Value"/>
<dimensions>
<dimension name="${Dimension}">
<condition operator="like" value="${RegExp}" mode="onlyNodes" type="accept"/>
</dimension>
</dimensions>
</query>
</extract>
<extract name="GenericFile_Extract" type="File" modified="1394706494827" modifiedBy="">
<connection nameref="GenericFile"/>
</extract>
<extract name="GenericFile_Columns" type="Metadata" modified="1394706494827" modifiedBy="">
<connection nameref="GenericFile"/>
<query>
<selector>columns</selector>
</query>
</extract>
</extracts>
<transforms>
<transform name="Cube_Slice_Transform" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Cube_Slice_Extract"/>
</sources>
<end>${NumberOfCells}</end>
</transform>
<transform name="DimensionCubes_T1" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="DimensionCubes"/>
</sources>
<target>
<coordinates>
<coordinate name="Cube">
<input nameref="Name"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="Dim_TreeNC_Transform" type="TreeNC" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="DimFile_Extract"/>
</sources>
<target>
<type>
<input nameref=":type"/>
</type>
<element>
<input nameref=":element"/>
</element>
<weight>
<input nameref=":weight"/>
</weight>
</target>
</transform>
<transform name="Cube_Anonymize" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Cube_Extract"/>
</sources>
<functions>
<function name="#Value" type="Groovy">
<inputs>
<input nameref="#Value"/>
</inputs>
<parameters>
<script>
<![CDATA[
if (_input1==null || _input1.isEmpty()) { return ""; }; if (_input1.isDouble()) { if (_input1.toDouble() >= 0) return 1000*Math.random(); else return -1000*Math.random(); }; return 1000000*Math.random();
]]>
</script>
</parameters>
</function>
</functions>
</transform>
<transform name="Cubes_T1" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Cubes"/>
</sources>
<sorter>
<input nameref="isNormalCube" order="desc"/>
</sorter>
</transform>
<transform name="DimFiles_T1" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="DimFiles_Extract"/>
</sources>
<sorter>
<input nameref="Filename" order="desc"/>
</sorter>
</transform>
<transform name="CubeFiles_T1" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="CubeFiles_Extract"/>
</sources>
<sorter>
<input nameref="Filename" order="desc"/>
</sorter>
</transform>
<transform name="Dimensions_T1" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Dimensions"/>
</sources>
<sorter>
<input nameref="isNormalDimension" order="desc"/>
<input nameref="Id" order="asc"/>
</sorter>
</transform>
<transform name="Dimensions_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Dimensions_T1"/>
</sources>
<target>
<coordinates>
<coordinate name="Dimension">
<input nameref="Name"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="Cubes_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Cubes_T1"/>
</sources>
<target>
<coordinates>
<coordinate name="Cube">
<input nameref="Name"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="DimFiles_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="DimFiles_T1"/>
</sources>
<functions>
<function name="Dimension" type="Replace">
<inputs>
<input nameref="Filename"/>
</inputs>
<parameters>
<regexp>.DIMENSION.TXT</regexp>
</parameters>
</function>
</functions>
<target>
<coordinates>
<coordinate name="Dimension">
<input nameref="Dimension"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="CubeFiles_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="CubeFiles_T1"/>
</sources>
<functions>
<function name="Cube" type="Replace">
<inputs>
<input nameref="Filename"/>
</inputs>
<parameters>
<regexp>.CUBE.TXT</regexp>
</parameters>
</function>
</functions>
<target>
<coordinates>
<coordinate name="Cube">
<input nameref="Cube"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="RuleFiles_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="RuleFiles_Extract"/>
</sources>
<functions>
<function name="Cube" type="Replace">
<inputs>
<input nameref="Filename"/>
</inputs>
<parameters>
<regexp>.RULE.TXT</regexp>
</parameters>
</function>
</functions>
<target>
<coordinates>
<coordinate name="Cube">
<input nameref="Cube"/>
</coordinate>
</coordinates>
</target>
</transform>
<transform name="NormalDimensions_T2" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="NormalDimensions"/>
</sources>
<target>
<coordinates>
<coordinate name="Dimension">
<input nameref="Name"/>
</coordinate>
<coordinate name="_Count">
<input nameref="_Count"/>
</coordinate>
</coordinates>
</target>
<functions>
<function name="_Count" type="RowNumber"/>
</functions>
</transform>
<transform name="Dimension_Anonym_T1" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Dimension_Extract" format="ea"/>
</sources>
<target>
<coordinates>
<coordinate name="OldName">
<input nameref=":element"/>
</coordinate>
<coordinate name="NewName">
<input nameref="NewName"/>
</coordinate>
</coordinates>
</target>
<functions>
<function name="RowNumber" type="RowNumber"/>
<function name="NewName" type="Concatenation">
<inputs>
<input nameref="RowNumber"/>
</inputs>
<parameters>
<template>D${_Count} E#{RowNumber}</template>
</parameters>
</function>
</functions>
</transform>
<transform name="Rule_Replace" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Rule_Extract"/>
</sources>
<target>
<coordinates>
<coordinate name="NewDefinition">
<input nameref="NewDefinition"/>
</coordinate>
<coordinate name="NewComment">
<input nameref="NewComment"/>
</coordinate>
<coordinate name="ExternID">
<input nameref="ExternID"/>
</coordinate>
<coordinate name="Timestamp">
<input nameref="Timestamp"/>
</coordinate>
</coordinates>
</target>
<functions>
<function name="NewDefinition" type="Replace">
<inputs>
<input nameref="Definition"/>
</inputs>
<parameters>
<regexp>${RegExp}</regexp>
<replacement>${Replacement}</replacement>
</parameters>
</function>
<function name="NewComment" type="Replace">
<inputs>
<input nameref="Comment"/>
</inputs>
<parameters>
<regexp>${RegExp}</regexp>
<replacement>${Replacement}</replacement>
</parameters>
</function>
</functions>
</transform>
<transform name="ElementTypeTransform" type="TableView" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="Dimension_Filter_Extract" format="ncw"/>
</sources>
<filter>
<input nameref=":type">
<condition operator="equal" value="${_elementType}" type="accept"/>
</input>
</filter>
</transform>
<transform name="CubeFile_Transform" type="FieldTransform" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="CubeFile_Extract"/>
</sources>
<functions>
<function name="Value" type="Groovy">
<inputs>
<input nameref="Value"/>
</inputs>
<parameters>
<script>
<![CDATA[
import java.text.*; try{ if(${TargetElementType}.equals("S")){ return _input1; }; NumberFormat formatter = NumberFormat.getInstance(Locale.${NumericLocale}); return formatter.parse(_input1); } catch(Exception e){ return _input1; }
]]>
</script>
</parameters>
</function>
</functions>
</transform>
<transform name="GenericDimension_Tree" type="TreeFH" modified="1394706494827" modifiedBy="">
<sources>
<source nameref="GenericFile_Extract"/>
</sources>
<target type="numeric">
<levels>
<level>
<input constant="All ${Dimension}"/>
</level>
<level>
<input nameref="${Dimension}"/>
</level>
</levels>
<attributes/>
</target>
</transform>
<transform name="Excel_Columns" type="FieldList" modified="1386070193188" modifiedBy="">
<sources>
<source nameref="Excel_Extract"/>
</sources>
<alias>Column</alias>
</transform>
</transforms>
<loads>
<load name="DimensionCopy_Load" type="Dimension" modified="1394706494827" modifiedBy="">
<source nameref="Dimension_Extract"/>
<connection nameref="OlapTarget"/>
<dimension name="${Dimension}">
<elements mode="update"/>
<consolidations mode="update"/>
<attributes mode="inactive"/>
</dimension>
</load>
<load name="CubeCopy_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="${_SourceRef}"/>
<connection nameref="OlapTarget"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="RuleCopy_Load" type="Rule" modified="1394706494827" modifiedBy="">
<source nameref="Rule_Extract"/>
<connection nameref="OlapTarget"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="DimToFile_Load" type="File" modified="1394706494827" modifiedBy="">
<source nameref="Dimension_Extract" format="ncw"/>
<connection nameref="DimFile"/>
<mode>create</mode>
</load>
<load name="CubeToFile_Load" type="File" modified="1394706494827" modifiedBy="">
<source nameref="Cube_Extract"/>
<connection nameref="CubeFile"/>
<mode>create</mode>
</load>
<load name="RuleToFile_Load" type="File" modified="1394706494827" modifiedBy="">
<source nameref="Rule_Extract"/>
<connection nameref="RuleFile"/>
<mode>create</mode>
</load>
<load name="DimFromFile_Load" type="Dimension" modified="1394706494827" modifiedBy="">
<source nameref="Dim_TreeNC_Transform"/>
<connection nameref="OlapTarget"/>
<dimension name="${Dimension}">
<elements mode="update"/>
<consolidations mode="update"/>
<attributes mode="inactive"/>
</dimension>
</load>
<load name="CubeFromFile_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="CubeFile_Extract"/>
<connection nameref="OlapTarget"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="CubeFromFile_Insert_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="CubeFile_Transform"/>
<connection nameref="OlapSource"/>
<cube name="${Cube}" splash="disabled"/>
<mode>insert</mode>
</load>
<load name="RuleFromFile_Load" type="Rule" modified="1394706494827" modifiedBy="">
<source nameref="RuleFile_Extract"/>
<connection nameref="OlapTarget"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="CubeTarget_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="${_SourceRef}"/>
<connection nameref="OlapTarget"/>
<cube name="${TargetCube}"/>
<mode>update</mode>
</load>
<load name="CubePopulate_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="Cube_Slice_Transform"/>
<connection nameref="OlapSource"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="RuleTarget_Load" type="Rule" modified="1394706494827" modifiedBy="">
<source nameref="Rule_Extract"/>
<connection nameref="OlapTarget"/>
<cube name="${TargetCube}"/>
<mode>update</mode>
</load>
<load name="RulesUpdate_Load" type="Rule" modified="1394706494827" modifiedBy="">
<source nameref="Rule_Replace"/>
<connection nameref="OlapSource"/>
<cube name="${Cube}"/>
<mode>update</mode>
</load>
<load name="CubeFile_Type_Load" type="File" modified="1394706494827" modifiedBy="">
<source nameref="Cube_Type_Extract"/>
<connection nameref="CubeFile"/>
<mode>create</mode>
</load>
<load name="Dimension_Load" type="Dimension" modified="1394706494827" modifiedBy="">
<source nameref="Dimension_Extract"/>
<connection nameref="OlapTarget"/>
<dimension name="${Dimension}">
<elements mode="create"/>
<consolidations mode="update"/>
<attributes mode="inactive"/>
</dimension>
</load>
<load name="CubeGeneric_Load" type="Cube" modified="1394706494827" modifiedBy="">
<source nameref="GenericFile_Extract"/>
<connection nameref="OlapTarget"/>
<mode>create</mode>
<cube name="${Cube}"/>
</load>
<load name="DimensionGeneric_Load" type="Dimension" modified="1394706494827" modifiedBy="">
<source nameref="GenericDimension_Tree"/>
<connection nameref="OlapTarget"/>
<dimension name="${Dimension}">
<elements mode="create"/>
<consolidations mode="update"/>
<attributes mode="inactive"/>
</dimension>
</load>
</loads>
<jobs>
<job name="CubeCopy" type="Standard" modified="1394706494827" modifiedBy="">
<comment>
<![CDATA[
Cube to Cube Copy Variables: SourceConn, TargetConn, SourceDB, TargetDB, Cube=Sales, TargetCube
]]>
</comment>
<execution type="load" nameref="CubeTarget_Load"/>
<execution type="load" nameref="RuleTarget_Load"/>
</job>
<job name="CubeRulesCalc" type="Standard" modified="1394706494827" modifiedBy="">
<comment>
<![CDATA[
Copy Cube with precalculated Rule Values Variables: SourceConn, TargetConn, SourceDB, TargetDB, Cube=Sales, TargetCube
]]>
</comment>
<variable name="_SourceRef">
<default>CubeRulesCalc_Extract</default>
</variable>
<execution type="load" nameref="CubeTarget_Load"/>
</job>
<job name="CubeAnonymize" type="Standard" modified="1394706494827" modifiedBy="">
<comment>
<![CDATA[
Copy Cube with anonymized random values Variables: SourceConn, TargetConn, SourceDB, TargetDB, Cube=Sales, TargetCube
]]>
</comment>
<variable name="_SourceRef">
<default>Cube_Anonymize</default>
</variable>
<execution type="load" nameref="CubeTarget_Load"/>
</job>
<job name="CubeWithRulesCopy" type="Standard" modified="1394706494827" modifiedBy="">
<execution type="load" nameref="CubeCopy_Load"/>
<execution type="load" nameref="RuleCopy_Load"/>
</job>
<job name="DimensionsCopyAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Dimensions_T2"); while (source.nextRow()){ v1 = source.getColumnString("Dimension"); API.setProperty("Dimension",v1); state = API.executeLoad("DimensionCopy_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="CubesCopyAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Cubes_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeJob("CubeWithRulesCopy"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="DatabaseCopy" type="Standard" modified="1394706494827" modifiedBy="">
<execution type="job" nameref="DimensionsCopyAll"/>
<execution type="job" nameref="CubesCopyAll"/>
<comment>
<![CDATA[
Copy a complete Jedox database to another running Jedox OLAP Server. Variables: SourceConn, TargetConn, SourceDB, TargetDB
]]>
</comment>
</job>
<job name="DimensionsToFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Dimensions_T2"); while (source.nextRow()){ v1 = source.getColumnString("Dimension"); API.setProperty("Dimension",v1); state = API.executeLoad("DimToFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="CubesToFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Cubes_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("CubeToFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="RulesToFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Cubes_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("RuleToFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="DatabaseBackup" type="Standard" modified="1417645720512" modifiedBy="">
<comment>
<![CDATA[
Backup a Jedox database to a File-Directory. Variables: FilePath, SourceConn, SourceDB
]]>
</comment>
<execution nameref="DimensionsToFileAll" type="job"/>
<execution nameref="CubesToFileAll" type="job"/>
<execution nameref="RulesToFileAll" type="job"/>
</job>
<job name="DimensionsFromFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("DimFiles_T2"); while (source.nextRow()){ v1 = source.getColumnString("Dimension"); API.setProperty("Dimension",v1); state = API.executeLoad("DimFromFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="CubesFromFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("CubeFiles_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("CubeFromFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="CubesFromFile_Insert_All" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("CubeFiles_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("CubeFromFile_Insert_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="RulesFromFileAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("RuleFiles_T2"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("RuleFromFile_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="DatabaseRestore" type="Standard" modified="1394706494827" modifiedBy="">
<execution type="job" nameref="DimensionsFromFileAll"/>
<execution type="job" nameref="CubesFromFileAll"/>
<execution type="job" nameref="RulesFromFileAll"/>
<comment>
<![CDATA[
Restoring a Jedox database from a File-Directory. Also usable for a filebased Import of OLAP-models from Infor Alea and IBM Cognos TM1 to Jedox OLAP Variables: FilePath, TargetConn, TargetDB
]]>
</comment>
</job>
<job name="DatabaseSave" type="Groovy" modified="1394706494827" modifiedBy="">
<comment>
<![CDATA[
Saves all Jedox Cubes and the Database to disk in aggregated form in order to reduce disk space and time to start server Variables: TargetDB
]]>
</comment>
<jobscript>
<![CDATA[
LOG.info("Starting Jedox Database Save"); IDatabase db = OLAP.getDatabase("OlapTarget"); db.save(); for(ICube c : db.getCubes()){ if(c.getType().equals(ICube.CubeType.CUBE_ATTRIBUTE) || c.getType().equals(ICube.CubeType.CUBE_NORMAL)){ c.save(); } } LOG.info("Finished Jedox Database Save");
]]>
</jobscript>
</job>
<job name="DatabaseAnonymize" type="Standard" modified="1394706494827" modifiedBy="">
<variable name="_SourceRef">
<default>Cube_Anonymize</default>
</variable>
<execution type="job" nameref="DatabaseCopy"/>
<execution type="job" nameref="DimensionsAnonymizeAll"/>
<comment>
<![CDATA[
Copy a complete Olap database to another and anonimze the cube cell values and the dimension element names of the target database. Variables: SourceConn, TargetConn, SourceDB, TargetDB
]]>
</comment>
</job>
<job name="DimensionsAnonymizeAll" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("NormalDimensions_T2"); while (source.nextRow()){ v1 = source.getColumnString("Dimension"); API.setProperty("Dimension",v1); state = API.executeJob("RenameElements"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="RenameElements" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Dimension_Anonym_T1"); def oldNames = []; def newNames = []; while (source.nextRow()) { oldNames.add(source.getColumnString("OldName")); newNames.add(source.getColumnString("NewName")); }; OLAP.erename("OlapTarget","${Dimension}",oldNames as String[],newNames as String[]);
]]>
</jobscript>
</job>
<job name="RulesReplace" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
import java.io.File; API.setProperty("TargetConn","${SourceConn}"); API.setProperty("TargetDB","${SourceDB}"); API.setProperty("#failOnError","false"); /* Create temporary directory */ int randomNum = new Random().nextInt(); API.setProperty("FilePath","temp"+randomNum); String tempDirStr = API.getLocalFilesDir()+"\\temp" + randomNum + "\\"; File tempDir = new File(tempDirStr); tempDir.mkdir(); API.executeLoad("RuleToFile_Load"); state = API.executeLoad("RulesUpdate_Load"); if (!state.isOK()) { API.executeLoad("RuleFromFile_Load"); }; /* Delete temporary directory */ for(File file: tempDir.listFiles()) file.delete(); tempDir.delete();
]]>
</jobscript>
<comment>
<![CDATA[
All Enterprise Rules are read from a Cube, in the cube definition all occurences of a regular expression are replaced with a new string, the changed rules are loaded back to the same cube, the original rules are deleted. Variables: SourceConn, SourceDB, Cube, RegExp, Replacement
]]>
</comment>
</job>
<job name="CubeFile_Type_Job" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("DimensionCubes_T1"); while (source.nextRow()){ v1 = source.getColumnString("Cube"); API.setProperty("Cube",v1); state = API.executeLoad("CubeFile_Type_Load"); if (!state.isOK()) return; };
]]>
</jobscript>
</job>
<job name="UpdateElementType" type="Groovy" modified="1394706494827" modifiedBy="">
<jobscript>
<![CDATA[
LOG.info("Starting update elements type in dimension"); def targetElementTypeStr = "numeric"; if(API.getProperty("TargetElementType").equals("N")){ API.setProperty("_cellType","only_string");/*_cellType are the cells that we need to backup*/ API.setProperty("_elementType","S");/*_elementType is the type to be changed */ }else if(API.getProperty("TargetElementType").equals("S")){ API.setProperty("_cellType","only_numeric"); API.setProperty("_elementType","N"); targetElementTypeStr = "string"; }else{ LOG.error("Target type can only be N or S."); return; }; /*collect the list of the elements that need to be changed*/ elementToBeChangedSource = API.initSource("ElementTypeTransform"); def names = []; int elemCount=0; while (elementToBeChangedSource.nextRow()) { name=elementToBeChangedSource.getColumnString(":element"); names.add(name); LOG.info("The element \"" + name + "\" type will be changed to " + targetElementTypeStr); elemCount++; }; if(names.size()==0){ LOG.warn("No element found that needs to be changed."); return; }; /* Create temporary directory */ int randomNum = new Random().nextInt(); API.setProperty("FilePath","temp"+randomNum); String tempDirStr = API.getLocalFilesDir()+"\\temp" + randomNum + "\\"; File tempDir = new File(tempDirStr); tempDir.mkdir(); /* make a backup in files for the cells */ state = API.executeJob("CubeFile_Type_Job"); if (!state.isOK()) return; /** change the type in the dimension */ OLAP.eupdateElementsType("OlapSource",API.getProperty("Dimension"),names as String[],targetElementTypeStr); LOG.info("Number of elements that are changed is: " + elemCount); /* restore the cube cells if possible */ state = API.executeJob("CubesFromFile_Insert_All"); if (!state.isOK()) return; /* Delete temporary directory */ for(File file: tempDir.listFiles()) file.delete(); tempDir.delete(); LOG.info("Finished update element types in dimension");
]]>
</jobscript>
<comment>
<![CDATA[
The Element type of dimension elements is changed from String to Numeric or vice versa. TargetElementType is "S" for conversion to String element and "N" for conversion to Numeric element. For all cubes which contain this dimension the cube data on the selected elements is extracted to a temporary file and loaded back to the cube after element conversion. Variables: SourceConn, SourceDB, Dimension, RegExp, TargetElementType
]]>
</comment>
</job>
<job name="CubePopulate" type="Standard" modified="1394706494827" modifiedBy="">
<execution type="load" nameref="CubePopulate_Load"/>
<comment>
<![CDATA[
Generates cell paths with random cell values and loads them to an (empty) cube. This may be useful for simulations and mass data tests. Variables: SourceConn, SourceDB, Cube, NumberOfCells
]]>
</comment>
</job>
<job name="CreateOlap" type="Groovy" modified="1394706494827" modifiedBy="">
<comment>
<![CDATA[
Creates a complete Olap Model from a csv-File which contains the fact table: The elements in the first columns, the cube value in the last. All dimensions are created flat with a root element. Variables: FilePath,FileName, PaloTargetConn, PaloTargetDB, Cube
]]>
</comment>
<jobscript>
<![CDATA[
LOG.info("Starting Creation of Olap Model from File"); /* Dimensions */ columnsSource = API.initSource("GenericFile_Columns"); if (!columnsSource.nextRow()) { LOG.error("No columns found in Source file"); return; } dimension = columnsSource.getColumnString("Column"); /* Do not take the last column which contains the cube value */ boolean ok=false; while (columnsSource.nextRow()) { API.setProperty("Dimension",dimension); state = API.executeLoad("DimensionGeneric_Load"); if (!state.isOK()) return; dimension = columnsSource.getColumnString("Column"); ok=true; }; if (!ok) { LOG.error("Source file has only 1 column. At least 2 columns required for Cube data."); } /* Cube */ state = API.executeLoad("CubeGeneric_Load"); if (!state.isOK()) return; LOG.info("Finished Creation of Olap Model from File");
]]>
</jobscript>
</job>
</jobs>
</project>
<project name="sampleGroovyJob" version="5.1" modified="1417836153071" modifiedBy="" format="strict">
<headers>
<header name="comment">
<comment>
ETL Demo. Examples how to use Scripting language Groovy in a Job e.g. for dynamically assigning variables, looping over elements or react on the status of a job execution for a simple workflow.
</comment>
</header>
</headers>
<variables>
<variable name="Month" modified="1417836153071" modifiedBy="">
<default>Jan</default>
</variable>
<variable name="Year" modified="1417836153071" modifiedBy="">
<default>2007</default>
</variable>
<variable name="RelConn" modified="1417836153071" modifiedBy="">
<default>SQL_Conn</default>
</variable>
<variable name="Host" modified="1417836153071" modifiedBy="">
<comment/>
<default>localhost</default>
</variable>
</variables>
<connections>
<connection name="SQL_Conn" type="Hsqldb" modified="1417836153071" modifiedBy="">
<comment>
<![CDATA[ HSQLDB File with Sales-Database. ]]>
</comment>
<database>./db1</database>
<mode>Embedded</mode>
</connection>
<connection name="palodemo" type="Jedox" modified="1417836153071" modifiedBy="">
<password encrypted="true">UIIKTDp6jWhHfZhBpPByiA==</password>
<host>${Host}</host>
<port>7777</port>
<user>admin</user>
<database>Demo</database>
</connection>
<connection name="palotarget" type="Jedox" modified="1417836153071" modifiedBy="">
<password encrypted="true">UIIKTDp6jWhHfZhBpPByiA==</password>
<host>localhost</host>
<port>7777</port>
<user>admin</user>
<database>Demo_ETL</database>
</connection>
<connection name="out_file" type="File" modified="1417836153071" modifiedBy="">
<database>CubeOut.csv</database>
<header>true</header>
<delimiter>;</delimiter>
<quote>"</quote>
<encoding>latin1</encoding>
<enableEscape>false</enableEscape>
</connection>
</connections>
<extracts>
<extract name="Sales_Extract" type="Cube" modified="1417836153071" modifiedBy="">
<connection nameref="palodemo"/>
<query useRules="false" ignoreEmptyCells="true" onlyBasisAsDefault="true" celltype="both">
<cube name="Sales"/>
<dimensions>
<dimension name="Years">
<condition operator="like" value="${Year}" mode="onlyBases" type="accept"/>
</dimension>
<dimension name="Months">
<condition operator="like" value="${Month}" mode="onlyBases" type="accept"/>
</dimension>
</dimensions>
</query>
</extract>
</extracts>
<transforms/>
<loads>
<load name="File_Load" type="File" modified="1417836153071" modifiedBy="">
<source nameref="Sales_Extract"/>
<connection nameref="out_file"/>
</load>
</loads>
<jobs>
<job name="RelationalMetadata" type="Groovy" modified="1417836153071" modifiedBy="">
<jobscript>
<![CDATA[
/* Catalogs */ LOG.info("List of Catalogs"); state = API.getConnectionMetadata("${RelConn}","catalog",null); if (state.getData()!=null) { for (String line : state.getData().split("\r\n")) { LOG.info(line); } }; /* Schemas */ LOG.info("List of Schemas"); state = API.getConnectionMetadata("${RelConn}","schema",null); if (state.getData()!=null) { for (String line : state.getData().split("\r\n")) { LOG.info(line); } }; /* Tables */ LOG.info("List of Tables"); state = API.getConnectionMetadata("${RelConn}","table",null); if (state.getData()!=null) { for (String line : state.getData().split("\r\n")) { LOG.info(line); } };
]]>
</jobscript>
<comment>
<![CDATA[
Sample for Connection Metadata. List the schemas, catalogs and tables of a HSQLDB-database.
]]>
</comment>
</job>
<job name="DynamicVariables" type="Groovy" modified="1417836153071" modifiedBy="">
<jobscript>
<![CDATA[
import java.util.Calendar; import java.util.Locale; calendar = Calendar.getInstance(); String year = calendar.get(Calendar.YEAR); String mon = calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.ENGLISH); /* API.setProperty("Year",year); */ API.setProperty("Month",mon); state = API.executeLoad("File_Load");
]]>
</jobscript>
<comment>
<![CDATA[
Sample for dynamic setting of job/load variables. Loads Cube data for the current date to a File. Note: Year is not set as there is no sample data .
]]>
</comment>
</job>
<job name="JobStatus" type="Groovy" modified="1417836153071" modifiedBy="">
<comment>
<![CDATA[
Sample for simple workflow. Loads Cube data for year 2007 to File, if successfully load also Cube data for 2010.
]]>
</comment>
<jobscript>
<![CDATA[
st = API.getJobState(); LOG.info("Currently: "+st.getStatus()+" Warnung "+st.getWarnings()); LOG.warn("Eine Warnung"); st = API.getJobState(); LOG.info("Currently: "+st.getStatus()+" Warnung "+st.getWarnings()); state = API.executeLoad("File_Load"); LOG.info("Log: "+state.getLog()); if (state.isOK()) { LOG.info("Load has been successfully or with warnings, starting it again for year 2010"); API.setProperty("Year","2010"); state2 = API.executeLoad("File_Load"); } else { String status = state.getStatus(); int errors = state.getErrors(); int warnings = state.getWarnings(); LOG.info("Errors occured during load. Status:"+status+", Errors:"+errors+", Warnings:"+warnings); }
]]>
</jobscript>
</job>
<job name="ReadSource" type="Groovy" modified="1417836153071" modifiedBy="">
<jobscript>
<![CDATA[
source = API.initSource("Sales_Extract"); int count=0; while (source.nextRow() && count<20) { Product = source.getColumnString("Products"); Region = source.getColumnString("Regions"); Datatype = source.getColumnString("Datatypes"); Measure = source.getColumnString("Measures"); Value = source.getColumnString("#Value"); LOG.info(Product+" - "+Region+" - "+Datatype+" - "+Measure+" - "+Value); count=count+1; };
]]>
</jobscript>
<comment>
<![CDATA[
Sample for access to the data of an extract or a transform.
]]>
</comment>
</job>
<job name="Wait" type="Groovy" modified="1417836153071" modifiedBy="">
<jobscript>
<![CDATA[
int seconds = 5; LOG.info("Waiting for "+seconds+" seconds..."); Thread.sleep(seconds*1000); LOG.info("Waiting finished.");
]]>
</jobscript>
</job>
<job name="SendMail" type="Groovy" modified="1417836153071" modifiedBy="">
<comment>
<![CDATA[
Sample for Sending an EMail to multiple recipients. The SMPT-Settings are taken from Jedox Web System Manager
]]>
</comment>
<jobscript>
<![CDATA[
mailer = API.getMailer(); mailer.setServer(); /* for 2 recipients */ mailer.addRecipient("changeme@gmail.com"); mailer.addRecipient("changeme2@gmail.com"); mailer.setSubject("ETL Test Mail"); mailer.setMessage("Hello! here are the files."); /* with 2 attachements */ mailer.addAttachment("FileToOlap.csv"); mailer.addAttachment("BikerOrderlines.csv"); mailer.send();
]]>
</jobscript>
</job>
<job name="JobStatus2" type="Groovy" modified="1417836153071" modifiedBy="">
<comment>
<![CDATA[
Sample for simple workflow. Loads Cube data for year 2007 to File, if successfully load also Cube data for 2010.
]]>
</comment>
<jobscript>
<![CDATA[
/* This is an example with failOnError=true */ API.setProperty("#failOnError","false"); API.setProperty("Host","HostNotAvailable"); API.setProperty("Year","2010"); state = API.executeLoad("File_Load"); if (state.getErrors()!=0) { /* try to load again to another host, the load will not be executed unless API.setProperty("#failOnError","false") is added to first line*/ API.setProperty("Host","localhost"); state = API.executeLoad("File_Load"); LOG.info("Errors:"+state.getErrors()+", Warnings:"+state.getWarnings()); }
]]>
</jobscript>
</job>
</jobs>
</project>
<project name="sampleGroovyOlap" version="5.1" modified="1417871935043" modifiedBy="" format="strict">
<headers>
<header name="comment">
<comment>
ETL Demo Project. Flexible data transformations with Groovy-Scripts inside of a FieldTransform are shown. Simple numerical calculations in transform Orders_Trans and enhanced use-cases in transform Customer_Trans. A simple data validation example is in transform OrderCheck
</comment>
</header>
</headers>
<variables>
<variable name="palotarget1" modified="1417871780696" modifiedBy="">
<comment/>
<default>Biker</default>
</variable>
</variables>
<connections>
<connection name="olapdemo" type="Jedox" modified="1417836581178" modifiedBy="">
<host>localhost</host>
<port>7777</port>
<user>admin</user>
<password encrypted="true">UIIKTDp6jWhHfZhBpPByiA==</password>
<database>Demo</database>
</connection>
<connection name="olapbiker" type="Jedox" modified="1417836581178" modifiedBy="">
<host>localhost</host>
<port>7777</port>
<user>admin</user>
<password encrypted="true">UIIKTDp6jWhHfZhBpPByiA==</password>
<database>Biker</database>
</connection>
<connection name="palotarget" type="Jedox" modified="1417836581178" modifiedBy="">
<password encrypted="true">UIIKTDp6jWhHfZhBpPByiA==</password>
<host>localhost</host>
<port>7777</port>
<user>admin</user>
<database>Demo_ETL</database>
</connection>
</connections>
<extracts>
<extract name="Regions_Extract" type="Dimension" modified="1417836581178" modifiedBy="">
<connection nameref="olapdemo"/>
<query>
<dimension name="Regions"/>
</query>
<withAttributes>false</withAttributes>
</extract>
</extracts>
<transforms>
<transform name="Regions_Sort" type="TableView" modified="1417836581178" modifiedBy="">
<sources>
<source nameref="Regions_Extract" format="ea"/>
</sources>
<sorter>
<input nameref=":element" order="asc"/>
</sorter>
</transform>
<transform name="ElementChildrenCount" type="FieldTransform" modified="1417836581178" modifiedBy="">
<comment/>
<sources>
<source nameref="Regions_Extract" format="ea"/>
</sources>
<target>
<coordinates>
<coordinate name="region">
<input nameref=":element"/>
</coordinate>
<coordinate name="numberOfChildren">
<input nameref="RegionChildren"/>
</coordinate>
</coordinates>
</target>
<functions>
<function name="RegionChildren" type="Groovy">
<inputs>
<input nameref=":element" type="String"/>
</inputs>
<parameters>
<script>
<![CDATA[
IDatabase db = OLAP.getDatabase("olapdemo"); IElement e = db.getDimensionByName("Regions").getElementByName(_input1,false); if(e==null){ LOG.warn("Element " + _input1 + " does not exists."); return -1; }; return e.getChildCount();
]]>
</script>
</parameters>
</function>
</functions>
</transform>
<transform name="Position" type="FieldTransform" modified="1417836581178" modifiedBy="">
<comment>
<![CDATA[
Functions with Connection to OLAP Server via the Scripting-API
]]>
</comment>
<sources>
<source nameref="Regions_Extract" format="ea"/>
</sources>
<functions>
<function name="ElementPositions" type="Groovy">
<inputs>
<input nameref=":element"/>
</inputs>
<parameters>
<script>
<![CDATA[
IDatabase db = OLAP.getDatabase("olapdemo"); IElement e = db.getDimensionByName("Regions").getElementByName(_input1,false); if(e==null){ LOG.warn("Element " + _input1 + " does not exists."); return -1; }; return e.getPosition();
]]>
</script>
</parameters>
</function>
</functions>
</transform>
</transforms>
<loads>
<load name="Regions_Load" type="Dimension" modified="1417836581178" modifiedBy="">
<source nameref="Regions_Extract"/>
<connection nameref="palotarget"/>
<dimension name="Regions">
<elements mode="update"/>
<consolidations mode="update"/>
<attributes mode="update"/>
</dimension>
</load>
</loads>
<jobs>
<job name="GetDatabasesList" type="Groovy" modified="1417871935043" modifiedBy="">
<jobscript>
<![CDATA[
IConnection conn = OLAP.getConnection("olapbiker"); if (conn!=null) { LOG.info("list of databases:"); for(IDatabase db:conn.getDatabases()){ LOG.info(db.getName()); }; }
]]>
</jobscript>
</job>
<job name="RenameElements" type="Groovy" modified="1417836581178" modifiedBy="">
<jobscript>
<![CDATA[
API.executeLoad("Regions_Load"); LOG.info("Start renaming elements"); source = API.initSource("Regions_Extract","EA",0); def oldNames = []; def newNames = []; while (source.nextRow()) { oldName=source.getColumnString(":element"); newName=oldName+" NEW"; oldNames.add(oldName); newNames.add(newName); }; OLAP.erename("palotarget","Regions",oldNames as String[],newNames as String[]); LOG.info("Finished renaming elements");
]]>
</jobscript>
<comment>
<![CDATA[
Sample for renaming dimension elements. The suffix NEW is added to each element
]]>
</comment>
</job>
<job name="MoveElements" type="Groovy" modified="1417836581178" modifiedBy="">
<jobscript>
<![CDATA[
API.executeLoad("Regions_Load"); LOG.info("Move elements to sorted order"); IDatabase db = OLAP.getDatabase("palotarget"); IDimension dim = db.getDimensionByName("Regions"); source = API.initSource("Regions_Sort"); int elcount=0; while (source.nextRow()) { IElement e = dim.getElementByName(source.getColumnString(":element"),false); e.move(elcount); elcount++; }; LOG.info("Finished moving elements");
]]>
</jobscript>
<comment>
<![CDATA[
Sample for renaming dimension elements. The suffix NEW is added to each element
]]>
</comment>
</job>
<job name="ReadCubeCellValue" type="Groovy" modified="1417871901253" modifiedBy="">
<comment>
<![CDATA[
Sample for reading single Palo cube cell values without defining an extract for it.
]]>
</comment>
<jobscript>
<![CDATA[
String[] coordinates = [ "All Products","Europe","Year","2010","All Datatypes","Units" ]; String s = OLAP.data("olapdemo","Sales",coordinates); LOG.info("Cube cell value: "+s);
]]>
</jobscript>
</job>
<job name="WriteCubeCellValue" type="Groovy" modified="1417836581178" modifiedBy="">
<jobscript>
<![CDATA[
IDatabase db = OLAP.getDatabase("olapbiker"); ICube cube = db.getCubeByName("Status"); String [] path = ["2010","Jan","Future Bikes","Comment"]; IElement [] ePath = cube.getCellPath(path); IElement [][] paths = new IElement[1][]; paths[0] = ePath; Object [] values = ["Cell written with ETL."]; cube.loadCells(paths, values, cube.getCellLoadContext(ICube.SplashMode.SPLASH_DEFAULT, 1, false, true),null); LOG.info("Cell was written correctly.");
]]>
</jobscript>
<comment/>
</job>
<job name="CreateCubeDimension" type="Groovy" modified="1417836581178" modifiedBy="">
<jobscript>
<![CDATA[
IDatabase db = OLAP.getDatabase("olapbiker"); IDimension dim1 = db.getDimensionByName("NewSampleDim1"); if(dim1==null){ dim1 = db.addDimension("NewSampleDim1"); LOG.info("Dimension NewSampleDim1 was created."); }; IDimension dim2 = db.getDimensionByName("NewSampleDim2"); if(dim2==null){ dim2 = db.addDimension("NewSampleDim2"); LOG.info("Dimension NewSampleDim2 was created."); }; ICube cube = db.getCubeByName("NewSampleCube"); if(cube==null){ cube = db.addCube("NewSampleCube", [dim1,dim2] as IDimension[]); LOG.info("Cube NewSampleCube was created."); }; /* do some stuff where you need the new cube*/ LOG.info("Doing some ETL ..."); /* Cleanup by deleting the structures that were created, we should start with the cubes, since we can not directly delete a dimension that is already used in a cube, all cubes using that dimension should be deleted before.*/ db.removeCube(cube); LOG.info("Cube NewSampleCube was deleted."); db.removeDimension(dim1); LOG.info("Dimension NewSampleDim1 was deleted."); db.removeDimension(dim2); LOG.info("Dimension NewSampleDim2 was deleted.");
]]>
</jobscript>
<comment/>
</job>
</jobs>
</project>
</projects>
</configs>
Je souhaiterai supprimer tous les noeuds projets dont l'attribut name est différent de sampleGroovyJob
En gros, ne garder qu'un seul projet.

J'ai essayé avec ce script mais ca ne fonctionne pas .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
	$dom = new DomDocument();
 	$dom->load('repository.xml');
	$pname = 'sampleGroovyJob'; 
 
$delete = $dom->documentElement;
$del = $delete->getElementsByTagName("project");
 
foreach($del as $suppr)
{
 
	if ($suppr->getAttribute("name") != $pname)
		{
		$delete->removeChild($suppr);
		}
}
 
$dom->save("test.xml");
?>

Savez vous pourquoi ?
D'avance merci