[FX.php List] About scripts

nicholas fowlie nickfowlie at hotmail.com
Thu Sep 28 08:35:49 MDT 2006


A general remark regarding running FM Scripts - The times I've used them they have been fine, though I've only used them to refine what is returned in 'find' data set. Once retrieved back into PHP,  I do the processing of the data it's self. It's useful to use FM scripts to do this so in a find  request I can use 'relationships'  plus 'and' /'or' searches can be performed more easily in FM than can be done from PHP via FX.

What is imperative is that you ensure any FM function/process step you use in the FM script is 'WEB COMPATIBLE' if it is not then depending on you FM settings, the script will either stop dead and return incomplete or skip the incompatible set/function (FX does not return an error cos the script ran), this is why you can get weird results. In FM 8+ (not sure about earlier versions) you can check a scripts web-compatibility by checking the box to the bottom right of the Script editor screen, once checked all incompatible parts are grayed out.

Hope this helps.

  ----- Original Message ----- 
  From: Jonathan Schwartz<mailto:jonathan at eschwartz.com> 
  To: FX.php Discussion List<mailto:fx.php_list at mail.iviking.org> 
  Sent: Monday, September 25, 2006 8:55 PM
  Subject: Re: [FX.php List] About scripts

  Thanks for the heads up.  I think that I'll steer clear of scripts 
  and go with Plan B.. or perhaps Plan C. ;-)

  Here's the run down...

  This is Ver2 of my first fx project, a school directory. There is a 
  Households table, a Contacts (parents) table and a Students table. 
  Finally, there is a Family table, which sits on top of the three 
  other tables.  It is summary data from the Family table that is 
  desired.  The data desired is compilation of the each Households and 
  the Contacts and Students associated with each.  In short... names 
  and addresses of who lives where.

  In ver1 of this project, I used a completely flat file.  All data was 
  on one table. It was easy to implement in fx.  After the users did 
  their data entry and edits, I split the data into the multiple 
  tables.  But, that pulled the plug on any further data entry into the 
  online system, once the data was exported.

  This year, in ver 2, I went the "high road" and implemented a 
  relational system where data is entered directly into the various 
  tables by online entry.  However, the challenge is how to pull the 
  data back into the Families table (in real time) so that the user can 
  proof read the result

  Plan A was to use a series of scripts which pulled the data from the 
  related tables up into the Family table.  I planned to run the script 
  once all the edits were complete.  Per my earlier post, I'm getting 
  flaky results with the the scripts.

  Plan B could be just to use calc fields to extract the table data 
  from each table.  With a max of 2 households, 2 contacts per 
  household and up to 5 students per house (yup!), the calcs are finite.

  Your email prompted a third option, Plan C: to interrogate the tables 
  in php with For Each loops and extract the data that way. Perhaps 
  create an array for each table and then populate the Family values 
  from the arrays.  Or, just populate the data right into the desired 
  fields as the data is processed. See end result below:

  Students Stu1 Stu2 Stu3 Stu4 Stu5...

  Street1 City1 State1 Zip1 Phone1
  ContactFirst1 ContactLast1 ContactEmail1 ContactCell1
  ContactFirst2 ContactLast2 ContactEmail2 ContactCel2

  Street2 City2 State2 Zip2 Phone2
  ContactFirst3 etc
  ContactFirst4 etc

  Think that I'll try it now...;-)

  Will yell if I have trouble.


  >my advice about using scripts was because of performance issues. it 
  >blocks access to all FMP WPE for all other requests for as long as 
  >the script runs. as far as performance flaws goes, there is some 
  >getting used to calling scripts because of the fact that multiple 
  >requests to the db through FX (as in not using prefind for instance) 
  >are not treated the same way with reference to globals - FMP global 
  >fields  are cleared (reset to default) each new FX request.
  >you're probably better off doing whatever you are trying to do in 
  >PHP anyway... can you spell it out and maybe someone here can give 
  >you a tip?
  >On Sep 25, 2006, at 7:40 PM, Jonathan Schwartz wrote:
  >>I'v heard recent advice not use scripts.  I'm not sure if it was 
  >>because of performance slowdowns or performance flaws.
  >FX.php_List mailing list
  >FX.php_List at mail.iviking.org


  Jonathan Schwartz
  FileMaker 8 Certified  Developer
  Associate Member, FileMaker Solutions Alliance
  Schwartz & Company
  jonathan at eschwartz.com<mailto:jonathan at eschwartz.com>

  FX.php_List mailing list
  FX.php_List at mail.iviking.org<mailto:FX.php_List at mail.iviking.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060928/8906cf56/attachment.html

More information about the FX.php_List mailing list