norbert Posted June 18, 2004 Posted June 18, 2004 I try to find a solution to import vcf Files (plain text) into a simple FM7 address database. Anyone having experiences with the import of vcf files into Filemaker? I tried to write a little script doing that job for me. Does anyone have an idea how to split a single textfile that contains all the names and addresses into single records. Usually Tabs or commas are used to devide fields, in that case vcf records are marked by "BEGIN:CARD" and "END:CARD" within the textfile thanks for your help norbert
norbert Posted June 19, 2004 Author Posted June 19, 2004 herewith a short example of a vcard (vcf) text file more about vcard specs.at: http://www.imc.org/pdi/pdiproddev.html my idea was: 1st step: import the text file into one global field, 2nd step: scan the field and split it up into records by using all the nice text functions of filemaker example: (3 records) BEGIN:VCARD VERSION:2.1 FN:James Rudi TEL;HOME:07482 4232 REV:20040618 END:VCARD BEGIN:VCARD VERSION:2.1 FN:Harald Aman N:Aman;Harald BDAY:19700617 TEL:0650 5565122 REV:20040618 X-Palm-Category1:Freunde END:VCARD BEGIN:VCARD VERSION:2.1 FN:Wolfgang Holmes N:Holmes;Wolfgang ADR:;;Presslg 9/11;Wien;Wien;1050;A LABEL;QUOTED-PRINTABLE:Pressgasse 6/11=0D=0AWien, Wien 1050=0D=0AA TEL;HOME:01 5852324 REV:20040618 X-Palm-Category1:friends END:VCARD
rogermax Posted June 19, 2004 Posted June 19, 2004 I took a long text file once and used a text editor to append (using search and replace) some xml tags, then imported the xml file. Went pretty fast and it was more comples than what your example shows. (Palm card records can be exported as csv too)
Lee Smith Posted June 19, 2004 Posted June 19, 2004 I agree with Roger, the best way to handle this is with a text editor such as BBEdit or TextWrangler for the Mac, or TextPad for Win. First you want to set up the returns between the files, I would do this with a find and replace. (i.e. find END:VCARD and replace with END:VCARD|| (those are Pipe Symbols, you could use any thing that you know will NOT appear in the data) Next do a search for ":" and replace with a (Tab or Comma) to separate the field names from the data. Next do a search for the Returns and replace with nothing. Finally do a search for || and replace with a return. Note: do this with a few samples until you get what you want. Then, all you have to do is to make certain you have a field for each one represented in your sample (or real data). HTH Lee
norbert Posted June 20, 2004 Author Posted June 20, 2004 thanks to Lee and Roger As far as I know, the only standardized address file format is the vcard format. I have to import address files from different sources (Palm, iCal, Outlook etc). Doing that with any other format but vcards means a lot of work: Import, arrange source and target fields, import, next file, rearrange fields etc. the perfect solution would be: open file, start FM script, done.
RodinBangkok Posted June 20, 2004 Posted June 20, 2004 The problem with Vcard format is the amount of fields can vary from record to record. The Vcard spec lists approximately 34 different attributes that could be placed in a vcard file. As your example shows each record contains different types of data, with no place holders for empty data ranges or attributes. This means you must interrogate each line of the input text individually, determine the proper attribute header and place the associated data in the proper field if you want an absolutely accurate parsing of the Vcard record. The Vcard spec is quite specific on delimiters, so this is quite possible without using text editors in FM. Import the Vcard into a global text field and start a script interrogating each line of the global creating a new record at each file start delimiter, then placing the subsequent attribute lines in specified fields depending on their attribute header name. Interrogating in the script for the end of Vcard delimiter, at which time you delete the text from the previous start delimiter to the end in the global and loop back. Use the quantity of end file delimiters to terminate the loop. You can ignore any unwanted attributes if you know you only want certain ones. You can find the Vcard spec via google Vcard format specification. Sorry for the general explanation, but no time now to script this out.
norbert Posted June 21, 2004 Author Posted June 21, 2004 thanks rodin. thats what I suggested in my second post as well, >my idea was: >1st step: import the text file into one global field, >2nd step: scan the field and split it up into records by using all the nice text functions of filemaker I also found a way to import a vcf file into FM. (import line by line into records (up to 35 records for one full address), gather all the records into one global fiield. Im working now on the interrogating routines. will post it if anyone is interested.
Newbies elite7 Posted July 12, 2004 Newbies Posted July 12, 2004 I would be very interested in the script that you propose to post. Thanks in advance
cjaeger Posted July 16, 2004 Posted July 16, 2004 Just remember that the CR Character is not alswas CR but can be also CRLF or just LF. The parsing is quite easy: run a script which copies anything between BEGIN:VCARD and END:VCARD into a new record, then parse into fields using the word before ":" as the identifier. googling around, you will find some open FileMaker solutions for parsing the result of html form emails. Just change the identifiers and delimiters to the VCARD ones. However, doing this in perl or bbedit is way quicker!
Recommended Posts
This topic is 7436 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now