Could you build the htm code for the report into a text field, then use the export field script step to save that field as an .htm?
This PDF-extracting nonsense offends my sensibilities
Saving as PDF should not be used to produce this type of out put.
You have two commonly used options:
The export field contents option mentioned by Mark Gores or using Export Records to a text file (which can be XML, or calculation fields that include the needed HTML tags for proper formatting.)
Both methods can include summary field type subtotals as part of the exported data. You might want to research the GetSummary field to see one method for computing and using such sub totals.
from PhilModJunk: Both methods can include summary field type subtotals as part of the exported data. You might want to research the GetSummary field to see one method for computing and using such sub totals.
I don't quite see how the GetSummary function would help me; I am not currently using any summary fields, as my report has no numerical summaries (average, total, etc.)
What I need is to get the effect of a summary Part - there is no problem getting the stream of weekly events into HTML format. I need to interrupt that stream every four or five records and insert my monthly header and footer (I.e. leading and trailing sub-summaries).
It is a little confusing when you use the term summaries when you don't mean that.
What is the criteria for determining where the headers and footers go.
I sorry that was confusing; I referred to "sub-summaries" and "summary parts" and I see how you could confuse those with summary fields. But that is FileMaker's choice of terminology, not mine.
Those "headers and footers" (technically speaking, "leading and trailing sub-summaries") go at the beginning and end of each month. The month is a numeric field derived from the "Month" function (I.e., Month(date))
And since it is quite easy to add such data other than the summary field based sub total to your output, we assumed that you needed help with the slightly more difficult case of acquiring a sub total from a summary field.
A looping script, could, just to name one possible approach, loop through the data adding lines of text with appropriate HTML tags to the content of a text field--including sub heading type entries representing a group of records in your found set.
OK, there are header and footer parts that you can use when you don't need summaries. But if you are going for an output that is an htm file, you won't want those either as they would be more page breaks. You would want to have a script build a separate text field and check each line for a change in the Month, if it is detected put in the footer for previous month then header for next month. If no change, just list the next line.
Once you build that field, you can export the field. If you want you can even have the file name determined by a field, calculation or specify it as you save it. If done right, it should open up in a browser as is, no stripping or anything else required. You can even set up a layout with a web viewer in it to preview it and see how it looks.
Yes, as I was writing my earlier reply an outline of that script started coming to mind. But it would surely be ugly and a bear to debug, what with all the quotes within quoted strings and whatnot.
I suppose I could go that route but, once again, FMP has already done all that work (in the context of summary parts) and I hate reinventing things.
As long as I've got your attention, perhaps you can help me with building the script.
The only "export" script steps I can find are 1. "Export Records" and 2. "Export Field Contents".
It looks like "Export Records" will squirt all the found weekly records (or selected fields from same) out in one stream, not allowing me to inject my monthly stuff.
OTOH it looks like "Export Field Contents" will create a new file every time it is called.
Is there any way to create a file and then append one record or field at a time, as one would do in any normal file system?
Or would I have to try to pile all my data from all my records into one big field? And if that's the case, how the heck would I do that? I don't see any "append" operations anywhere, for files or for fields.
OK, answered my own question. "Insert Text" is actually "Append Text" with the option to erase first. Heavens to Betsy, this program is opaque!
And this still looks pretty ugly and redundant.
One more question: If I do build this monster field just for the purpose of exporting its contents, what is the most efficient way to handle it? I'm thinking to create a global field, no? And would it save anything to clear out its contents after I'm done exporting it?
At the end of the script you could have it clear itself out if that is what you want to do. If you wanted to save them, I would create a separate table and have each one be a separate record in that table.
It is going to be repetitive, scripting it to write html code for you. Is there any chance you can use the web publisher to create a layout and not bother writing the html in the first place?
I don't know anything about "the web publisher". Is that the same as "Instant Web Publishing"?
And thanks for your help. I have it working very nicely now.
Yes, instant web publishing is what I meant. ( I think they changed the name in later versions)
Glad to hear you got it working.