Jump to content
Server Maintenance This Week. ×

Extract data from Mysql (Wordpress) meta_value field


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

Recommended Posts

I have been using Filemaker for many years, but just recently connected Filemaker Pro 12 to a Wordpress database with ODBC and am confronted with trying to extract data from a meta_value field. I don;t have a clue!!!

 

Do I use EsecuteSQL?

 

Here is the example:

 

I have a meta_key of custom_field

and the meta_value is

a:5:{s:5:"phone";s:14:"(xxx) xxx-xxxx";s:16:"terms_conditions";s:1:"1";s:13:"refund_policy";s:523:"Since Company is offering non-tangible, irrevocable, digital goods; we generally do NOT issue refunds. During checkout, upon clicking the "Submit" button, your purchase is charged to the credit/debit card that you supplied. If you are taking advantage of our Free Trial, your credit card will not be charged until the 15 day trial period has ended. You may cancel your Free Trial any time before 15 days. All sales are final. You cannot cancel a purchase or receive a refund for a purchase after your Free Trial has ended.";s:16:"how_did_you_hear";s:10:"Web search";s:11:"member_type";s:5:"Trial";}

 

All the way at the end, I am trying to extract into a new calculation field "member_type";s:5:"Trial".

 

If someone can show me how to do this, it will help me extract data from other meta_value.

 

Thanks in advance for your help - Sam

 

Link to comment
Share on other sites

This question is not really about ESS or ExecuteSQL -- if I understand correctly, you have a block of text and you want to extract a portion of it.

 

I'd suggest you go to http://www.briandunning.com/filemaker-custom-functions/ and search for "parse" -- that should get you started.

Link to comment
Share on other sites

This (extracting a specific part from a given text) is actually rather trivial. The problem here is that we only have one example and no indication what is constant in the given text. Normally, you would define the task in terms such as 'extract the part in quotes immediately after the last occurrence of "s:11:"' (returning "member_type" in your example), or similar.

 

Once you have that, it's easy to use Position() to find the start and end points of the desired part, and Middle() to extract it - see, for example:

http://fmforums.com/forum/topic/59491-advanced-text-calculation/#entry281168.

Link to comment
Share on other sites

This topic is 3554 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.