-1

I've got this type of data in my Database. Imagine that File_Name is the column name and so I need to take all the rows (Under "File_name") and put them into different columns with different Names.

File_Name (Column Name)
File1 (First Row)
File2 (Second Row)
File3 (Third Row)

And I need to put them in another file like this:

File_Name1 (Column Name1) ,File_Name2 (Column Name2), File_Name3 (Column Name3)
File1 (Under First column), File2 (Under Second Column), File3 (Under Third column)

Is there a stage that can help me? I tried using the Pivot but I can't really figure how to set it with just one input column.

Professor Abronsius
  • 26,348
  • 5
  • 26
  • 38
Jackwiper
  • 3
  • 4
  • Please make sure your questions hold enough information and consistent information to provide answers for it. Converting multiple rows into one or more columns? (This would not be called splitting though), FileName, Filename or File2 File3 (without comma) ...Try to edit it to get consistent – MichaelTiefenbacher Oct 04 '18 at 12:17
  • It's harder to describe it then actually do it, hope it's better now. – Jackwiper Oct 04 '18 at 12:47
  • You might be right but the answers would be different though – MichaelTiefenbacher Oct 04 '18 at 12:48

1 Answers1

0

So assuming you just want a single result row from your input (that is what I understood from your question) I would use a Transformer (or Column Generator) to add an artificial column with a value of 1 for all rows. You tried already with the Pivot Enterprise stage and with that additional column it will be possible to transform it into the result you need.

MichaelTiefenbacher
  • 3,278
  • 2
  • 9
  • 16
  • So i create a new column but how can i configure the pivot to put the result into the different columns? And also, what if the number of rows is different every run (cause i've got a row for each file i've got in a diectory, but my files could be more or less for every run) ) – Jackwiper Oct 04 '18 at 13:04
  • Check out https://www.ibm.com/support/knowledgecenter/en/SSZJPZ_11.7.0/com.ibm.swg.im.iis.ds.parjob.dev.doc/topics/vp_inputcolmethod.html – MichaelTiefenbacher Oct 04 '18 at 13:11
  • I can't understand how to make the pivot stage output 1 single row when in input there are N, the guide isn't easy to follow for me. Is this a Vertical or Horizontal Pivot? – Jackwiper Oct 04 '18 at 13:35
  • It is called a vertical pivot. Define (check) your new static column as group by column and the column holding the files as pivot. – MichaelTiefenbacher Oct 04 '18 at 13:40
  • Like so, i've got in output the same exact column that i've got in input. The column with the files name and the constant column with all "1") – Jackwiper Oct 04 '18 at 13:45