Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a csv file that has leading comments, how can I filter them out?
# use this file for additional users # all values must be present id,userName,date "1","foo","01.01.2019" "2","bar","02.01.2019" . . .
I'm going with a tFilterRow for a solution:
Advanced mode with:
// filter out all comments
!( java.util.regex.Pattern.matches("^\\s*#.*", row1.Status) )
In this case "Status" is the first field defined in the schema (which happened to be String.) I'm not sure how to do this if it weren't.
Thanks,
jji
use Header = 2 in tfiledelimted
look at the screeshot below
If your 1st Field is Integer like "1" or 1(as in you case) , just remove "Die On Error" , All the record will be rejected( Including header)
You can capture these using Reject Link from Input Component
I am looking for a more general solution, allowing people to add more comments if necessary. Seems like hardcoding a 2 would prevent that.
jji
I'm going with a tFilterRow for a solution:
Advanced mode with:
// filter out all comments
!( java.util.regex.Pattern.matches("^\\s*#.*", row1.Status) )
In this case "Status" is the first field defined in the schema (which happened to be String.) I'm not sure how to do this if it weren't.
Thanks,
jji
@imholzj but if the file is in below format
VERSION = 2007
DATE = 10/23/2017
EXPDATE = 10/1/2018
###########################################
FAMILY NURSE CARE OF LLC
HARRY GILL, MD, PHD, PC
LEAWOOD FAMILY EYE CARE PA
By using the tfilterrow in advance setting we can only remove one line with ## symbols
Please look at screenshot below i ran the test