Sub Summary Inline With Body
Update: Comment from FMForums totally simplified this using a single calc, and no scripts or variables!
Projects::ClientID = GetNthRecord ( Projects::ClientID ; Get (RecordNumber) - 1 )
--------------------------
I don't know if anyone else has already figured this out (probably) but I was not able to find anything on it. I did find a post By Daniel Wood about how this was accomplished by overlapping a field just slighting from the sub summary onto the body in FM 11 and earlier, but this trick no longer works in v12 and v13 as far as I can tell. I suspect this was in preparation for WebDirect so that things would have mirrored behaviors between Filemaker Pro Client and a WebBrowser in WebDirect.
After a bit of thinking it dawned on me I could use a global variable to store IDs and conditional formatting (v12) or object hiding (v13).
The idea is to take a report that uses a sub summary and remove the sub summary completely and still have the same functionality.
So a report that looks like this:
Company 1
Department 1
Department 2
Company 2
Department 1
Department 2
Would look like this:
Company 1 Department 1
Department 2
Company 2 Department 1
Department 2
This saves paper and printing time since you can embed the sub summary data directly onto the body of the first record for each sort break.
The calc used for conditional formatting or hiding the object would be:
IsEmpty ( Filtervalues ( $$ListToSearch ; MyTable::RecordID ))
Once that is setup you can then move on to writing the script which sorts the records and then Loops through all of the records collecting the ID of each record where a sub summary break would normally occur.
Set Variable[$$ListToSearch;""]
SortRecords[Restore;NoDialog] (CompanyID;Project)
Go To Record/Request/Page[First]
Loop
If [ isempty($CompanyID) or $CompanyID ≠ MyTable::CompanyID ]
Set Variable [ $CompanyID ; Value:MyTable::CompanyID ]
Set Variable [ $$ListToSearch; Value:List($$ListToSearch;MyTable::RecordID) ]
End If
Go to record/Request/Page [Next;Exit after last]
End Loop