Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: Tim MeagherHi,
I think in your case what you would likely want to do is split up the individual key value pairs - similar to the mechanism suggested previously.
Then, just output these as data fields, with a new record per key/value pair.
After this, you can run the data through the Pivot - Data to Names node to turn the keys into field names where the values would then become the values for those fields.
I've shown how to do this in the attached graph.
If you know the exact number and ordering of the key value pairs, you could just parse and write the field values to the known column names.
However, in the attached example, I've assumed neither the name or the number of these pairs is known in advance, so it will just output as many as it sees per row.
The Pivot - Data to Names node then uses a "Union" on the NameSet parameter to ensure that if some records have more or less key/value pairs, that all are output for all of the records.
The main pieces used for this graph are the split operator, mentioned previously, the "do output" operator, which allows you to write multiple output records for a single input record in a filter/agg etc node, and the use of the Pivot - Data to Names node.
For more information on how the do output operator can be used generally, consult the BRAINScript help, under the section "Output Related".
For more information on how to configure the Pivot - Data to Names node, consult the node help for the node.
Hope this helps,
Tim.
Attachments:
SplitAndPivot.brg