2
votes

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

2

2 Answers

1
votes

The step you are looking for is named Number range.

enter image description here

0
votes

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