[FX.php List] Another Request for FX.php (version 4.0) feedback

Derek Bastille bastille at arsc.edu
Sat Jun 4 21:59:02 MDT 2005


   D'oh!  Sorry, right after I hit send, I realized that I set the 
return types to the same as for returndataset.  Sorry.  Perhaps, naming 
the return types with FX_TYPE_OBJECT, FX_TYPE_FULL and FX_TYPE_BASIC  
would work:
     $myData = $myQuery->DoFXAction(FX_ACTION_FIND, FX_RETURN_DATA, 
FX_ARRAY_ALL, FX_TYPE_OBJECT);

   The general idea is to disambiguate things with the constants.  Feel 
free to substitute what makes sense to you.  :-)

Regards,
   Derek

On Jun 4, 2005, at 6:08 PM, Derek Bastille wrote:

> Chris,
>   This looks like it will certainly simplify the 'do it' commands.  
> However, I think that it would be helpful to specify where each 
> constant is used in the constant itself.  That is, it is intuitive 
> that FX_RETURN_DATA and FX_RETURN_NULL are options for $returnDataSet, 
> but not so clear for the other constants (like FX_FULL could be 
> interpreted for $useInnerArray or $returnType).
>   So how about:
> Inner_Array__
> FX_ARRAY_ALL = true
> FX_ARRAY_SINGLE = false
>
> Return_Type__
> FX_RETURN_OBJECT = 'object'
> FX_RETURN_FULL = 'full'
> FX_RETURN_BASIC = 'basic'
>
> Action_Type__
> FX_ACTION_FIND
> FX_ACTION_FINDALL
> FX_ACTION_OPEN
> FX_ACTION_CLOSE
> FX_ACTION_NEW
> FX_ACTION_EDIT
> FX_ACTION_DUPLICATE
> FX_ACTION_DELETE
>
>   These would be a bit more typing than before, but I think that they 
> would be more clear:
>
> $myData = $myQuery->DoFXAction(FX_ACTION_FIND, FX_RETURN_DATA, 
> FX_ARRAY_ALL, FX_RETURN_OBJECT);
>
>  Lastly, could you review briefly, what the difference between 'full' 
> and 'basic' would be?
>
> Thanks!  FX.php has been a _huge_ help for me and also lets me farm 
> out parts the web stuff to other php-savvy staffers (who don't know 
> the internals of FileMaker databases) and concentrate on developing 
> other DBA duties.
>
> Regards,
>   Derek
>
> On Jun 4, 2005, at 11:04 AM, Chris Hansen wrote:
>
>> Johan,
>>
>> Good call!  I don't know that it would make sense to supply constants 
>> for every function (where applicable), but I think it certainly makes 
>> sense in this case.  Of course, the tricky part is using constants 
>> that are easy to remember for people.  I would like to (1) avoid 
>> abbreviations, and (2) start each constant name with 'FX_' -- to 
>> avoid possible conflicts with other constants.  How do the following 
>> sound for each parameter:
>>
>> Data_Return__
>> FX_RETURN_DATA = true
>> FX_RETURN_NULL = false
>>
>> Inner_Array__
>> FX_PORTALS = true
>> FX_FIELDS = false
>>
>> Return_Types_
>> FX_OBJECT = 'object'
>> FX_FULL = 'full'
>> FX_BASIC = 'basic'
>>
>> Please note that I'm not stuck on any of these constants' names.  The 
>> inner array particularly is hard to name since it can be looked at 
>> multiple ways: inner or outer (depending on point of view), repeating 
>> fields or portals versus normal fields, etc.  What is easy to 
>> remember?
>>
>> Also, for clarification, very basic examples of both the current and 
>> new search styles (using defaults) follow:
>>
>> _CURRENT___
>> $myQuery = new FX($FileMakerIP, $FileMakerPort, 'FMPro7');
>> $myQuery->SetDBData('MyDatabase', 'MyWebLayout');
>> $myQuery->AddDBParam('CustomerID', $_POST['ID'], 'eq');
>> $myData = $myQuery->FMFind();
>> ...
>> foreach ($myData['data'] as $key => $value) {
>>     echo("$value['FirstName'][0] $value['LastName'][0]");
>> }
>>
>> _NEW______
>> $myQuery = new FX($FileMakerIP, $FileMakerPort, 'FMPro7');
>> $myQuery->SetDBData('MyDatabase', 'MyWebLayout');
>> $myQuery->AddDBParam('CustomerID', $_POST['ID'], 'eq');
>> $myData = $myQuery->DoFXAction(FX_FIND);
>> ...
>> foreach ($myData as $key => $value) { // the 'data' index is not 
>> needed with the object return type
>>     echo("$value['FirstName'] $value['LastName']"); // no trailing 
>> [0] here =)
>> }
>>
>> Thoughts?  Thanks again for the feedback!
>>
>> --Chris Hansen
>>   creator of FX.php
>>   "The best way from FileMaker to the Web."
>>   www.iViking.org
>>
>> On Jun 4, 2005, at 12:11 PM, Johan Visser wrote:
>>
>>> Chris,
>>>
>>> Although I do not understand the $useInnerArray parameter yet, here 
>>> is some
>>> feedback.
>>>
>>> The action constants make the call very clear now, can't you do the 
>>> same for
>>> the other parameters in the function call.
>>> I find the true/false mean nothing at first glance, unless you look 
>>> up the
>>> documentation.
>>>
>>> So
>>> $currentData = DoFXAction(FX_FIND, true, false);
>>> can become:
>>> $currentData = DoFXAction(FX_FIND, RET_DATA, USE_OUTER);
>>>
>>> this makes the call in all its variations even easier to read.
>>>
>>> Keep up the good work,
>>>
>>> Johan Visser
>>> BPA Services, NL
>>>
>>>
>>>
>>>
>>>
>>> -----Oorspronkelijk bericht-----
>>> Van: fx.php_list-bounces at mail.iviking.org
>>> [mailto:fx.php_list-bounces at mail.iviking.org]Namens Chris Hansen
>>> Verzonden: zaterdag 4 juni 2005 19:40
>>> Aan: FX.php Discussion List
>>> Onderwerp: [FX.php List] Another Request for FX.php (version 4.0)
>>> feedback
>>>
>>>
>>> Greetings List!
>>>
>>> I hope everyone will give this message a read, regardless of FX.php
>>> experience level.  I really value your feedback!  If you'd like to
>>> comment, but would prefer not to post to the list, feel free to 
>>> respond
>>> to me directly.
>>>
>>> I've received a contribution from a fellow named Chuck Chang to add
>>> https support for connecting to FM7SA.  (This is a great new feature 
>>> of
>>> FM7, so kudos to Chuck for his contribution.)  Very nice!  That said,
>>> he also suggested that perhaps the FX declaration is not the place to
>>> specify the return format (i.e. whether or not to add that last layer
>>> of the array) and I think I agree with him.  Here's what I propose:
>>>
>>> * In the new version I've added this function:
>>>
>>> function DoFXAction($currentAction, $returnDataSet = true,
>>> $useInnerArray=false, $returnType = 'object')
>>>
>>> * This is used in conjunction with come new constants, like this:
>>>
>>> $currentData = DoFXAction(FX_FIND, true, false);
>>>
>>> * You'll note that now there's no need to remember multiple action
>>> functions.  Each action constant should be logical to remember:
>>> FX_OPEN, FX_CLOSE, FX_DELETE, FX_DUPLICATE, FX_EDIT, etc.  No
>>> abbreviations.  Easy?
>>>
>>> * $useInnerArray can default to false, since this is a new function.
>>>
>>> * This does mean that support for removal of this last level wouldn't
>>> be present in the old functions, but old code wouldn't use this 
>>> anyway.
>>>
>>> * You might also note that new value -- object -- for $returnType.
>>> Basically, after the last discussion about removing the top level of
>>> the array (while mowing the lawn =), I realized "hey! this is an
>>> object.  People can pull error data, etc. by using class variables!"
>>> So, for the new function, the default return type will be 'object'
>>> which will return just the data.  I'll add new class variables for 
>>> the
>>> other elements of the top level array.  True there will be some minor
>>> variable semi-duplication, but some functions need to work with the
>>> existing class variables, whereas the new ones will ONLY be set just
>>> before data return.
>>>
>>> * With the new function, an error object will ALWAYS be returned on 
>>> an
>>> error, even for FileMaker errors.
>>>
>>> * The original action functions are STILL THERE for those who want 
>>> the
>>> easiest way to access complex FileMaker data.
>>>
>>> * Support for the new object return type will be added to the 
>>> original
>>> action functions.
>>>
>>> I realize that's a lot to sort through, but I really would like lots 
>>> of
>>> feedback on this.  My hope is that these additions/changes will do
>>> three things:
>>>
>>> 1) simplify coding (one function to remember, with logical action
>>> constants)
>>>
>>> 2) simplify data handling (by stripping away extra, often 
>>> unnecessary,
>>> data in the return when desired)
>>>
>>> 3) add power (by doing the above and ALWAYS returning an error for 
>>> any
>>> error)
>>>
>>> I really appreciate any feedback, and thanks for reading through this
>>> monster message.
>>>
>>> Best,
>>>
>>> --Chris Hansen
>>>    creator of FX.php
>>>    "The best way from FileMaker to the Web."
>>>    www.iViking.org
>>>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                         Derek Bastille | Phone: (907)450-8643
>     PO Box 756020, Fairbanks AK, 99775 | Fax:   (907)450-8601
>    Arctic Region Supercomputing Center | email: bastille at arsc.edu
> User Services Consultant/ISSO-Accounts |        fndlb at uaf.edu
>      PGP public key: http://www.arsc.edu/~bastille/dereksKey.txt
> ----------------------------------------------------------------------
>     ARSC Help Desk:  email: consult at arsc.edu  voice: (907)450-8602
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list