[FX.php List] FMNew through portal

Chris Hansen chris at iViking.org
Thu Jul 7 14:53:39 MDT 2005


Ahhh,

Good question.  This may actually come in handy for many on the list.  
I believe this data IS in the documentation, but I'm not sure.

Basically, adding or editing records in a portal requires a special 
syntax (in your case this wouldn't be an issue except for the FM bug.)  
To add a record to a portal append a '.0' (period - zero) to the field 
name, like this:

$fx->AddDBParam('LineItem::ProductName.0', 'Newsprint 11 x 17');
$fx->AddDBParam('LineItem::Quantity.0','200');
$fx->AddDBParam('LineItem::Pages.0', '4');
$fx->AddDBParam('ShipMethod', 'Ground');

Note that the trailing zero needs to be appended to the name of each 
field in the portal.  Also, only one record can be added per query to 
the portal.  (This is all related to the way that things are handled by 
FileMaker internally.)

An edit of a field in a portal is similar.  When editing, a '.n' is 
appended to the field name, where 'n' is a number representing the 
portal row that you are editing.  In FileMaker 5/6, 'n' is simply the 
number of the row of the portal that you want to edit -- so to edit the 
third row in the portal, append a '.3'.  For FileMaker 7, on the other 
hand, the recordID is used (use a calc field to get this value for a 
portal row.)  That means that if you were connecting to an FM7SA 
machine, and wanted to edit a record in a portal whose recordID was 
'12', you would append a '.12' to the field name.

I hope that makes some sort of sense.  I'll see if I can't streamline 
this in the next release of FX.php =)

Best,

--Chris Hansen
   creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org

On Jul 7, 2005, at 1:23 PM, Adam Gamble wrote:

>  Chris,
>
>  I had this message back in june.
>
> Here is the problems i'm having I have a layout that contains fields
> from several different tables. I want to create a record in this
> table that also puts values in the fields that have a relationship to
> that table. Even though the data returned back from fx.php shows the
> field LineItem::product when i try to place data in the field it says
> that the field isn't there.
>
> So the question is it possible to create a new record and it also
> create a new record on the tables that have a relationship to the
> original one that is contained in the layout?
>
> I changed the fields to be inside a portal but i'm still get error 102 
> (Field Missing)
>
> here is my php code:
>
> $fx->AddDBParam('LineItem::ProductName', 'Newsprint 11 x 17');
> $fx->AddDBParam('LineItem::Quantity','200');
> $fx->AddDBParam('LineItem::Pages', '4');
> $fx->AddDBParam('ShipMethod', 'Ground');
>
> $ReturnedData = $fx->FMNew();
>
> It's the LineItem:: ones that mess it up, if I only do the ShipMethod 
> field it works
> this is confusing to me. Is :: the way you insert a record through a 
> portal?
> Thanks for any help
> Adam
>
>
> _______________________________________________
> 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