First post here.  Import of Folder of Text Files

Discussion created by dreed on Aug 9, 2012
Latest reply on Aug 16, 2012 by dreed



I've been away from Filemaker for a while, but recently had reason to use it for processing some text based files. The files are .sdf files which are text files containing the atomic coordinates of 2D chemical structures along with a bunch of metadata fields about the molecule. The file may contain any number of individual structure records, delimited by a line containing only "$$$$"


My task is to split these records into individual filemaker records and then parse out the desired metadata and structure data into individual fields. I've pretty much got everything working, except that I now realize that when using the Folder Import to get the whole contents of the file into a temp field for processing, Filemaker is doubling all the return/line feed characters. I tried all the encoding options in the import dialog with no difference in result. The extra returns really only matter when further using the structure coordinates with other programs that interpret this as .mol text. The extra return characters don't work there.


So I see two options to fix this problem:


1. Copy and paste the text contents into the temp field rather than using Import Folder (inelegant because I would like to just have a drop folder to pull new files from)

2. Get rid of the doubled return characters after import, either in the temp field, or in the extracted .mol text. I can't figure out the second option as my attempt to strip using


Substitute ( FieldName; "¶¶"; "¶")


didn't work. I'm not sure how to identify the pattern of two returns in a row. Patterncount(field;"¶") finds all the returns, but Patterncount (field;"¶¶") finds nothing.


I suppose a third option is to find another way to pull in the text files that doesn't use import folder or copy/paste, like a plugin, but I'd rather leave that option for last...


The file is attached here, thanks for looking!