Solved

Convert data in rows to columns using field values as the column name

  • 8 August 2022
  • 4 replies
  • 151 views

I have lab data that is reported in rows, one row for each analyte for each sample.

I need to create a single record for each sample, with the analyte values as columns in the record - build a single record of analyte values for each sample.imageto this:

image

icon

Best answer by ebygomm 10 August 2022, 13:00

View original

4 replies

Badge +2

@vcarr2005​ Have a look at the article Transpose a Table Using FME.

Thanks Mark, that article explains transforming columns into rows. I want to do the opposite - build columns out of rows using a unique ID.

Userlevel 1
Badge +10

Thanks Mark, that article explains transforming columns into rows. I want to do the opposite - build columns out of rows using a unique ID.

First you will want to add a column that gives the column names you want to use, e.g. I presume the value alongside Perfluorobutanoic acid (PFBA) will want to end up in a column called PFBA.

Then you'll want to create a new attribute using the value of AnalyteName and setting it's value to the appropriate column (Result?)

imageThe new attributes will be created but hidden at this point, so you'll need to expose them using an AttributeExposer. Finally you need to aggregate the data to a single row, ensuring that you select Merge Incoming Attributes under accumulation mode. If you have data for multiple samples you will need to choose an appropriate attribute to group by here.

Thank you, this is exactly what I needed.

Reply