Kenterprise Posted August 8, 2005 Posted August 8, 2005 (edited) Hi, By clicking a button on a portal row, I would like to goto a layout in a related table, the name of the layout is in a field on the same row as the button. ( in fact, the portal contains a list of form letters, so each row in the portal is suppose to open a different layout). How can I get FM to go to to the active row in that portal and take the name of the layout from the field. Without that active row information, of-course FM will goto the first record in the tablet, and take the name of the layout from the field. And the result is that it will always goto the same layout. Have anybody got any good ideas, Thanks. Edited August 9, 2005 by Guest
CyborgSam Posted August 8, 2005 Posted August 8, 2005 Welcome to the forums! The script step "Go to Layout" should work. From the popup, choose "Layout Name by Calculation..." and then specify the field containing the layout name. Note: the script should first execute a Go to Related Record so it's on the correct record when it calcualtes the layout name.
Kenterprise Posted August 9, 2005 Author Posted August 9, 2005 Thanks for the Welcome, and thanks for your advice !! Sorry, I don't think my question was very well formulated, so I have rephrased the original question. I hope that will give you a better understanding of what the problem is and what I am trying to accomplish. "How come the demand for my opinions is never as great as the supply?" - Ashleigh Brilliant Right here the demand is greater than the supply. I am sitting in Italy on the Mediterranean cost, working on this thing for a school in Switzerland, and I am not good in scripting and calculations, with few FM people around here I have no one to help me out when getting stuck. -
-Queue- Posted August 11, 2005 Posted August 11, 2005 Cut out the middleman and just use Go to Related Record [show only related records; From table: "Related Table"; Using layout: Relationship::FieldContainingLayoutName] Of course this will not work well if Relationship::FieldContainingLayoutName's value is a layout which is not based on "Related Table".
Kenterprise Posted August 12, 2005 Author Posted August 12, 2005 The Middleman! (Active row information) By using your advice: Go to Related Record [show only related records; From table: "Related Table"; Using layout: Relationship::FieldContainingLayoutName] FM always go to the first row in the Portal (first record in table) and take the name of the layout, with the result is that it will always go to the same layout no matter which row I will be clicking on. The two tables are related with a global relationship, so that the Protal will show the same list of FormLetters in all the records. That would be very appreciated if you can point me in the right direction, abuot how to tell FM to go to the active row in the portal, and pick the name of the layout from the field.
comment Posted August 12, 2005 Posted August 12, 2005 If a button is placed in a portal row, Go to Related Record will take you to the record in that row. The two tables are related with a global relationship I don't know what a "global relationship" means. If your relationship uses global (or otherwise unindexable) field on the child side, it will not work.
Kenterprise Posted August 12, 2005 Author Posted August 12, 2005 Here is what I mean with a "global relationship". That each end of the relation is a global Storage field with one value for all records, set to Auto-Enter the same data value at each end. So that the Protal will show the same list of FormLetters in all the records. :(
comment Posted August 12, 2005 Posted August 12, 2005 I repeat: if your relationship uses a global field on the child side, the relationship will not work. If you want to show all child records in the portal, use the x relational operator. See FM Help > Working with related tables and files > About the types of relationships > About relationships using comparative operators.
Kenterprise Posted August 12, 2005 Author Posted August 12, 2005 Thanks,( now, what is the expression again, RTFM ?) Thanks for your informations on X Operator. I have been going the long way around by Auto-Enter the same data at each end - But still, now in a relationship, without any Golbal storage fields at ether end, and based on the X operator, and using: Go to Related Record [show only related records; From table: "Related Table"; Using layout: Relationship::FieldContainingLayoutName] the problem is still the same, that it will always go to the same layout no matter which row I will be clicking on.
-Queue- Posted August 12, 2005 Posted August 12, 2005 Do you have a Commit Records step before the GTRR one? If so, get rid of it. If not, can you attach a clone of your file?
Kenterprise Posted August 12, 2005 Author Posted August 12, 2005 (edited) I don’t have any Commit Records steps in the script, before the GTRR step is only, New Window Script step. And yes, I will be happy to attach a copy, here it is, and thanks and cheers to you and your good energy, Bravo ! The name of the script is: Go to Parents - P. Form Letter Layout To navigate to the Portal: Select - Parents/Communations/Form Letter Allright, I dont know how to attach a file here in this forum, can I send you a E-mail ? Edited August 12, 2005 by Guest
-Queue- Posted August 12, 2005 Posted August 12, 2005 No need. You answered my question already. Remove the New Window step or you lose focus of the portal row. Use the option in the GTRR step to open the related record in a new window.
Kenterprise Posted August 13, 2005 Author Posted August 13, 2005 Yes, as a last resort I followed your advice - Just play some rock n’ roll - !! Oh - yes the music was good, but it did not charm FM !! Even with the New Window step removed from the script, FM always go to the first row in the Portal (first record in table) and take the name of the layout, with the result is that it will always go to the same layout no matter which row I will be clicking on. As you suggested yesterday ( and now I know how ) I have attach the file, I had to strip some layouts in order to get under the 1 M allowed file size . The “Go to Parents - P. Form Letter Layout” script is right at the top of the scripts list, and the file will open up displaying the layout containing the Portal . Thanks again to your open mind attitude. How about trying playing some Italian Opera, that might charm FM to behave ? Student_information_System_copy.zip
comment Posted August 13, 2005 Posted August 13, 2005 Layouts are associated with tables. AFAICT (it's difficult to analyze such a maze), your GTRR step goes to one table, while your form letter layouts belong to another. That's why it's not working, with new window or without. Once you have fixed that, if you want a new window, you will need to split the action into two steps: First go to related record, using ANY layout belonging to the related table. Then go to the layout by calculation. See the attached for a SIMPLE demo of the two methods. gtrr.fp7.zip
Kenterprise Posted August 13, 2005 Author Posted August 13, 2005 The GTRR step one (Go to relater Record from:) points to a table name “parents”. The layouts name “Form Letter 1” and “Form Letter 2” belongs to the table named “Parents” as well. The GTRR step two (Show record using Layout:) - Layout name by calculation - Parents Com Form Letter::Name. The table “Parents Com Form Letter” is related to the table “Parents”. The field named “Name” contains the name of the Layout. You are write in your post that: your GTRR step goes to one table, while your form letter layouts belong to another. As far as I can se they belong to the same table - Parents - And as you can se from the attach file it is working, the Form Letter 1 layout will open all right, the problem is that Form Letter 2 will not (if you change the name in the name field in the portal to Form Letter 2, then of course that will open) Thanks so much for your effort with the little example, and all your great help and support, I am just now sitting and looking at it. Caio
comment Posted August 14, 2005 Posted August 14, 2005 The GTRR step one (Go to relater Record from:) points to a table name “parents”. But the portal does not. It's difficult to explain, especially since I don't understand your structure. You have to follow the focus very carefully in these situations. If the button is placed in the portal to one table, and it says GTRR from another table, it looks for a relationship from the related record in the portal to the table in the GTRR step. I think. I am not sure. I have never tried this, nor saw any need for such a complicated scheme. I also suspect that your layout name calculation [color:blue]Parents Com Form Letter::Name will never return FormLetter 2. Your relationship from Parents to Parents Com Form Letter is a Cartesian product (relational operator "x"), therefore the first related record will always be FormLetter 1, for any Parent record.
Kenterprise Posted August 14, 2005 Author Posted August 14, 2005 Your relationship from Parents to Parents Com Form Letter is a Cartesian product (relational operator "x"), therefore the first related record will always be FormLetter 1, for any Parent record. That is correct, so that is why I am talking about the active row information. If the calculation in GTRR step two (Show record using Layout:) - Layout name by calculation - Parents Com Form Letter::Name, can include a calculation, which tell FM to take the name from the current active row, then everything would be all right ! What do you think ?
comment Posted August 14, 2005 Posted August 14, 2005 I think the calculation does NOT "tell FM to take the name from the current active row". It tells FM to take it from the first related record from Parents Com Form Letter. Being in a portal at that time, that would mean the first related record from the point of view of the current active row. The situation might be different if, at the time the calculation is being evaluated, you were on a layout of Parents Com Form Letter. There the reference Parents Com Form Letter::Name would be a local one. That's what "This calculation will be evaluated based on context at runtime" means.
Kenterprise Posted August 14, 2005 Author Posted August 14, 2005 That is correct, I agree with you. And that is why I would like to do is to create a calculation that WILL tell FM to take the name from the current active row, the one I click in, the problem is that I don’t know how to create that calculation, do you ? :(
comment Posted August 14, 2005 Posted August 14, 2005 Isn't that what my file does? I think your problem is context, not calculation. Since there is no way I am going to pick your file apart, I suggest you tell us in plain, non-Filemaker, words what is it that you're trying to achieve. Or make a bare-bones file to demonstrate the problem in isolation.
SlimJim Posted August 14, 2005 Posted August 14, 2005 The following might work. Create a new global text field in your Parents table, call it Layout. At the front of the script Go to Parents - P.Form Letter Layout insert the step SetField[Parents::Layout;Parents Com Form Letter::Name] Change the next step to Go to Related Record[show only related records; From table: "Parents"; Using layout:Parents::Layout;New window]
Kenterprise Posted August 14, 2005 Author Posted August 14, 2005 Mama Mia . . . Here is a bright and very logic idea from Brighton UK. And it just works BANG just like that, right out of the box, Thank You . But why, did I not even think about that ?? Example_Kenterprise.fp7.zip
comment Posted August 14, 2005 Posted August 14, 2005 I don't get this: You start in a record in the Parent table. You end up in the same record in the same table. What's going to related record got to do with it? Example_Kenterprise.fp7.zip
Recommended Posts
This topic is 7041 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