2

I have this situation, I have data about age, and I want to add another column, with age range:

  • Range 1 (0-18 years) = children;
  • Range 2 (19-50) = adults;
  • Range 3 (50+) older people

How can I do this in Pentaho? I have already tried it with filters and so on, but I didn't success. So I want to have an output shown on picture below (for about 100k rows, so i can't do it manually).

Target data [AgeRang column added]:

enter image description here

mzy
  • 1,754
  • 2
  • 20
  • 36
Blaž Čukelj
  • 83
  • 1
  • 7

2 Answers2

2

The step you are looking for is named Number range.

enter image description here

AlainD
  • 6,187
  • 3
  • 17
  • 31
0

I would use a step called User Defined Java Expression which filters data using Java expression and adds new column age_range to record stream's row.

Use this statement in Java expression field:

  • (age <= 18) ? 1 : (age <= 50) ? 2 : 3

Check following figure from execution: enter image description here

mzy
  • 1,754
  • 2
  • 20
  • 36