November 9, 200916 yr Working for years in Filemaker up to V5.5 I have now jumped to V10 and am failing at my first hurdle. In am combining everything into a single file using tables where I would used to have used several different files. I have a file with a table called 'clients' and a table called 'Policies'. There are three different layouts to display different policy types depending on a field value. Policies for each client are displayed in a Portal view, a button on each row runs a script. I am using the GotoRelatedRecord step to show the record from the policies table and selecting the layout from a calculation based on the contents of the policy type field. I have used case as well as if statements and it fails 100% of the time. I have assumed that if I try to select layouts from a calc with a text answer, the answer must match the layout name. I have also tried using layout numbers. In either case the selected layout is always the same one. Have I missed something fundamental or should I be able to achieve it using this simple single script step? If I use the GTRR step and then follow it with either a case or nested if to then re-select the desired layout - it appears to work OK though I am about to embark on more testing to be sure. Any pointers regarding the use of GTRR in what I perceive to be a most basic form would be very helpful and much appreciated.
November 9, 200916 yr If I use the GTRR step and then follow it with either a case or nested if to then re-select the desired layout - it appears to work OK That's the way I've always done it and it works well. I have a "base" layout for each table which I never delete. These are used as the targets for the GTRR steps (amongst other things) after which I change to the desired layout. That way I can delete a print layout, say, and not have to worry that I've just silently broken a GTRR script step somewhere.
November 10, 200916 yr Author Thank you for that - from what I can see - in Filemaker 10 at least - the GTRR step has all the features that should allow the selection of a layout - it just didn't work! - I shall stick to you method which does indeed work. Thanks again.
November 10, 200916 yr If you use the layout name in the calculation, then the name has to be literally typed. Typical reasons for failure include leading and trailing spaces in the layout name. Because the name needs to be hard-coded into the calculation, any re-naming of the layout will cause it to break. Post the calculation you were using so we can see it.
November 10, 200916 yr Author Here is the calc. The table from which the script is being called is 'clients', the table which is used for the layouts being selected is called 'Policies'. The field which describes the policy type is 'Policies::Pol_Type' which is a numeric field and its contents are 0,1 or 2 (only testing with 0 and 1 at the moment). The Layouts are named as per the names in the calc field - same case and spaces etc. Case ( Policies::Pol_type=0; "Assurance Policies"; Policies::Pol_type=1; "Pension Policies" )
November 10, 200916 yr YOu realize that, being in Clients when you fire the GTRR, the calculation evaluates from there as well. And the calculation looks to related Policies table to decide which layout, right? Can a client have more than one policy? If you have more than one related Policy, FM will only see the first related record (thus always jumping there). Just speculation ...
November 10, 200916 yr Author I can see that is exactly what is happening. Thus I can see why the 'fix' that I am using to subsequently select the required layout following the GTRR is working for me. Thank you for explaining that.
Create an account or sign in to comment