• Post category:BI Publisher
  • Post comments:0 Comments
  • Post last modified:December 20, 2022
  • Reading time:2 mins read
You are currently viewing How to convert Rows to Columns using etext template
How to convert Rows to Columns using etext template

In this article, we will look into how to convert rows to columns using an etext template. Usually, when we develop HCM Extract, there could be cases where there are multiple child rows for the same person and we need to pull them as separate columns or concatenate them at the template level so that each employee comes up on a single row. Ex: Extracting multiple payroll balances and converting them to different columns, extracting hiring managers/recruiters/collaborators for requisitions, and concatenating them to show up as a single column.

Consider we have a sample XML file like below:

image 3 - How to convert Rows to Columns using etext template

Sample output file expected:

John  ABC,100,XYZ,200,IJK,300                                                                             
Jack  DEF,100,MNO,200                                                                                     

Now, we will use the concatenate functionality in the etext template to achieve rows to columns functionality

image 4 - How to convert Rows to Columns using etext template

Here the ConcatenatedInvoiceInfo is the name of the concatenation that is based out of the Ded_Details level and it is concatenating the Code and Value for each row found and the delimiter used is comma.

Once we develop this template, we can test this using the template viewer and as expected the template produces the output like below:

image 5 - How to convert Rows to Columns using etext template

Hope this helps when you have to achieve such requirement.