Skip to main content

Hi,

I have a postgresql table pre_val_error with following fields

 

GRID_ID|ERROR_LEVEL|ERROR

121|1|ERROR1

121|2|ERROR2

121|3|ERROR3

 

The requirement is to write all the records to a csv file and insert a record in Oracle with count grouped by error_level. The Oracle table details are below

 

GRID_ID|ERROR_LVL1_COUNT|ERROR_LVL2_COUNT|ERROR_LVL3_COUNT

121|1|1|1

 

As you can see, the number or records has to be grouped by error_level and inserted in Oracle. I have tried aggregator, counter and nothing worked. Can anyone suggest a solution for this problem.

 

Hello achilles07,

For the stats (counts) - use the StatisticsCalculator Transformer

GroupBy: GRID_ID

Analyse: ERROR_LEVEL

 

Output - look at the _count attribute

.......................

To Pivot (data into fieldnames) eg the different ERROR_LEVELS

Take a look at AttributePivoter Transformer

........................

Hope this helps / gives u some ideas

Howard L'


Hi @achilles07​ , I think this workflow generates your desired result.

workflow


Hello achilles07,

For the stats (counts) - use the StatisticsCalculator Transformer

GroupBy: GRID_ID

Analyse: ERROR_LEVEL

 

Output - look at the _count attribute

.......................

To Pivot (data into fieldnames) eg the different ERROR_LEVELS

Take a look at AttributePivoter Transformer

........................

Hope this helps / gives u some ideas

Howard L'

Thanks for the suggestion @howard_l​ . StatisticsCalculator is still returning more than 1 feature. I was able to solve it with the help of aggregator and generating a list out of it.


wow @Takashi Iijima​ that was some timing. Let me try your solution also.


Reply