|
1 | 1 | # csv-component
|
2 | 2 |
|
3 |
| -> A CSV component for the [elastic.io platform](http://www.elastic.io "elastic.io platform"). |
| 3 | +A CSV component for the [elastic.io platform](http://www.elastic.io "elastic.io platform"). |
| 4 | + |
| 5 | + |
| 6 | +## Write CSV attachment |
| 7 | + |
| 8 | +Multiple incoming events can be combined into one CSV file with the write CSV |
| 9 | +action. Incoming events will be written into the CSV file until there is a gap |
| 10 | +of more than 10 seconds between events. As part of the component setup, one |
| 11 | +must specify the columns of the CSV file. These columns will be published as |
| 12 | +the header in the first row. For each incoming event, the value for each header |
| 13 | +will be stringified and written as the value for that cell. All other |
| 14 | +properties will be ignored. For example, headers ``foo,bar`` along with the |
| 15 | +following JSON events |
| 16 | + |
| 17 | + {"foo":"myfoo", "bar":"mybar"} |
| 18 | + {"foo":"myfoo", "bar":[1,2]} |
| 19 | + {"bar":"mybar", "baz":"mybaz"} |
| 20 | + |
| 21 | +will produce the following ``.csv`` file: |
| 22 | + |
| 23 | + foo,bar |
| 24 | + myfoo,mybar |
| 25 | + myfoo,"[1,2]" |
| 26 | + ,mybar |
| 27 | + |
| 28 | +When columns are added in the UI, you will be presented with an opportunity to |
| 29 | +provide a JSONata expression per column. If you require number formatting that |
| 30 | +is specific to a locale, the JSONata expression should handle that concern. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +The output of the CSV Write component will be a message with an attachment. In |
| 35 | +order to access this attachment, the component following the CSV Write must be |
| 36 | +able to handle file attachments such as the [SFTP |
| 37 | +component](https://github.com/elasticio/sftp-component). |
4 | 38 |
|
5 | 39 | This is an open source component to work with
|
6 | 40 | [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) files in your
|
@@ -58,32 +92,3 @@ $ git push elasticio master
|
58 | 92 | Obviously the naming of your team and repository is entirely up-to you and if
|
59 | 93 | you do not put any corresponding naming our system will auto generate it for you
|
60 | 94 | but the naming might not entirely correspond to your project requirements.
|
61 |
| - |
62 |
| -## Write CSV attachment |
63 |
| - |
64 |
| -Multiple incoming events can be combined into one CSV file with the write CSV |
65 |
| -action. Incoming events will be written into the CSV file until there is a gap |
66 |
| -of more than 10 seconds between events. As part of the component setup, one |
67 |
| -must specify the columns of the CSV file. These columns will be published as |
68 |
| -the header in the first row. For each incoming event, the value for each header |
69 |
| -will be stringified and written as the value for that cell. All other |
70 |
| -properties will be ignored. For example, headers ``foo,bar`` along with the |
71 |
| -following JSON events |
72 |
| - |
73 |
| - {"foo":"myfoo", "bar":"mybar"} |
74 |
| - {"foo":"myfoo", "bar":[1,2]} |
75 |
| - {"bar":"mybar", "baz":"mybaz"} |
76 |
| - |
77 |
| -will produce the following ``.csv`` file: |
78 |
| - |
79 |
| - foo,bar |
80 |
| - myfoo,mybar |
81 |
| - myfoo,"[1,2]" |
82 |
| - ,mybar |
83 |
| - |
84 |
| -Currently no formatting is performed as part of CSV Write. |
85 |
| - |
86 |
| -The output of the CSV Write component will be a message with an attachment. In |
87 |
| -order to access this attachment, the component following the CSV Write must be |
88 |
| -able to handle file attachments such as the [SFTP |
89 |
| -component](https://github.com/elasticio/sftp-component). |
|
0 commit comments