By capturing the parent ID in a variable, going to a layout of the child table, creating a new record, setting the foreign key to the parentID from the variable, and returning to the original layout.
yah,, i agree with erolst.that the easy way to do.you also can use auto complete and $$ to make your script more simple and short.
And if you want tuning your performance, use Perform script on server(If you have fm server)
You say you have: "fields from parent and child tables on the same layout", but wish to "insert a record without using a portal".
Without a portal you will only ever see data from the first child record in any field on the parent layout. The whole idea of portals is to enable you to view ALL related records. Furthermore, provided you have the relationship set to allow creation of related records, you will be able to add child records right there in the portal.
That sounds like it would work.
I am new to file maker and am still learning scripting syntax. Can you provide an example of syntax plese?
This sounds like a great solution. Howevere I am new to FileMaker and do not know how to create a portal yet. I am going to learn though
For this present chalenge I am attempting to do this without the use of a portal.
Instead of asking all sort of questions where you insist on doing things without portals, you would be better advised to bite the bullet and learn what portals are, how they work and what you can do with them.
Otherwise you might as well ask for advice on how to achieve things in FileMaker without using relationships.
As to your issue of creating related records … in your example
Parent Table: Deliverables
Child Table: Tasks
to create a child Task for the Deliverables parent, you'd write a script along the lines of
Set Variable [ $id ; Deliverables::Deliverable_id_pk ]
Go to Layout [ Tasks ( Tasks ) ]
Set Field [ Tasks::Deliverable_id_fk ; $id ]
Go to Layout [ original ]
which you would (obviously) launch from a Deliverables layout.
Note how these five steps reflect exactly what I described in my first post; only now it's in proper FileMaker syntax, instead of in English.
Creating a portal is very straightforward—
1. Select the portal tool (see screenshot), then drag out a portal of roughly the size and in roughly the area on your layout where you think you will put it (you can always adjust it later). Alternatively you can use the menu Insert –> Portal.
2. You will then be presented with a Portal Setup dialog where you choose the relationship, or table occurence (TO) for the records you want the portal to display (essential) and some other choices (optional, although if you expect there to be more related records than the portal will display a vertical scroll bar is necessary). You can always come back to this dialog later just by double clicking on the portal.
3. When you hit OK you will then be presented with another dialog to select the fields to be displayed from the related table. Note: you only get this dialog when creating the portal; if you want to change this later you have to use the field picker.
4. That's it. FM creates the portal with the relationship and fields you have chosen.
5. Carefully read and understand the post by erolst.
or... why not you just open a "Asset" file from starter solution in fm13, try to make "check-out" in Layout name "asset detail".
maybe you have idea how easy this thing.
*if you used FM developer just debug it.
ooo... i see.
keyword is right, Creating a portal is very straightforward.
and filemaker is great.