![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. Any help/guidance/book suggestion/plugin/etc would be appreciated! TIA! -Jeff Comp.db.fmpro @ brightenyourcorner.com |
#3
| |||
| |||
|
|
New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. |
#4
| |||
| |||
|
|
Jeff Conley <comp.db.fmp (AT) brightenyourcorner (DOT) com> wrote: New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. In versions of FM before 7, I would have used the Set Field, Middle, and Position functions to parse out this text. 7 gives more options, and I might take the easy way and use Set Field and Middle Values, which would capture an entire line, and then Substitute to get rid of the "FirstName: " strings. |
#5
| |||
| |||
|
|
New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. Any help/guidance/book suggestion/plugin/etc would be appreciated! TIA! |
)
#6
| |||
| |||
|
| On 6/2/2005, Jeff Conley wrote: New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. Any help/guidance/book suggestion/plugin/etc would be appreciated! TIA! -Jeff Comp.db.fmpro @ brightenyourcorner.com You'll want to take a look at the various text functions. If, for instance, you use the Position function to find the location of the entry element in the string, you can build a calc that takes the two characters following it and puts them in a certain field. For instance, in a string YourField of any length, you have "State: VT" (the word "State" followed by a colon and a space then the state code), you want the two characters starting at the seventh character after the start of "State: ", like so: xxxxxx xxxxx xxxx xxxx State = VT This calculation Middle ( YourField ; Position ( YourField ; "State: "; 1; 1) + 7; 2) will return "VT" Matt |
#7
| |||
| |||
|
|
Hi Matt, I always do this sort of thing creating a filemaker database with one text field in it. Call it Import Field or something like that. I then import the file, which results in one line of text per record. I then write a script with a loop in it that skips through the lines looking for things I know should be there. Your example is a really good candidate for this, because you have predictable text, like "Firstname: " I delete all records that are junk, like the one that says "The results of your request are below:" I then create a bunch of calculation fields that use text parsing functions to fill the info I'm looking for. Here's a quick example in FM 7. I've named the field "FirstName" and it's a calculation with the following formula: If ( Left ( Import Line; 9) = "FirstName"; Trim ( Middle ( Import Line; Position ( Import Line; ":"; 1; 1)+1; 100)); "") That would yield "John" in your example below I might also use the "replace" command to fill a field like "Customer_ID" or something so I could create the relationship between my customers file and this record. Maybe that jumpstarts your thinking on this. It's somewhat tedious to make a formula like this for every field, but I have done it a lot when converting unusually formatted text files into databases, and once you get it all scripted, it's worth the effort, because you then just run a script and the data shows up where it's supposed to be. Some functions to look at are Left LeftWords Middle MiddleWords Position Replace Right RightWords Substitute Trim Wordcount I hope this helps, Ron "Matt Wills" <I'm (AT) Witz (DOT) end> wrote in message news:8KBne.6286$zb.5730 (AT) trndny06 (DOT) .. On 6/2/2005, Jeff Conley wrote: New to FMP - and LOVE it so far! Playing with receiving email - and that seems to work good - except I'd like to parse data into individual fields from a web form - for contact management. (i.e. The results of your request are below: FirstName: John LastName: Doe Street: 123 Main St City: MyTown State: MYState Zip: 12345 Phone: 123-456-7890 Email: jdoe (AT) aol (DOT) com ) Have worked with DB's quite a bit - but have never had to parse data like this before. Any help/guidance/book suggestion/plugin/etc would be appreciated! TIA! -Jeff Comp.db.fmpro @ brightenyourcorner.com You'll want to take a look at the various text functions. If, for instance, you use the Position function to find the location of the entry element in the string, you can build a calc that takes the two characters following it and puts them in a certain field. For instance, in a string YourField of any length, you have "State: VT" (the word "State" followed by a colon and a space then the state code), you want the two characters starting at the seventh character after the start of "State: ", like so: xxxxxx xxxxx xxxx xxxx State = VT This calculation Middle ( YourField ; Position ( YourField ; "State: "; 1; 1) + 7; 2) will return "VT" Matt |
#8
| |||
| |||
|
|
New Record/Request Set Field [First_Name; (See Calc Below)] Set Field [Last_Name; (See calc below, with minor change to the TagName)] etc. The calc would be something like this ("something like" because I just wrote this in the emailand so it has not been tested or debugged): Let( [ TagName = "FirstName"; TagLength = Length(TagName)+3; StartPos = Position(gPastedText, TagName, 1, 1) + TagLength; EndPos = Position(gPastedText & "¶", "¶", StartPos, 1)-1; TextLength = EndPos - StartPos ]; Middle(gPastedText, StartPos, TextLength) ) |
#9
| |||
| |||
|
|
is an 'or' 29 matches '20 |
![]() |
| Thread Tools | |
| Display Modes | |
| |