[FX.php List] creating an export file

Eric Pingel epingel at webmail.pella.k12.ia.us
Fri Apr 29 10:00:10 MDT 2005


Thanks Dale!
I messed around with with the phphclass DC posted yesterday, but couldn't
get any results.  I tried Spreadsheet_Excel_Writer this morning and got it
to work.  The Area Educational Agency that supports our school district
has a prototype student differentiation tool, built in Excel, that we are
piloting for them.  Our curriculum coordinator need to input various
pieces of student data and test scores into this prototype.  My intentions
are to let him choose the data he need to copy into the prototype from a
form.  When submitted the form will actually produce the excel spreadsheet
he can download and use with the prototype.
Below is the code I used to get the data from fmp (6.0 unlimited) and
output it into an excel spreadsheet.  Let me know of any improvements, I
am a php newbie.
Thanks again Dale and DC.

<?php
require_once 'Spreadsheet/Excel/Writer.php';

include_once($HTTP_SERVER_VARS['DOCUMENT_ROOT'] .
"/student_profile/fx/FX.php");
$serverIPAddress = '##########';
$currentDatabase = '##########';
$layout = 'Layout #1';
$groupSize = 'all';
$f6 = '2';
$ind_search = new FX($serverIPAddress);
$ind_search->SetDBData($currentDatabase,$layout,$groupSize);
$ind_search->AddDBParam(f6, $f6);
$ind_search->AddSortParam(f8);
$ReturnedData = $ind_search->FMFind();

// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();

// sending HTTP headers
$workbook->send('2nd_tut.xls');

// Creating a worksheet
$worksheet =& $workbook->addWorksheet('2nd Grade Data');

// The actual data
$worksheet->write(0, 0, 'ID Number');
$worksheet->write(0, 1, 'Last Name');
$worksheet->write(0, 2, 'First Name');
$worksheet->write(0, 3, 'Grade');
$worksheet->write(0, 4, 'Teacher');
$worksheet->write(0, 5, 'PR Reading Comprehension');
$worksheet->write(0, 6, 'PR Reading Vocabulary');
$r = 1;
foreach ($ReturnedData['data'] as $value) {

	$worksheet->write($r, 0, $value['f13'][0]);
	$worksheet->write($r, 1, $value['f8'][0]);
	$worksheet->write($r, 2, $value['f9'][0]);
	$worksheet->write($r, 3, $value['f6'][0]);
	$worksheet->write($r, 4, $value['f4'][0]);
	$worksheet->write($r, 5, $value['f87'][0]);
	$worksheet->write($r, 6, $value['f86'][0]);
$r++;
}

// Let's send the file
$workbook->close();


?>
> Hi Eric,
>
> I use Spreadsheet_Excel_Writer. It allows you to produce formatted
> Excel files on the user's desktop from PHP code, and by extension,
> FileMaker data. I have implemented this for two clients, who absolutely
> love it!
>
> http://pear.php.net/package/Spreadsheet_Excel_Writer
>
> Hope this helps,
> Dale
>
>
> --
> Dale Bengston
> Streamline Studio, LLC
> 2822 Mason Street
> Madison, WI 53705
> 608.212.8151
> dbengston at streamline-studio.com
> www.streamline-studio.com
>
> On Apr 25, 2005, at 2:35 PM, Eric Pingel wrote:
>
>> I am trying to create and export file using fx.php.  I have a
>> FileMaker 6
>> Unlimited database connected to users via fx.php.  I am looking to have
>> the users select various database fields and create an export that they
>> can then use in Excel.  I have used a script for php/mysql and it works
>> there, but porting it over to fx.php/fmpro has given me trouble.  Does
>> anyone have any ideas as to how to create an .xls file from fx.php?
>>
>> --
>> Eric Pingel
>> Instructional Technologist/Webmaster/DBA
>> Pella Community School District
>> 210 E. University
>> Pella, IA 50210
>> http://www.pella.k12.ia.us
>> (641)628-3870 work
>> (641)780-1503 cell
>> _______________________________________________
>> 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
>


-- 
Eric Pingel
Instructional Technologist/Webmaster/DBA
Pella Community School District
210 E. University
Pella, IA 50210
http://www.pella.k12.ia.us
(641)628-3870 work
(641)780-1503 cell


More information about the FX.php_List mailing list