General HydroStatics
Ship Stability Software |
Command of the Week
(New or interesting aspects of GHS that you may not know about) |
ME REPSTART & REPEND
|
These days, you might be finding time to re-watch some of your old favorites. But when you're knocking out a whole season of that old show in a weekend, you might start to grow weary. Wouldn't it be nice to enjoy spring on a trail somewhere? Oh the anguish.
But luckily there's always the sandbox that is GHS. And when all you have is time, there's one GHS topic that will surely use every minute of it. The MESSAGE command has been featured in many past COWs, including these three on custom plotting COW010, COW110, COW135, this one on ME SEND COW049, and this one about plan and profile graphics in the plot area COW150, but we've never discussed in detail how it can be used in custom tables and reporting. As most of you know, the basic form of "custom reporting" is using simple NOTE commands to send text and variable definitions to the report file. If you're using classic report formatting (i.e. the default monospaced report style in GHS) this works well enough for most output, and tables can be formatted by counting character widths and conforming to the following guidelines:
If you follow these guidelines, you can create some very respectable report output, including tables, parameter summaries, and notes. But with all of this extra time you've decided you'd like to add some artistry to your reports, and that requires color, and font options, and text styles, so simple NOTE commands are no longer going to cut it. It sounds like you've moved from black and white to color, and subsequently discovered REPORT /BOX:COLOR, the "fancy" report style. To capture this new-found fanciness, you'll have to wrap your NOTEs with ME REPSTART and ME REPEND. All other report content must go between these two markers: |
print configure /font:"Times New Roman"
report /box:color me repstart \-------------Example Table--------------\ \ C O L U M N S \ \----Col1----Col2----Col3----Col4----Col5\ me repheader \----(m.)----(m.)----(MT)----(MT)----(MT)\ \ { a1:2} { a2:2} { a3:2} { a4:2} { a5:2}\ \ { a2:2} { a3:2} { a4:2} { a5:2} { a1:2}\ \ { a3:2} { a4:2} { a5:2} { a1:2} { a2:2}\ \Sum of last column-------------->{ as:2}\ \--------------This footer is an example.\ \ `blank line \Here we put extra info, such as notes.\ me repend report close /preview |
...which creates the following technicolor masterpiece: |
You'll notice GHS automatically picks up the first line as a title, the second as a top-level header line, and the third as a column header line, but for the fourth we have to specify ME REPHEADER before creating the line. This is because GHS assumes only a single column header line is needed, and would otherwise treat any following lines as data lines. Here we added a unit line, so we had to override the default behavior. These overrides exist for other report items, so if things get really exciting, you might want to take a look at HELP ME. Also notice that ME REPSTART and ME REPEND respect any PRINT CONFIGURE /FONT settings.
Here are a few more tips to ensure success when you start building your custom fancy reports:
We'll hand it to you, those proportional fonts do look nice, but there's still one thing that proportional fonts will never do well: |
Here's the run file that made this animation. |
Questions, comments, or requests?
Contact Creative Systems, Inc. USA phone: 360-385-6212 Fax: 360-385-6213 Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday Mailing address: PO Box 1910 Port Townsend, WA 98368 USA Click here for an index to this and previous COWs |