Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 11-10-2016 11:31 AM
Hi Team,
I have a requirement Where i have to extract first 5 records from a file(Sample.CSV, This file contain 100 rows and 5 column for each row)
Out of 5 record, each record of the 2nd column contain value as "Yes" then I want add a ATTRIBUTE for that file "Is_valid=Y" else "Is_valid=N"
Ex:
India,YES,Asia
USA,YES,USA
UK,YES,UK
India1,YES,Asia
USA1,YES,USA
I did following flow, It is working for record level.
GetFile -> Split Line -> Extract Text -> RouteOnAttribte -> UpdateAttribute
But I dont want to do this check for all the record, I need to do this check only for first 5 record and assign the Valid flag for that file.
Please help me on this.
Created 11-11-2016 02:44 AM
One thing you can do is drop the SplitLine processor and go straight to the ExtractText processor where you can use a regex to pull out the first 5 lines via a regex. Then you can use the groups within that regex to work on the individual groups (e.g., the first 5 lines) in the UpdateAttribute processor. This regex should work for you: ^(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n.*
Created 11-11-2016 02:44 AM
One thing you can do is drop the SplitLine processor and go straight to the ExtractText processor where you can use a regex to pull out the first 5 lines via a regex. Then you can use the groups within that regex to work on the individual groups (e.g., the first 5 lines) in the UpdateAttribute processor. This regex should work for you: ^(.*)\n(.*)\n(.*)\n(.*)\n(.*)\n.*
Created 11-11-2016 05:24 AM
Thanks Brandon Wilson
I tried your suggestion it is working for me. Small correction in regex.
The below one is working for me (Please enable multi-line option in ExtractText configuration )
"regex: (.*)\n(.*)\n(.*)\n(.*)\n(.*) "