[FX.php List] Search Results To Text File

Steve Winter steve at bluecrocodile.co.nz
Thu Jul 9 14:00:54 MDT 2015


Hi Patricia

So - if you’re already using FX, then it should be pretty simple. In pseudo code

create a brand new layout and place the fields you need to export, in the order you need to export them on that layout from top to bottom (this may sounds mad, but what it will mean is that when the FX array of records comes back the fields will be in the right order)
do a find for the records which need to be exported
use http://php.net/manual/en/function.fopen.php <http://php.net/manual/en/function.fopen.php> to create a file resource
feed the file resource and the FX array of returned records into http://php.net/manual/en/function.fputcsv.php <http://php.net/manual/en/function.fputcsv.php> which Joel suggested
close the file using http://php.net/manual/en/function.fclose.php <http://php.net/manual/en/function.fclose.php>

HTH
Steve



> Hi Steve (and Joel),
> 
> We are currently using FMS 11Adv, but have plans to upgrade to 14 as soon as budget is approved (as fast a herd of turtles around here).
> 
> That robot has been in use using a script running plug-in for years, importing orders from the web, then creating a csv of certain info for our PeopleSoft folks to import into their inventory system (which is why ODBC is not an option).  They have very specific formatting that they must have or their import will fail.
> 
> Anywho.... I have replaced the import portion of it through FX, but haven’t yet figured out how to do the export part.
> 
> Thanks again for your responses!
> 
> Trish 
> 
> 
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Steve Winter
> Sent: Thursday, July 9, 2015 3:36 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] Search Results To Text File
> 
> Hi Patricia
> 
> There are many different ways to solve this problem ;-)
> 
> Which version of FM server are you using…? it’s certainly possible with both 13 and 14 to export records to csv with a server-side script, so this is going to be the simplest way to go about it.
> 
> Otherwise either FX or the PHP API could also be used with a scheduled task.
> 
> Cheers
> Steve
> 
> 
>> Hi Group!
>> 
>> Is there a way, using fx.php to create a csv text file of search results on the FM or web publishing server?
>> 
>> Example of how we need the results,
>> 
>> "FSU01","TSR0002216","Information Technology Services (ITS) - ","TSR","OTC","OTC","2","OPEN","","07/06/2015","07/06/2016"
>> "FSU01","TSR0002316","Arts & Sciences College of - ","TSR","OTC","OTC","2","OPEN","","07/08/2015","07/08/2016"
>> "FSU01","TSR0002916","Information Technology Services (ITS) - ","TSR","OTC","OTC","2","OPEN","","07/09/2015","07/09/2016"
>> "FSU01","TSR0003016","Alumni Association - ","TSR","OTC","OTC","2","OPEN","","07/09/2015","07/09/2016"
>> 
>> We presently have a "script robot" set up that exports a file every 1/2 hour within a FM client.  We are trying to get rid of that FM installation and automate it through php.  I was actually trying to run a FM script through FM Server, but it seems export is not a permitted script step for server script scheduling.
>> 
>> Any assistance would be greatly appreciated!
>> 
>> Trish
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> Steve Winter
> +44 777 852 4776
> steve at bluecrocodile.co.nz
> 
> 
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

Steve Winter
+44 777 852 4776
steve at bluecrocodile.co.nz



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20150709/e1973690/attachment.html


More information about the FX.php_List mailing list