NASIS Reports FAQ
This is a collection of questions about NASIS reports
that have been received recently by the support team. We hope the answers
will be useful to others.
Interpretations In a Subreport
I have prewritten text in the Main Report and the
INTERPRET in the subreport. I can get the reports to run independently. When
I put them together, I get an error:
“SQL Error: The specified table (icomponent) is not in
the database.”
Is there a reason why the INCLUDE statement will not
work with the interpretations?
It doesn’t work to put an INTERPRET in a subreport. The
reason is that interpretations are actually generated as a separate step
before report processing begins, and that is what creates the icomponent
table. The table always contains interp results for all selected rules and
for all components in the selected set. So there is really no need to
generate interps over again in a subreport. You can query the icomponent
table as many times as you want in subreports, but you can only create it
once.
So the way to combine your reports would be to put the
INTERPRET in the top level report and request all the rules that are going
to be needed in any subreports. Then the subreports can query the icomponent
table and select on mrulename to get the interpretations they need.
Multi-Page Output from a Subreport
I am running a main report that pulls the two subreports
that print the interps. Basically the national reports with some tweaking.
My dilemma? I have a footer on the reports from the
main report. When I run the subreports independent, they print fine. When
I run as a part of the main report, the footer prints correctly. The header
prints okay, BUT , the report seems to take the “KEEP WITH” material from
the previous page and places it above the header on the subsequent page.
I have tried adjusting page lengths, KEEP WITH, headers,
sections, footers - you name it. I can not get the Main Report to pull the
subreports and print them properly with a header, data, footer and then next
page. They continue to print header, data, footer - next page - data,
header, data, footer and continued.
You are running into a “feature” of subreports. Think of
it this way:
The main report gets a bunch of output lines back from the
subreport, but it doesn’t get any structure. It doesn’t know which lines are
headers, which are footers, which are data, etc. So the main report takes as
many lines from the subreport as it can fit on a page and prints them, then
continues on the next page.
In your main report you have footers defined. That takes
away from the number of data lines that can be put on a page. However, the
subreport doesn’t have footers, so it sends back a full page of data. When
it’s printed in the main report, the first page looks okay, but not all of
it is actually printed (because of the footer). The rest of the first page
is printed on the main report’s second page, followed by the header and the
rest of subreport page 2.
In general, if a subreport returns full pages, the main
report can’t use headers or footers. You could adjust the page length in the
subreport to fit between the header and footer of the main report. A simpler
solution might be to define the footer in the subreports and use no headers
or footers in the main report.
Also, you should use a NEW PAGE between the INCLUDE
statements for each subreport, to make sure that the subreports start at the
top of a page.
Font Sizes
How or where can I find the coding for font names and
font sizes? I have had many questions asking on how to increase font size.
Got a resource I can use?
Fonts are one of those things we don’t really understand
very well. By trial and error we have found some fonts that work with
reports, but we’re not quite sure what will happen if you try something
different. You are welcome to experiment.
The basic facts are these: NASIS reports must use fonts
with fixed character widths, rather than the more common proportional fonts,
so that columns will line up correctly. Reports are printed by a software
package called Xprinter, which maintains its own library of fonts. On your
system this is located in /nrcs/hyperhelp/xprinter. In that directory are
two files that provide lists of available fonts: pclstd.fonts has the fonts
for HP printers using the PCL protocol, and psstd.fonts is for Postscript
printers. The font names in these files are in a form that looks like:
-adobe-courier-medium-r-normal--50-120-300-300-m-30-iso8859-1
This happens to be the default font that reports use. The
dashes separate the various options, which are too numerous to explain here.
But the 11th option is simply the letter m, which stands for
monospace, meaning a fixed width font. Courier is the only monospace font
available, except for “line printer” which appears in the pclstd.fonts file
and which we use for reports that need a condensed (15 char per inch) font.
Since line printer doesn’t appear in the psstd.fonts file, I don’t know why
it works with Postscript printers, but somehow Xprinter figures it out.
So all this explanation is leading around to your
question. If you want a bigger font you might be able to get one with
Postscript, but probably not on a PCL printer. The actual font height is
determined by the 8th option, or 120 in the above example. That
stands for 12 point, and 160 would be 16 point. When you specify a font name
in a report you can use an asterisk in place of some of the font options as
a wild card. So you would probably get a 16 point courier font with the
report specification:
FONT
“-adobe-courier-medium-r-normal--*-160-*-*-*-*-iso8859-1”.
The trick would be to figure out what horizontal and
vertical pitch this font has, which you might have to do by printing some
lines and counting characters. I’d guess you would get 8 or 9 characters per
inch horizonal and 4.5 lines per inch vertical. Whatever numbers you come up
with, you’d have to put them in the PITCH specification in the report.
Duplicate Property Name Error
Our report on nasisclient fails due to duplicate
properties named “USDA - TEXTURE GROUP SURFACE LAYER-MT”. One property is
owned by MO4 and the other by MO9. The report and property was copied from
one MO to the other MO. The report and property run correctly on the
individual MOs, but not on nasisclient.
When there is a possibility that another NASIS site might
have a property with the same name, it is necessary to specify the NASIS
site name along with the property name. When we get on the central server
this will be happening more often, so it would be a good idea to check all
reports to be sure that property names are fully qualified. For example,
this report would need a DERIVE statement like this:
DERIVE surfacetex FROM rv USING “MLRA04_Office”:“USDA
TEXTURE GROUP SURFACE LAYER-MT”.
Note the punctuation carefully. The NASIS site name
(which comes from the column Property Site in the Property table) has quotes
around it, and the property name has a separate set of quotes. There is a
colon between the site name and the property name.
Generating Sequence Numbers in a Report
I would like to create a section that would print the
second row of data and skip the first. I do not know how to do this.
Currently I use a section that says WHEN FIRST OF.
That part works great.
However I want to use a different template for the next
row and I do not want the data from the first row repeated. I tried
something like When NOT FIRST, but no such command seems to work.
I have successfully created a report that can do this if
the data is sequenced. In this case I say when ____ > 1 then ...
However, I do not want my users to have to sequence
their data to use my report.
Is there a way to use the old fashioned counters like in
the FORTRAN Programming days to do comparisons for sections?
Yes, it is possible to generate sequence numbers inside
the report script. For instance, if you want to sequence the components for
a map unit, you have to start with some data that is certain to be unique
for each map unit, such as the column dmuiid. Then you can define a counter
like:
DEFINE comp_number IF NEW(dmuiid) THEN 1 ELSE comp_number
+ 1.
Then your sections can use conditions like WHEN
comp_number==2, etc.
|