Wiki source code of SplitFile

Version 8.1 by Outhman Moustaghfir on 2024/08/09 17:33

Show last authors
1 = SplitFile Connector Documentation =
2
3 == Overview ==
4
5 [[image:1723111201862-594.png]]
6
7 The splitFile connector is a utility designed to split files based on specific configurations defined in an XML format. The connector supports two modes of operation: **line** and **message **mode. Below is the functional documentation for each mode, including the expected format file, sample input file, and corresponding output files.
8
9 == Usage ==
10
11 == Xml Format ==
12
13
14 {{{
15 }}}
16
17 {{code language="XML"}}
18
19 <ixDOC xmlns:ixf="http://www.ixPath.com/Function"
20 xmlns:xs="http://www.w3.org/2001/XMLSchema"
21 xmlns:ix="localFunction"
22 xmlns:fn="http://www.w3.org/2005/xpath-functions">
23
24 <SplitBy mode="" headers="" footers="" excluded="" included="" endLine="" position ="" size="" optionChar="" ></SplitBy>
25 </ixDOC>
26
27 {{/code}}
28
29
30
31
32 === Key Attributes: ===
33
34 * **Headers and Footers:** Specify header and footer lines to be included in each output file.
35 * **endLine:** Define the character used to separate lines in the file, default value is newLine char.
36 * (((
37 **optionChar : **Define the character used to separate lines in output file, default value is newLine char.
38 )))
39 * **included :** Include specific lines from the output by defining them in the include attribute.
40 * **excluded:** Exclude specific lines from the output by defining them in the exclude attribute.
41 * **Position and Size:** Used to locate and define the include in the input file.
42
43 === 1. Mode: line ===
44
45
46 === Input File Example : ===
47
48
49 {{code language="txt"}}
50 UNA +.? '
51 UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
52 UNH+22865910+DESADV D 96A UN EAN005'
53 BGM+351+5103742405090001+9'
54 DTM+137 20240509 102'
55 DTM+2 20240509 102'
56 DTM+17 20240509 102'
57 RFF+DQ 5103742405090001'
58 DTM+171 20240509 102'
59 RFF+ON 0136811328'
60 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
61 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
62 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
63 NAD+FW+5907613200009 9'
64 CPS+1'
65 LIN+1++5907640254112 EN'
66 PIA+1+S1OVZ.075.201.126.522_M SA'
67 QTY+12 2.00 EA'
68 QTY+52 1 EA'
69 RFF+LI 00001'
70 RFF+ON 0136811328'
71 LIN+2++5907640254150 EN'
72 PIA+1+S1OVZ.075.201.106.511_M SA'
73 QTY+12 2.00 EA'
74 QTY+52 1 EA'
75 RFF+LI 00002'
76 RFF+ON 0136811328'
77 LIN+3++5907640254426 EN'
78 PIA+1+S2OVZ.075.264.126.524_M SA'
79 QTY+12 2.00 EA'
80 QTY+52 1 EA'
81 RFF+LI 00003'
82 RFF+ON 0136811328'
83 LIN+4++5907640254617 EN'
84 PIA+1+S1OVZ.075.230.126.523_M SA'
85 QTY+12 2.00 EA'
86 QTY+52 1 EA'
87 RFF+LI 00004'
88 RFF+ON 0136811328'
89 LIN+5++5907640254624 EN'
90 PIA+1+S1OVZ.075.201.106.511_USNE SA'
91 QTY+12 1.00 EA'
92 QTY+52 1 EA'
93 RFF+LI 00005'
94 RFF+ON 0136811328'
95 CNT+2 5'
96 UNH+22865910+DESADV D 96A UN EAN005'
97 BGM+351+5103742405090001+9'
98 DTM+137 20240509 102'
99 DTM+2 20240509 102'
100 DTM+17 20240509 102'
101 RFF+DQ 5103742405090001'
102 DTM+171 20240509 102'
103 RFF+ON 0136811328
104 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
105 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
106 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
107 NAD+FW+5907613200009 9'
108 CPS+1'
109 LIN+1++5907640254112 EN'
110 PIA+1+S1OVZ.075.201.126.522_M SA'
111 QTY+12 2.00 EA'
112 QTY+52 1 EA'
113 RFF+LI 00001'
114 RFF+ON 0136811328'
115 LIN+2++5907640254150 EN'
116 PIA+1+S1OVZ.075.201.106.511_M SA'
117 QTY+12 2.00 EA'
118 QTY+52 1 EA'
119 RFF+LI 00002'
120 RFF+ON 0136811328'
121 LIN+3++5907640254426 EN'
122 PIA+1+S2OVZ.075.264.126.524_M SA'
123 QTY+12 2.00 EA'
124 QTY+52 1 EA'
125 RFF+LI 00003'
126 RFF+ON 0136811328'
127 LIN+4++5907640254617 EN'
128 PIA+1+S1OVZ.075.230.126.523_M SA'
129 QTY+12 2.00 EA'
130 QTY+52 1 EA'
131 RFF+LI 00004'
132 RFF+ON 0136811328'
133 LIN+5++5907640254624 EN'
134 PIA+1+S1OVZ.075.201.106.511_USNE SA'
135 QTY+12 1.00 EA'
136 QTY+52 1 EA'
137 RFF+LI 00005'
138 RFF+ON 0136811328'
139 CNT+2 5'
140 UNH+22865910+DESADV D 96A UN EAN005'
141 BGM+351+5103742405090001+9'
142 DTM+137 20240509 102'
143 DTM+2 20240509 102'
144 DTM+17 20240509 102'
145 RFF+DQ 5103742405090001'
146 DTM+171 20240509 102'
147 RFF+ON 0136811328'
148 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
149 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
150 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
151 NAD+FW+5907613200009 9'
152 CPS+1'
153 LIN+1++5907640254112 EN'
154 PIA+1+S1OVZ.075.201.126.522_M SA'
155 QTY+12 2.00 EA'
156 QTY+52 1 EA'
157 RFF+LI 00001'
158 RFF+ON 0136811328'
159 LIN+2++5907640254150 EN'
160 PIA+1+S1OVZ.075.201.106.511_M SA'
161 QTY+12 2.00 EA'
162 QTY+52 1 EA'
163 RFF+LI 00002'
164 RFF+ON 0136811328'
165 LIN+3++5907640254426 EN'
166 PIA+1+S2OVZ.075.264.126.524_M SA'
167 QTY+12 2.00 EA'
168 QTY+52 1 EA'
169 RFF+LI 00003'
170 RFF+ON 0136811328'
171 LIN+4++5907640254617 EN'
172 PIA+1+S1OVZ.075.230.126.523_M SA'
173 QTY+12 2.00 EA'
174 QTY+52 1 EA'
175 RFF+LI 00004'
176 RFF+ON 0136811328'
177 LIN+5++5907640254624 EN'
178 PIA+1+S1OVZ.075.201.106.511_USNE SA'
179 QTY+12 1.00 EA'
180 QTY+52 1 EA'
181 RFF+LI 00005'
182 RFF+ON 0136811328'
183 CNT+2 5'
184 UNH+22865910+DESADV D 96A UN EAN005'
185 BGM+351+5103742405090001+9'
186 DTM+137 20240509 102'
187 DTM+2 20240509 102'
188 DTM+17 20240509 102'
189 RFF+DQ 5103742405090001'
190 DTM+171 20240509 102'
191 RFF+ON 0136811328'
192 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
193 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
194 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
195 NAD+FW+5907613200009 9'
196 CPS+1'
197 LIN+1++5907640254112 EN'
198 PIA+1+S1OVZ.075.201.126.522_M SA'
199 QTY+12 2.00 EA'
200 QTY+52 1 EA'
201 RFF+LI 00001'
202 RFF+ON 0136811328'
203 LIN+2++5907640254150 EN'
204 PIA+1+S1OVZ.075.201.106.511_M SA'
205 QTY+12 2.00 EA'
206 QTY+52 1 EA'
207 RFF+LI 00002'
208 RFF+ON 0136811328'
209 LIN+3++5907640254426 EN'
210 PIA+1+S2OVZ.075.264.126.524_M SA'
211 QTY+12 2.00 EA'
212 QTY+52 1 EA'
213 RFF+LI 00003'
214 RFF+ON 0136811328'
215 LIN+4++5907640254617 EN'
216 PIA+1+S1OVZ.075.230.126.523_M SA'
217 QTY+12 2.00 EA'
218 QTY+52 1 EA'
219 RFF+LI 00004'
220 RFF+ON 0136811328'
221 LIN+5++5907640254624 EN'
222 PIA+1+S1OVZ.075.201.106.511_USNE SA'
223 QTY+12 1.00 EA'
224 QTY+52 1 EA'
225 RFF+LI 00005'
226 RFF+ON 0136811328'
227 CNT+2 5'
228 UNH+22865910+DESADV D 96A UN EAN005'
229 BGM+351+5103742405090001+9'
230 DTM+137 20240509 102'
231 DTM+2 20240509 102'
232 DTM+17 20240509 102'
233 RFF+DQ 5103742405090001'
234 DTM+171 20240509 102'
235 RFF+ON 0136811328'
236 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
237 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
238 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
239 NAD+FW+5907613200009 9'
240 CPS+1'
241 LIN+1++5907640254112 EN'
242 PIA+1+S1OVZ.075.201.126.522_M SA'
243 QTY+12 2.00 EA'
244 QTY+52 1 EA'
245 RFF+LI 00001'
246 RFF+ON 0136811328'
247 LIN+2++5907640254150 EN'
248 PIA+1+S1OVZ.075.201.106.511_M SA'
249 QTY+12 2.00 EA'
250 QTY+52 1 EA'
251 RFF+LI 00002'
252 RFF+ON 0136811328'
253 LIN+3++5907640254426 EN'
254 PIA+1+S2OVZ.075.264.126.524_M SA'
255 QTY+12 2.00 EA'
256 QTY+52 1 EA'
257 RFF+LI 00003'
258 RFF+ON 0136811328'
259 LIN+4++5907640254617 EN'
260 PIA+1+S1OVZ.075.230.126.523_M SA'
261 QTY+12 2.00 EA'
262 QTY+52 1 EA'
263 RFF+LI 00004'
264 RFF+ON 0136811328'
265 LIN+5++5907640254624 EN'
266 PIA+1+S1OVZ.075.201.106.511_USNE SA'
267 QTY+12 1.00 EA'
268 QTY+52 1 EA'
269 RFF+LI 00005'
270 RFF+ON 0136811328'
271 CNT+2 5'
272 UNZ+1+11480134402'
273 UNZ1'
274 '
275 {{/code}}
276
277
278 ==== Example 1: without specifying include attribute ====
279
280 when we don't use include attribute. it means for each output file we are going to have headers and footers and also for the include we will defined them by position and size so for each line at a specific position and with a size this is the include .
281
282 {{{
283 }}}
284
285 {{code language="XML"}}
286
287 <ixDOC xmlns:ixf="http://www.ixPath.com/Function"
288 xmlns:xs="http://www.w3.org/2001/XMLSchema"
289 xmlns:ix="localFunction"
290 xmlns:fn="http://www.w3.org/2005/xpath-functions">
291
292 <SplitBy mode="line" headers="UNA;UNB" footers="UNZ1;UNZ" excluded="QTY" include ="" endLine="'" position ="25" size="9"></SplitBy>
293 </ixDOC>
294
295 {{/code}}
296
297 == output files : ==
298
299 [[image:1723112876572-265.png]]
300
301
302 fileName_1_ //**UN EAN00**//.txt
303
304
305 {{code language="txt"}}
306 UNA +.? '
307 UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
308 UNH+22865910+DESADV D 96A UN EAN005'
309 UNH+22865910+DESADV D 96A UN EAN005'
310 UNH+22865910+DESADV D 96A UN EAN005'
311 UNH+22865910+DESADV D 96A UN EAN005'
312 UNH+22865910+DESADV D 96A UN EAN005'
313 UNZ+1+11480134402'
314 UNZ1'
315
316 {{/code}}
317
318 == Example 2: with specifiying include attribute ==
319
320 we don't need to use position and size.
321
322 == 2. Mode: message: ==
323
324 In **message** mode, the file is split into sections based on a specified include . Each output file begins with the start of an include and ends when another include is encountered.
325
326
327 ==== Example ====
328
329
330 {{code language="xml"}}
331
332 <ixDOC xmlns:ixf="http://www.ixPath.com/Function"
333 xmlns:xs="http://www.w3.org/2001/XMLSchema"
334 xmlns:ix="localFunction"
335 xmlns:fn="http://www.w3.org/2005/xpath-functions">
336
337 <SplitBy mode="message" headers="UNA;UNB" footers="UNZ1;UNZ" excluded="QTY" include ="UNH" endLine="'"></SplitBy>
338 </ixDOC>
339
340 {{/code}}
341
342 === an example of an output file ===
343
344 {{code language="xml"}}
345 UNA +.? '
346 UNB+UNOD 3+5907613200009 14+5907808850002 14+240509 1553+11480134402++DESADV'
347 UNH+22865910+DESADV D 96A UN EAN005'
348 BGM+351+5103742405090001+9'
349 DTM+137 20240509 102'
350 DTM+2 20240509 102'
351 DTM+17 20240509 102'
352 RFF+DQ 5103742405090001'
353 DTM+171 20240509 102'
354 RFF+ON 0136811328'
355 NAD+BY+5907808850002 9++CASTORAMA POLSKA SP. Z O.O.+UL. KRAKOWIAKÓW 78+WARSZAWA++02-255+PL'
356 NAD+SU+5907613200009 9++TEMARED SPÓŁKA Z OGRANICZONĄ ODPOWI EDZIALNOŚCIĄ+al. Lotników Polskich 1+Świdnik++21-040+PL'
357 NAD+DP+5908305680970 9++CASTORAMA PIŁA+UL. BYDGOSKA 135+Piła++64-920+PL'
358 NAD+FW+5907613200009 9'
359 CPS+1'
360 LIN+1++5907640254112 EN'
361 PIA+1+S1OVZ.075.201.126.522_M SA'
362 RFF+LI 00001'
363 RFF+ON 0136811328'
364 LIN+2++5907640254150 EN'
365 PIA+1+S1OVZ.075.201.106.511_M SA'
366 RFF+LI 00002'
367 RFF+ON 0136811328'
368 LIN+3++5907640254426 EN'
369 PIA+1+S2OVZ.075.264.126.524_M SA'
370 RFF+LI 00003'
371 RFF+ON 0136811328'
372 LIN+4++5907640254617 EN'
373 PIA+1+S1OVZ.075.230.126.523_M SA'
374 RFF+LI 00004'
375 RFF+ON 0136811328'
376 LIN+5++5907640254624 EN'
377 PIA+1+S1OVZ.075.201.106.511_USNE SA'
378 RFF+LI 00005'
379 RFF+ON 0136811328'
380 CNT+2 5'
381 UNZ+1+11480134402'
382 UNZ1'
383
384 {{/code}}
385
386 === ===
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian