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

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

Recommended Posts

Posted (edited)

Is there a way to grab the numerical value of a filtered portal? I have a filtered portal in FMP 11; using the portal filter feature rather than filtering via a relationship.

I can view the number of items in the filtered portal via another portal with one row (see http://fmforums.com/...ed-portal-rows/). Now, I would like to grab that value and put it into a variable.

Purpose:

I am "listening" for up/down arrows in order to navigate up and down in the portal (using OnLayoutKeystroke). The script works fine and I can easily navigate up and down in the portal via the arrows. I have a condition that states if I am on portal row 1 then disregard the up arrow keystroke. I need the same kind of logic when I press the down key. I store the portal row in a global variable. As it is now the down key will continue to increase $$portalRow ad infinitum. I'd like to be able to say something like

If $$portalRow = $totalPortalRow then exit.

Again, viewing the total number in the filtered portal is not the problem. That works fine. I would like to grab that value and put it into a variable.

Thanks.

Edited by Daniel Shanahan
Posted

If you want the total number of records being displayed in a filtered portal (vs.11) then you can easily get it from within any portal row if the table the portal is based upon has a summary field Total Count of any non-empty field such as ID, maybe called sKountKids ;-) . Then in script, while in portal row, just reference this child summary field. The count (in fact all summaries) will be filtered this way as long as you go to the portal first.

ADDED: So it would be: Set Variable [ $totalRows ; Child::sKountKids ]

Posted

I take that back. If it is the only portal on the layout then it seems to *see* the filter and produce the correct results. If I place an unfiltered portal (based only upon ID) then it STILL sees the first portal summary!! So it seems to *see* the first in stacking order, I think confirmed.

I've used a global filtered portal whose only purpose is to provide filtered summaries for scripts but I never noticed that it wasn't necessary to go to a row unless the layout contains two portals to same table occurrence.

Oh, never mind ... lol ... I was running a script in test file and the script had first step of Go To Portal Row ... lol ... forget this latest miracle discovery ... what I said in original responds holds. :laugh:

Posted

Thanks, LaRetta. That works great!

I also learned of another method from Dave Ramsey at the Central Ohio FileMaker Users Group (COFMUG):

Give the merge variable a name and then use the function GetLayoutObjectAttribute. Dave tells me that he learned this method from John Sindelar who learned it from someone else, so thanks to all those involved. Attached is a file showing both methods.

Thanks again for your reply, LaRetta.

portalFilterGrabTotal.fp7.zip

Posted

Daniel, actually you can probably make your life a little easier and ditch the variable totally. FM will ignore the GoToPortal Row(Next/Previous) command if you are already at the first or last protal row. I use the following script to allow the use of the arrow keys to navigate on a layout, You can modify it to suit your own requirements. You must give the portal an object name.

UpDownKeys.pdf

Posted

Hi Daniel,

Thank you for sharing the file! I had forgotten about using GetLayoutObjectAttribute ... more than a few times, it seems. :crazy2:

Posted

Can someone Please xplain how / why this works. Seems these techniques only work if you

put the field over a portal (child::related) table. Why does this work?

Or am i just being silly?

thanx..

-i

Posted

Can someone Please xplain how / why this works. Seems these techniques only work if you

put the field over a portal (child::related) table. Why does this work?

imoree, can you clarify what part is confusing you? There are a couple of different elements:

1. Filtered portals vs. multi-value relationship

2. Displaying portal aggregates from filtered portals

3. Grabbing the value of an aggregate of a filtered portal in order to use it in a script

This topic is 4807 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.