Split data fields of a CSV data row to separate rows
UsageThis function can be used to wrap data fields from a single CSV row into multiple separate rows for output. The first field or fields remain the same in each generated row, followed by two new fields: the respective column heading and the contents.
This command can only be used for output control, not for reading a CSV file.
- Starting with the second column, all subsequent fields are split into separate rows.
Each output row consists of three fields:
Field, the respective column name in a separate column, and the respective field content in a separate column.
- Starting with the fourth column (
4), the subsequent fields are divided into individual lines.
Each output line consists of the preceding fields -, the column name in a separate column, and the field contents in a separate column.
- %slice["Field Name"]
- Starting with the column
Field Namethe subsequent fields are divided into individual lines.
Each output row consists of all fields preceding the column
Field Name, the column name in a separate column, and the field contents in a separate column.
Special featureAs the new table will have some additonal columns for each "sliced" value, a number of new generic column titles
If the command %merge is used, there will even be new columns für each column of every merged file. See also %merge .
These columns should be renamed as desired.
Do this by using, for example:
This is a tabular weekly schedule as csv:
|Monday||Muesli||Colorful garden salad||Noodle soup|
|Wednesday||Muesli||Lamb's lettuce||Potato soup|
|Thursday||Bread rolls||Coleslaw||Chicken soup|
|Friday||2 rolls||Tomato salad||Fish soup|
|Monday||Lunch||Colorful garden salad|
By using the following commands:
There are some specialties when using %slice together with %merge.
In this case, for each merged file there will be added one column[field name] (field value, %slicecompact) or even two columns (field name and value, %slicedistinct) to each data row.
=> Eigene Seiten mit Beispielen!
(%slice is the same as %slice is the same as %slicedistinct)
with %merge: for each mergefile, starting from offset, for each mergefile add two columns, with field name and field value
with two mergefiles: must specify a start fixed offset in each merged file:
This is made for adding arbitrary columns from the merged file(s).
%slicecompact[field name] starting past [field name] splits all columns into own rows
(when used without %merge, this is identical to %slice[Field name] resp. %slicedistinct[Field name])
with %merge: for each merged file, add one column [field name] with the field value of [field name]
with two mergefiles: no fixed offsets necessary, because offset of [field name] is picked out each time
This is made for combining columns from the merged file(s) with the same name.