Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How do you get the total number of fields shown in a portal?


This topic is 8360 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have created a portal showing a few fields from a related file.

Everything works great, but I'm now trying to write a script to iterate through the portal rows - to do this I need to know when to stop!

The FM function

Posted

From FileMaker Help:

quote:

Use the Go to Portal Row script step to navigate among the rows in the active portal. When no portal is active, the script uses the first portal in the layout stacking order.

Go to Portal Row tries to keep the same related field selected when changing rows. If no field in a portal is selected, the script selects the first related field it can enter.

When a related field in a portal is selected, you can use this step to move to the same field in another portal row. For example, if the third field in the second portal row is selected, Go to Portal Row [Next] goes to the third field in the third portal row.

Options

For Specify, choose one of the following and then select appropriate options:

  • First moves to the first row in the portal.
  • Last moves to the last row in the portal.
  • Previous moves to the previous row in the portal. Exit after last tells FileMaker Pro to exit the loop or the enclosing script.
  • Next moves to the next row in the portal. Exit after last tells FileMaker Pro to exit the loop or the enclosing script.
  • By Number lets you enter a row number for the target portal row. Perform without dialog causes FileMaker Pro to use the row number that was specified when this script step was defined. If this option is not selected, the Specify Number dialog box opens when this script step executes allowing the user to confirm the row number specified when the script step was defined.
  • By Field Value lets you select a field (or related field), the value of which indicates the number of the desired portal row. For example, if the field contains 3, the third row is selected.
  • Click Select entire contents to select the entire portal row.

Example

The following selects the first portal row in the current record.

Go to Portal Row [select, First]

Copyright
Posted

The number of rows in a portal is the same as the number of related records. so that

code:


Count ( RelationshipName::FieldName )


will return the number of records and thus the number of portal rows.

Posted

Thanks guys!

I think I now have a script that works - one of the stumbling blocks was that I am calling another script in the script which iterates. I think that every time I called this, the Current Row function defaulted back to the first row.

I'm now using the Count function to check how many rows are present and writing this into variable. I also note the current row in another variable, which is updated in each loop. I haven't tried to figure out if the automatic break-off in the "goto next row" function now works - I'm sticking to checking to see if (currentRow=totalRows) returns true, 'cos _that_ works 8)

Many thanks for your suggestions - Happy New Year.

Now I just have to get everything else to work...

Gus

[ January 03, 2002: Message edited by: Gus ]

This topic is 8360 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.