In article <1161369000.141376.40430 (AT) k70g2000cwa (DOT) googlegroups.com>,
"vajra78" <vajra78 (AT) mac (DOT) com> wrote:
Quote:
OK, first of all i can't show all the information from the record in
the portal, the portal becomes way to bulky.
I need to use a calulation so I can still enter data into the portal,
but I don't how to properly use the get function. Can anyone show how I
would enter the calcultion to get record info from the selected portal
record. |
I'm not sure how the Get Nth Record function works, but you don't need
it.
Theold fashioned way (which is more work, but will work in ANY version
of FileMaker that supports Relationships) would be to use some scripts
and buttons.
First, if you haven't already got them, create some Global fields that
will hold a copy of the data you want to display for the clicked
related record.
eg.
g_Address Global, Text
g_Description Global, Text
Then create a script that obtains the related data and stores a copy in
these Global fields.
eg.
Script: GetRelatedData
Set Field [g_Address, Relationship::Address]
Set Field [g_Description, Relationship:

escription]
Next Draw a rectangle within the first portal row covering the whole
row - temporarily set it to say a green fill and line colour so that
you can see it, but later you can set it to no fill and no lines colour
so that it's "invisible". Set the rectangle to be a button that
performs the GetRelatedData script and then send it backwards so that
it's behind all the portal fields.
Now, if you did not want to edit the portal fields or use the portal to
create new related records, then you would be all finished. Clicking on
a portal row would cause the two Global fields to display a copy of the
data from THAT related record.
BUT, you DO want to still edit the portal fields.
To do this you'll need a few more scripts (technically in newer
versions of FileMaker you could use one script and pass it a variable
to say which field was clicked on, but let's keep it simple).
Create a new script FOR EACH field in the portal row that are something
like:
eg.
Script: Portal_FirstNameField
Perform Script [GetRelatedData]
Go To Field [Relationship::FirstName]
Click on the FirstName field in the portal row and set that to be a
button that performs script Portal_FirstNameField. Do the same for all
the fields in the portal row setting them to run their own scripts that
go to the appropriate fields after copying the data to the Globals.
All done!

)
Clicking anywhere on a portal row will now copy THAT record's related
data to the Global fields, and if you click on a field in the portal
row it will copy the data and then leave the text cursor sitting in the
field for editing it. If the relationship is set to allow the creation
of new records, it will still work as well - the Global field will
simply be blank.
Notes:
A. The Global fields are simply for displaying a copy of the
related data - you can NOT actually edit the related data in
them. In fact, it's probably best to turn off the "allow
entry" option in the Field Format window for these fields to
stop people trying to use them for editing or performing Finds.
B. The GetRelatedData script above doesn't select the portal row
that you've clicked on. If you want it to do that, you'll need
to add a new Global field that stores the current portal row
number and then alter the script slightly to:
Script: GetRelatedData
Set Field [g_CurrentPortalRow, Get(CurrentPortalRow)]
Set Field [g_Address, Relationship::Address]
Set Field [g_Description, Relationship:

escription]
Go To Portal Row [Select, By Field(g_CurrentPortalRow)]
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)