cancel
Showing results for 
Search instead for 
Did you mean: 

Parse complex file format and generate sequence number

GanguP
New Contributor III

I am trying to parse a file with a complex format.  It hasn't been easy as I am new to Snaplogic.  In the below example, I am trying to combine the four rows.  In order to do that I am thinking to assign the same seqeunce number to the group highlighted in yellow then use Aggregate to combine based on the sequence number.   How do I generate the sequence number?

 

GanguP_0-1702529698157.png

 

1 ACCEPTED SOLUTION

koryknick
Employee
Employee

My apologies - attached here.

View solution in original post

10 REPLIES 10

koryknick
Employee
Employee

@GanguP - SnapLogic is a streaming platform, meaning it only retains context of the current document being processed.  I'd like to fully understand the requirement before showing you one solution vs another.

Before offering a solution, can you clarify your use case?  Do you need to always combine 4 rows following a blank linedata value?  Or could there be any number of rows (0-N)?

GanguP
New Contributor III

Hi Kory.  Thank you for a quick response.  Below is the format of the file I am trying to parse.   Below are the steps I am taking
1) Use Fixed width parser to filter out lines that are not needed.

2) Used mapper to assign the LOCATOR2_FLAG.  Below is the logic. 
($LINEDATA.substring(0,9).trim()>='0000000000' && $LINEDATA.substring(0,9).trim()<='9999999999') &&$LINEDATA.substr(38,1) .trim() == "-"?'Y':'N'

 

 

GanguP_0-1702562264700.png

 

koryknick
Employee
Employee

@GanguP - could you please attach the file to this thread?  Or at least a portion of it?  I'd like to create a solution for you but would rather not hand-enter all the data from your sample.

GanguP
New Contributor III

Atatched