Jump to content

Showing ActivePortalRow outside of portal


Toby B

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

Recommended Posts

I have a portal that can be filtered. Outside of this portal on the same layout I have three fields:

Record Number,

Found Set, and

Total Records.

So far I can calculate the last two numbers but can not work out how to calculate the first.

Basically when a user clicks on a portal row I want the record number field to instantly display which record number in the found set is currently selected.

I do not want to do this by attaching a script to the portal row because there are already other buttons in the portal row (namely GTRR) attached to certain icons.

Does anyone know of a simple way to achieve this?

Link to comment
Share on other sites

This is rather confusing. Record number, found set, and total records are all attributes of the LOCAL table (the one that the layout is based upon). A portal shows related records from another table. There is no such thing as a found set for a portal - a portal always shows all related records.

The equivalent of record number in a portal is the portal row number, which you can get by the Get(PortalRowNumber) function. However, I believe you WILL need use script to display the current portal row number in a field outside of the portal, because clicking in a portal will not cause a refresh of a calculation field based on Get(PortalRowNumber).

Link to comment
Share on other sites

In the file where your portal is create a field with global scope. Make a relationship from this field to the record ID in the target file. Then, when the button is clicked in the portal stick the record ID of the highlighted record into that global. You can now put what fields you need onto the layout external to the portal and the information you asked for should show up,

Norman

Link to comment
Share on other sites

Funny thing is I'm doing the exact thing on my app. My problem is that I want to use the "Go To Portal Row[select; Get(PortalRowNumber)] but it doesn't input the row number. If I leave "Perform without dialog" unchecked, it comes up with the dialog and the appropriate number of portal rows (0-9 for example), but how do I script it to set the number for the row clicked?

Link to comment
Share on other sites

Well I created a button out of 4 fields in the portal. The script does it's stuff fine, but at the end of it, I wanted to highlight the row, just like Go To PortalRow does. So filemaker should know at the time the user clicks the context of the row thats being clicked, but it always comes back with 0, so I assume it can't determine it.

Take a look at the attached screen shots. In Screen 1, you see the layout and under the "Detail Records" portion, there is a header label that says "Click a Product Detail..." This is the portal I'm referring to. Currently, when you click, I have a button that is the four middle fields and it's function is to populate the fields below related to that portal row. Works fine.

But in Screen 2, when you click the row, the scripts last step is to "Go To Portal Row (Select; Value:Get ( PortalRowNumber ) which when the "Perform without dialog" is unchecked shows a 0, which I assume means it can't find the associated portal to reference. If I manually enter a number within the portal rows range, it works.

Screen1.gif

Screen2.gif

Link to comment
Share on other sites

When Get(PortalRowNumber) returns 0, it means you are no longer in a portal. I am guessing your script takes the focus elsewhere to do its job - so by the end of it Get(PortalRowNumber) is no longer relevant.

Try starting your script by storing the current portal row number in a variable. Then, at the end of the script use the variable to specify the row you want to go to and select.

Link to comment
Share on other sites

I figured out the portal row number, for those that care. I need to set a variable at the beginning of the script for the current portal row number (the one that the focus was on) and then use that variable at the end to go to the appropriate record. For some reason when I did the selection at the end of the script, it lost it's reference, even though all the script did was set variables and fields.

Link to comment
Share on other sites

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