You've got a GTRR step within your loop there, which means that within each iteration of the loop Filemaker is going to try and traverse that relationship, which seems a little odd.
Could you provide more detail on what that script step does?
Typically I'd collect all of the records I want to output to PDF first, and then loop through them creating PDF's as required...
I think that you just need to remove the "match found set" option.
Thank you for chiming in. I'm a novice with filemaker - started using about a year and a half ago - so I'm still learning.
As far as the script ... so previously I was just using the GUI & doing a save as that saved the individual reports (heading, body, footer) for each student & saving it to one big PDF file. Then going in and extracting each student report to it's own PDF (tedious).
So I hoped to reuse the script I used for prior project, that project was one record per student with many fields in each record. I "thought" in this case of multiple records for each student I need to use GTRR command to pull all records pertaining to a student, use the layout to create the report, write PDF, advance to next student ... loop it until no more students.
Of course as I type this I'm thinking maybe this is not the right "logic" ... to be frank I don't think I fully understand everything that goes in the background for the report writer portion of FMP ...
Thank you for chiming in. I tried running with the the "current record" option and even unchecking the "show only related records" option that the current two options are under; they produced the same result as writing out one big PDF with different filenames (just like what the GUI will produce).
As I wrote the reply to James, I'm now thinking I probably is misunderstanding what goes on behind the scenes thus making it more difficult than it should?
A further thought. Does the GTRR take you to a different layout from where you started? If so, your script doesn't involve a return to the starting layout before moving to the next record. That seems messy to me and a potential problem.
I will check that. In GTRR I set the layout but in case.
I'm still wonder if I'm misunderstanding this thing. For example last night I was thinking if I just have to use lookup table that has unique IDs, then store that in the variable, GTRR using that variable, save pdf & then advance to the next record of unique IDs?
you need to use show only related records, but WITHOUT the "match found set" option selected.
If you have "match found set" specified, you get all records in the related table that are linked to ANY record in your current found set. That means you'd get the same set of records with each pass thru the loop.
You also need to return to the original layout at the end of your loop before going to the next record.
Thank you for the reminder.
I have done the following:
1) make sure the GTRR option of "show only related records" are selected. However the sub-selections are radio buttons if I enable this so I have it WITHOUT "match found set" which means "current record only" as it is a radio button. I use FMP12. Here's a screen shot:
2) I also added "Go to Layout [original layout]" at the end of the loop.
Unfortunately above changes produced the same one big PDF (at least with the unique filenames based on student name & ID). I also tried putting the Go to Layout ahead of advancing to the next record but produced the same results ...
Thank you for the continued dialogue ... feel closer as I must be not doing something right or missing another command (like going to original layout that I was missing earlier) ...
1 of 1 people found this helpful
Make sure that the target layout is in fact based on a table occurrence that has the desired relationship to the main layout (where the loop executes). GtRR lets you select any layout that is based on the same table as the target TO ('Get related record from') - but not every selection will be (semantically) correct.
Speaking of semantics: 'Table' is a really bad table occurrence name ...
If you don't have FM Advanced to debug the script step by step, I'd suggest you activate the 'Show in new window' option of GtRR, followed by a Halt Script step.
That lets you inspect the actual related set you arrive at, before the PDF export. If that set doesn't match what you expect, then something would seem to be wrong with the relationship.
Current record is correct. That refers to the current record of those that you are looping thru, not the records you want in your PDF.
Go To Layout should not be the last step in your loop. It needs to come before your go to record step.
Thank you for the advice on "Table" naming ... will change.
The windows opened by Halt Script does look good but makes me wonder if the subsequent "save to PDF" command changes that because the saved PDF is the whole enchilada instead of one student (multiple records per student) ...
feels like almost there ...
Understood on the placement of Go To Layout and thank you for explanation on the selection under Show only related Records.
It must be something stupid I'm doing ...
It might help to show us your revised script.
Yes, below is copy & paste - thank you! I haven't changed the table name yet.
The Halt Script show the right layout in the other window but probably something happens when it reaches Save Records as PDF ... a novice guess.
Go to Record/Request/Page [ First ]
Set Variable [ $IDStudent ; Value:Table::STUDENTID ]
Set Variable [ $NameFamily ; Value:Table::LAST ]
Set Variable [ $PDFFileName ; Value:$IDStudent & " " & $NameFamily & ".pdf" ]
Set Variable [ $DesktopPath ; Value:Get(DesktopPath) & "FOLDER1" & $PDFFileName ]
Go to Related Record [ From table: “Table”; Using layout: “consolidated report v1.12” (Table) ]
[ Show only related records ; New window ]
Save Records as PDF [ File Name: “$DesktopPath” ; Records being browsed ]
[ Document - Compatibility: Acrobat 7 and later ]
[ Pages - Number Pages From: 1; Include: All pages ]
[ Security - Password to print/edit; Printing: High Resolution ; Editing: Not Permitted ; Enable Screen Reader ]
[ Initial View - Show: Pages Panel and Page ; Page Layout: Single Page; Magnification: 100% ]
[ Restore; No dialog ]
Go to Layout [ original layout ]
Go to Record/Request/Page [ Next; Exit after last ]