Wickerman Posted September 9, 2010 Posted September 9, 2010 I'm trying something pretty basic but can't get it to work. I have a Table of Artists and a child Table of Paintings. On a Layout devoted to Artists, I have a portal displaying a single line of data about each painting by the current Artist. Fine. Now what I'd like to do is have a second portal that displays an image of a painting that corresponds to the row in the first portal, selected by the user -- so you can click on various paintings in the first portal, and the image would change correspondingly. So, I'm figuring I have a Global field in the Artists table, say Display_g which I use to build a relationship to a Paintings TO (or in a filtered portal) where Display_g = Painting_pk. THen I have a script trigger on the first portal that enters the Painting_pk value in the global field "On Object Enter." I've added the other portal based on the new TO and put the Image field in there . . . but it doesn't work. It's as though I'm missing a portal "refresh" or something? What am I missing? Am I going about this the wrong way?
bruceR Posted September 9, 2010 Posted September 9, 2010 I think you're missing a portal refresh or something. Have you in fact *used* the refresh command? You probably want: Freeze Window Set field [field you are setting now] Refresh Window Exit Script [ false] But do you really want to enter the image field? I suspect it would be better just to treat it as a button. No script trigger required then.
Wickerman Posted September 9, 2010 Author Posted September 9, 2010 I do have a Refresh Window step in the script (thought I don't have the [false] feature in the Exit Script step - what's that for? I don't need to enter the image field -- I'm clicking on a row of text fields in the first portal, which lists the paintings one per row. I do want those text fields to be enterable so the user can edit the info in there. I've put the global field on the layout and can see it changing okay when I click on the different paintings in the list. I'm actually trying this for the moment with a text field in the second portal (I need to display a large text block describing the painting as well as the image -- I thought it would be easier to describe with the image example. I do get a result in the second portal, but it doesn't change automatically. Let's say I've got it displaying the text for Painting1. Then I click on Painting3 in the first portal. Nothing happens. THen I click into and out of the text of the text description that should be changing. Nothing. BUT -- if I go in, *edit* the text and click back out onto the layout, *then* it refilters and shows the text for Painting3.
bruceR Posted September 10, 2010 Posted September 10, 2010 Exit false can be used at the end of script-trigger scripts to stop the original action from completing. For example, if you are processing keystrokes, then your script handles them and (for instance) you exit false rather than allowing alpha characters from being typed into a numeric field. Since you haven't shown us your file or script, we really can't guess what you're doing.
Wickerman Posted September 10, 2010 Author Posted September 10, 2010 Let me just try to describe simply: Table 1: Artists (parent table, one-to-many) Table2: Paintings (child table) Field: Title (text) Field: Date (text) Field: Description (text) Field: Image (container) LAYOUT -- Artists context Portal A - Displays related child Painting records, 10 rows -display fields: Date, Title Portal B Goal: Display Description field for Painting currently selected in Portal A. Portal C Goal: Display Image field for Painting currently selected in Portal A. So, when the user clicks from row to row in the list of Paintings in Portal A, the data and image in Portals B and C also change. What is the best way to achieve this simple effect? I appreciate the help!
David Jondreau Posted September 10, 2010 Posted September 10, 2010 A global field would work, but I prefer a global variable and using the filter portal feature. Coincidentally, I'm at this very moment procrastinating instead of polishing a solution that uses this along with BruceR's concept of "Coded" variable repetitions so each parent record maintains its own selected record for the length of the session. As in $$SelectedOrderID[Code(Orders:_p OrderID)] It's pretty neat. Thanks, Bruce. Anyway, it sounds like you've got an almost-working answer, you just need to check the "Flush cached join results" checkbox in your Refresh Window[] script step and you'll be fine.
Wickerman Posted September 10, 2010 Author Posted September 10, 2010 Oh for crying out loud -- thanks -- works fine now. So, would the global variable approach just be doing it exactly the same but avoiding making an extra field by using the $$variable insterad? That makes sense, thanks. Appreciated!
comment Posted September 10, 2010 Posted September 10, 2010 See also: http://fmforums.com/forum/showtopic.php?tid/214676/
Wickerman Posted September 10, 2010 Author Posted September 10, 2010 THANK YOU! That's an awesome demo, and something I can immediately make use of in this very situation. Wonderful!
Recommended Posts
This topic is 5188 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 accountSign in
Already have an account? Sign in here.
Sign In Now