Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8043 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi, was wondering if you FM gurus would help me with something.

I'm trying to parse an html form e-mail response. The html form has several fields like: 1a, 2a, 3a, 3a1, etc. I have all the fields setup in FM corresponding to all the form fields.

The question is, can I paste the e-mail response into a text field in FM and then have FM go through each line and match up the text and fields?

A typical e-mail response would be...

1a = Yes

2a = No

3a1 = Yes

4a = No

My FM fields are...

1a, 2a, 3a, 3a1, 4a.

As you can see, the html e-mail response might not return all the fields that are in my FM database.

Thanks,

Kermy

Posted

One way might be to set the responses up so that the include a fiels identifier in them... then parse looking for the field identifier. Or, ensure that the responses always included all fields.

Posted

Well the form's e-mail response gives me the field name seperated by a "=" and then the value. But the problem is that the e-mail might not have some of the fields returned if the user doesn't check one of the checkboxes.

Posted

I would import the file into a special FM file intended just for this import process.

It would have one data field called "iLine" (imported line).

Then two calculated fields:

cField = Left(iLine, Position(iLine, " = ", 1, 1) -1

cValue = Right(iLine, Length(iLine) - Position(iLine, " = ", 1, 1) -2)

Then you write a script SetFields (or "CreateNewWhatever") in this import file that loops through the records and does a series of If checks on cField and then a set of the appropriate field in your real file to cValue.

One more script might make sense: DoIt, which deletes all records and then does the import from a specified email file, and then invokes the SetFields script.

HTH.

Posted

Hi kennedy, thanks for the tips, but wondering if you have a sample script like is that? Relative newbie to FM scripting.

Thanks =)

Posted

Well, generally when doing such a import file, I am importing from one proprietary format into another. In pseudo-english:

Show All Records

Go to Record [First]

Loop

If [ cField = "1a" ]

SetField("1a", cValue)

Else

If [ cField = "1b" ]

...

End If

End If

Go to Record [Next, Exit Loop If Last]

End Loop

Now to make that more robust, you might want to change the simple SetField to check first if the field has already been set and the respond appropriately (the email has two lines setting the same field). After the loop you may want to check for unset fields. Or before the loop, you may want to set defaults up.

HTH.

Posted

Thanks for your help, but wondering if you can take a look at the database. It doesn't exactly work tho. Maybe it'll help to clarify my situation.

As you can see, I have that field "BigTextField" that has information copied and pasted from an e-mail. And I have the other fields. From the Parsing script, it would search for "Name = " in the "BigTextField" and then I was hoping it would return everything to the right of "Name = " up till the next line to the "Name" field.

Test.zip

This topic is 8043 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.