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

Showing related record from button in portal


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

Recommended Posts

Posted

I'd like a button in a portal row to take me that record.

The portal rows display partial information from unique records with unique IDs. The unique IDs are displayed within the portal roows. I've placed a button triggering "show related" in the portal, but it doesn't work. I set up a test by changing the script to go to a field in that is displayed in the portal, but the button instead only selects that feld in the parent layout.

Is there a simple way I can set up a button within a portal to display the record in the particular row that the button is displayed in?

Posted

Hi Steve

If you attach a script step of 'Go to related record' you will find the options to nominate the table that you wish to show the record from (your portal relationship) and which layout you want to use to display the record

HTH

Phil

Posted

Well, of course that was exactly what I'd done, except late enough at night so I had the relationship tangled up like an inside out moebius strip, so of course it didn't work.

A night's sleep and the light of day was the real cure.

Thanks.

Posted (edited)

I am trying to do this same thing, but there is something I can't figure out.

I have a portal with the related records and each portal row has a button. The related records are Item Notes (User, datetime, note text). Each row shows the User and datetime, and a button. What I would like to do is have the button display the related record's "note text" in a text field on the same layout. This way the user can just click on whichever note he wants to see and the full text for that note will appear in a separate field (outside of the portal).

What I can't figure out is how to get the related note's text into the field outside of the portal.

Also, is this the best way to do this or is there another way that might be better? I don't want to show the full "note text" in each portal row because the height of the rows cannot slide to accomodate variable length notes.

Thanks.

Ken

Edited by Guest
Posted

Hi Ken

Are you aware that if you allow your user to click into the notes field within the portal then the field will automatically expand to show the user the full contents of the field?

The down side to this approach is that the user can alter the notes if you allow them to click into the field.

If you really must show the notes in a small area outside of the portal then what you can do is:-

Set up a new global field in the parent file.

Establish a new relationship to the records in the portal using this new global field = the key fields in the records in the portal.

Put a new field on your layout to show the notes field via this new relationship

When you click on your portal row set the global field to the key field of the record in the portal and hey presto the notes field will show the notes relevant to the last portal button clicked

HTH

Phil.

Posted

Thank you Inky Phil and mr_vodka. I overlooked the need for the global field. It makes perfect sense now.

I can't do as you suggested with the field expanding because this is actually being built for use with Instant Web Publishing. I think I'll need an actual button in each portal row in order for this to work with IWP, but I'll figure that out when I get there.

Thanks for the advice!

Ken

Posted

I'm 90% toward making this work, but I'm stuck on one silly thing. When I click my button in the portal row, I can't figure out how to set the contents of the global field with the ObjectID from the related record. I can set the portal row number, but I can't seem to find a way to get the contents of my key field into the global.

How should I be doing this?

Thanks.

Ken

Posted

The script would be

Set Field (gObjectID, PortalRelationship::ObjectID)

Commit Record []

The button would have to be in the portal of course.

Posted

The script would be

Set Field (gObjectID, PortalRelationship::ObjectID)

Commit Record []

The button would have to be in the portal of course.

Yes, this is what I have been trying to do, but cannot seem to figure out. When I set up the Set Field script step, I have two settings: "Specify Target Field" and "Calculated Result". I can set the target field to my global field with no problem, but how do I set the second part from a calculated result? I do not see anything in the calculations that allows me to define the "PortalRelationship::ObjectID". I'm on FMP 7 on OS X Tiger if that makes a difference...

And yes, the button is in the portal.

Posted

In the calculated result section, change the relationship (left pulldown menu) to the Same one that the portal is using, and then select the field with the primary key; in this example's case ObjdectID.

Posted

You didn't pay enough attention to the crucial detail here:

Establish a new relationship to the records in the portal using this new global field = the key fields in the records in the portal.

--sd

Posted

You didn't pay enough attention to the crucial detail here:

--sd

I did do this, but that's not the problem. I'm just trying to get the recordID of the selected portal row into the global field. The new relationship is unrelated to this problem.

In the calculated result section, change the relationship (left pulldown menu) to the Same one that the portal is using, and then select the field with the primary key; in this example's case ObjdectID.

This is what I think I've done, but the global field always receives the same value no matter which button I press. I suspect something about my relationship might not be right. In the pulldown menu I have a list of table occurrences. My actual relationship is as follows:

[color:brown]Agenda Items::fk_CompositeID is related to [color:brown]Item Notes::NT_CompositeID. The composite ID fields are a calculated field (but are guaranteed to be unique as they include a serial). I don't think that should matter, but I mention it in case it does.

The layout shows a single record for Agenda Items and the portal shows all related Item Notes (just one line, not including the note itself). There is also a button on each portal row set to run my script. This portal works correctly.

In the script, I chose [color:green]Set Field with my global field as the target. For the calculated result, I chose [color:brown]Item Notes from the pulldown menu on the left and [color:brown]NT_CompositeID for the field. As far as I can tell, this is what has been suggested.

Unfortunately, this produces the same compositeID in the global field no matter which button is pressed. Any suggestions on where to look at what I did wrong?

Thanks again!

Ken

Posted

Hi Ken

Sorry but I was not as clear as I might have been with my last post so I have done a small dem file to show how I would do it

Hope it helps

Phil

Thanks so much for the example. This was exactly what I was attempting to do--at least I described the problem well! Although the file was lock and I couldn't examine the scripts/button, I was able to see from your relationships diagram that I did in fact make my mistake in one of my relationships.

Basically I had it all set up right except for accidentally selecting the wrong field in one of my relationships. It's working fine now.

Thanks again to all who replied. I really appreciate the help!

Ken

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