AnsweredAssumed Answered

Pentaho Java script - Multi line field parsing

Question asked by vikas reddy on Sep 30, 2018

I have a multi line field populated with some specific values I need to parse and write to new fields.

Field:

 

001

AIR CONDITIONING

UNK

TYPE UNKNOWN

30.0

 

 

005

EXTERIOR WALL

FRB

FRAME BRICK

20.0

 

 

006

ROOFING

COS

COMPOSITION SHINGLE

50.0

 

Here for an example, I want to check if the field has a string 'EXTERIOR WALL', and if it does I want to parse the next three lines 'FRB' , 'FRAME BRICK' and 20.0 to new fields:

 

Category          Type     Desc                    Amount

Exterior Wall     FRB     FRAME BRICK     20.0

Roofing               COS     COMPOSITION     50.0

 

The field will always be in the above format with multiple segments of data separated by spaces.

I have checked and didn't find any useful resources for this problem. Any suggestions please?

Outcomes