I have a "Directory and File Pathnames" reader that gives me a list of text files in a Windows folder. I want to pass those folder and filenames to a FeatureReader transformer and be able to read the text lines from them as output for further processing, but I can't seem to get anything out of the FeatureReader other than the results of the Directory and File Pathnames that go into it. How do I get the contents of the text files out?
Hi @garyb,
In the FeatureReader Parameters, set the Format to Text File and the Dataset to the attribute path_windows. This will read the lines from all the text files in the target folder.
Thanks Dave, but that's exactly what I've been trying to do without any luck.
My text file has 2300 rows in it, and the output from the FeatureReader also has 2300 rows in it, but they are not the contents of the text file, they're all identical and match the input coming from the Directory and File Pathnames reader.
Thanks Dave, but that's exactly what I've been trying to do without any luck.
My text file has 2300 rows in it, and the output from the FeatureReader also has 2300 rows in it, but they are not the contents of the text file, they're all identical and match the input coming from the Directory and File Pathnames reader.
The contents of the text files will be in an attribute named text_line_data. You may need to scroll right to see it. The other attributes are from the trigger feature. You may want to change the setting in the FeatureReader - Attribute and Geometry Handling - Accumulation Mode to 'Only Use Result' in order to avoid collecting all the extra attributes.
The screenshot I provided is all there is. There is no text_line_data attribute to the right.
I changed the Attribute handling to 'Only Use Result' as you suggested. I ended up with 2300 rows with no schema.
The screenshot I provided is all there is. There is no text_line_data attribute to the right.
I changed the Attribute handling to 'Only Use Result' as you suggested. I ended up with 2300 rows with no schema.
Try clicking on one of the rows, then examine the Feature Information window to see all the attributes. It may be that the text_line_data attribute is not exposed on the Generic output, but it will still be read. You can use an AttributeExposer transformer to expose it.
I think I have it now. I added 'text'line'data' as an attribute to expose under the <generic> Port, and they look like they're coming through now.
Thanks for the hint.
Yes, our messages passed each other, but I've got it now. Thanks for your help.