home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / dbase / a4_faq.zip / REPORTS.TXT < prev   
Text File  |  1993-01-13  |  25KB  |  501 lines

  1.             Common Questions about Alpha FOUR Reports
  2.  
  3. This document covers some of the more commonly asked questions
  4. about reports in Alpha FOUR. For specific problems with printing
  5. a report (such as page alignment) see the document on printing.
  6.                                 
  7.                         Printing/Display
  8.                                 
  9. Q    I don't understand the different sections included in a
  10. report: when they print and where to put my data. For example,
  11. what's the difference between the Report Header section and the
  12. Page Header section?
  13.  
  14. A    The different sections in a Report can seem confusing at
  15. first. Let's try to give some perspective to this by giving a
  16. short description of what each of the sections do.
  17.  
  18. Report    Prints at the top of the report, replaces the
  19. Header    page header on the first page only. This section
  20.           usually includes things like the report title,
  21.           the date etc...
  22. Page      Prints at the top of each page. Usually includes
  23. Header    things like page numbers. Note: The page header
  24.           will be replaced with the Report header on the
  25.           first page.
  26. Titles    Appears at the top of every page, after any
  27.           report header or page header. You can optionally
  28.           specify that Titles should be printed only on
  29.           page 1, or that Titles should be reprinted after
  30.           Group Headers.
  31. Group n   If you are using sub grouping you may want
  32. Header    certain text or fields printing only once at the
  33.           top of each group break. For example, if you're
  34.           grouping on Company you may want the Company name
  35.           and address to appear only once at the top of
  36.           that group. For clarity you can have the
  37. Detail    Prints once for each record in the database. This
  38.           is the meat of most reports. This is where you
  39.           would place fields from your database to print
  40.           for every record.
  41. Group n   Like the group header, this section prints at a
  42. Footer    group break but below all the records contained
  43.           in that group. Summary values like a group total
  44.           would be appropriate to place here.
  45. Page      Prints at the bottom of each page. Used primarily
  46. Footer    to align data specifically at the bottom of the
  47.           page.
  48. Summary   This prints at the very end of the report. Most
  49.           often this section is used to print grand totals
  50.           and other summary values or anything you want
  51.           printed at the end of the report. You can also
  52.           specify that the summary section print on a
  53.           separate page by itself (on the Report Parameters
  54.           screen).
  55.  
  56. Most of the sections can be customized so that they replace other
  57. sections (the group header can replace the page header for
  58. instance) or print only on certain pages. For example you can opt
  59. to print the Titles section only on page 1 by saying yes to this
  60. question on the Report Parameters Screen (although you can
  61. accomplish virtually the same thing by placing your headings in
  62. the report header section and omitting the titles section
  63. completely). See the Report Parameters screen or the Grouping
  64. Parameters screen for some options.
  65.  
  66. Sections can also be added and deleted according to your needs.
  67. In fact a report with only a group footer and summary section may
  68. be desirable if you only need totals, averages and other summary
  69. values printing out and don't need the detail on each record.
  70. Don't worry about deleting a section if you don't require it, you
  71. can always get it back, you'll just have to add the fields to
  72. that section again. If you delete the detail section, the records
  73. still pass through the report they just don't print individually.
  74. Your totals and other summary values in the footers and summary
  75. section are still valid.
  76.  
  77.  
  78. Q    In my Alpha FOUR reports there are times when I would like
  79. to suppress an entire line from printing but only if a certain
  80. condition is met. Is there a way I can do this?
  81.  
  82. A    In Alpha FOUR and Alpha/three, you can suppress the printing
  83. of any line in a report (empty or filled) by following the
  84. example outlined below.
  85.  
  86. First create a calculated field in the report using an expression
  87. such as:
  88.      IF(FIELD="XXX"," ",CHR(127))
  89. Insert this calculated field in the report anywhere on the line
  90. to be blanked (this field will be invisible). Next go into the
  91. format options screen (Alt-O) and add a dash, "-" (the delete-
  92. when-blank format code) in the FMT column for that calculated
  93. field. Finally make sure to set "Suppress blank lines?" to YES on
  94. the Report Parameters screen (F7, report Parameters).
  95.  
  96. When a field formatted with a dash is blank, Alpha FOUR will
  97. usually suppress the entire line the field is on from printing.
  98. The expression causes Alpha FOUR to choose between a blank space
  99. (" ") which would allow the line to be suppressed, and CHR(127)
  100. which represents a character that cannot be suppressed by the
  101. dash.
  102.  
  103. If the condition in the expression is met, FIELD="XXX", the
  104. calculated field will return a blank space. In this case the "-"
  105. format option ("delete-when-blank") takes over and instructs
  106. Alpha FOUR to suppress the entire line from printing on the
  107. report. If the condition is not met (FIELD does not equal "XXX")
  108. the calculated field returns a value of CHR(127) (the non-
  109. suppressible line character  ). This character ( ) is inserted on
  110. that line in the report which forces Alpha FOUR to disregard the
  111. dash formatting option and print the line.
  112.  
  113. ASCII character 127 () is Alpha FOUR's symbol for a non-
  114. suppressible line. It is the same character used when you press
  115. Ctrl-Bksp on a line in a Report to force a blank line. It is used
  116. by the program internally and won't print.
  117.  
  118. Example: Suppose a report uses one level of grouping, with a
  119. group footer that prints the total number of records in the
  120. current group. If a group contains only one record, printing the
  121. footer would be redundant, so you want to suppress the entire
  122. footer. However, when the group contains two or more records, you
  123. want to print the footer.
  124. 1) From the Report Layout screen, press Alt-C to access the
  125.    Calculated Fields definition screen.
  126. 2) Enter a name for the new calculated field, such as SUPPRESS.
  127. 3) For the field's expression, enter:
  128.         IF(SYSTEM->CNTR_GRP1=1," ",CHR(127))
  129. 4) Press F10 (Continue) to store the new calculated field.
  130. 5) Place this CALC->SUPPRESS field in the group footer anywhere
  131.    on the line that you want suppressed. In this case place it
  132.    on every line in the footer because you want the whole footer
  133.    suppressed.
  134. 6) Press Alt-O to access the Formatting Options screen.
  135. 7) Enter a dash (-) in the "Fmt" column for every occurrence of
  136.    the CALC->SUPPRESS field. This format code forces Alpha FOUR
  137.    to delete the entire line when the CALC->SUPPRESS field
  138.    contains a blank space.
  139. 8) Press F10 (Continue) to save the new formatting options.
  140.  
  141. When the Report prints, here's what happens:
  142. 1) When Alpha FOUR gets to the group footer section, it
  143.    evaluates the expression:
  144.         IF(SYSTEM->CNTR_GRP1=1," ",CHR(127))
  145. 2) Alpha FOUR checks the current value of SYSTEM->CNTR_GRP1. If
  146.    SYSTEM->CNTR_GRP1 equals 1 (indicating there was only one
  147.    record in group 1) a blank space is inserted into the line.
  148.    If SYSTEM->CNTR_GRP1 equals anything but 1, CHR(127) ( ) is
  149.    inserted onto the line.
  150. 3) If the line contains a blank space, the "-" format takes
  151.    effect, and deletes the entire line from the report. However,
  152.    if the line contains  , the line cannot be suppressed, so
  153.    Alpha FOUR prints the entire line.
  154.  
  155. NOTE: Although this technique causes a line to be suppressed from
  156. printing, the data on that line is still technically part of the
  157. report and is included in any appropriate summary values. It is
  158. only the printing that has been suppressed. This technique also
  159. works in Forms and Mail Labels.
  160.  
  161.  
  162. Q    Is there a way I can get a blank line after every so many
  163. records in a report?
  164.  
  165. A    This expression will create a calculated field that will
  166. print as a blank line but only every so many records. For example
  167. suppose you want a blank line after every 5 records.
  168.  
  169. Define a calculated field in the report with the following
  170. expression: INT(SYSTEM->CNTR_GRAND/n)
  171. where n is the number of records you want printed before a blank
  172. line.
  173.  
  174. Create one grouping level. The field on which the group is based
  175. will be the calculated field above. Next, place your cursor on a
  176. blank line at the bottom of your group 1 footer.  Press the CTRL
  177. and BKSP keys simultaneously.  This will add a small house-shaped
  178. character () which will force a blank line at that point in
  179. conjunction with the group level above.
  180.  
  181. The calculated field creates a dummy numbering system that forces
  182. the group 1 footer to print every so many records. The  symbol
  183. forces a blank line to print whenever the group 1 footer prints.
  184.  
  185.  
  186. Q    What are my options for printing multiple copies of a
  187. report?
  188.  
  189. A    Aside from the obvious - printing the report twice (you can
  190. put the keystrokes to do this into a script), you also have a few
  191. other options:
  192.  
  193. On a Laserjet: To get multiple copies of reports on an HP
  194. Laserjet (and many other laser printers) modify the printer
  195. configuration. The following changes to the printer configuration
  196. cause Alpha FOUR to print n number of copies of each page. After
  197. the report is done printing, you can collate the pages into
  198. multiple copies of the report.
  199.  
  200. To get into the printer configuration; from the main menu, choose
  201. Other, Configuration, Printer configuration, Create/edit. Place
  202. the following in the setup codes into the printer configuration:
  203. Setup codes: 27 38 108 nn 88  ("nn" should be replaced by the
  204. decimal value representing the number of copies - "50" for 2
  205. copies "51" for 3 etc). For example, for 2 copies use the codes:
  206. 27 38 108 50 88
  207. Close out codes: 27 69 (this resets the printer back to one
  208. copy).
  209.  
  210. The main drawback to this method is that multiple copies of each
  211. page will print out one after the other rather than one report
  212. then the second and so on. You then have to go through and
  213. separate the pages.
  214.  
  215. On other printers: An alternative method for printing multiple
  216. copies of a report is rather involved but this will work if there
  217. are no other options. Here you'll be creating a set with a child
  218. database that has one, two, 10 or more records that each match
  219. every record in your database (now the parent database of the
  220. set). When the report prints it will print multiple copies of
  221. each record because the set now contains multiple "virtual"
  222. records for each of your records. The number of copies printed is
  223. determined by how many records you create in the child database.
  224.  
  225. Reconfigure your current database and add a new field called DUP.
  226. This field will be used to link the two databases into a set. The
  227. field should be Character type with a length of one. When this is
  228. completed, globally update this field so that every record
  229. contains the letter "A" in this field. Next, create a new
  230. database and call it COPIES. The only field in this database
  231. should be called TEMP and it should be Character in type and have
  232. a length of one. Then enter as many records as you want copies
  233. into this new database and the TEMP field should contain the
  234. letter "A" for each record. For example to get two copies of the
  235. report enter two records into COPIES. After you have entered the
  236. records build an index on the field TEMP.
  237.  
  238. Next build a set from these two databases. Link your database as
  239. the parent with link mode set to "All", and use the newly created
  240. TEMP index as the linking index. You may then borrow the report
  241. from the parent database and print it out. Alpha FOUR will create
  242. a virtual copy of each record in parent database for each match
  243. it finds in the child thus creating the desired copies of the
  244. report.
  245.  
  246. Note: This method will only work if you have each record starting
  247. on a separate page. If more than one record appears on a page you
  248. will get duplicate copies of each record rather than duplicate
  249. copies of each page.
  250.  
  251.  
  252. Q    How can I start the page numbering at other than 1?
  253.  
  254. A    Here is a calculated expression you can use to start
  255. numbering pages beginning with a number other than 1:
  256.      nn+IF(SYSTEM->CNTR_GRAND<=1,1,SYSTEM->PAGENUMBER)
  257. "nn" should be one less than the number you actually want to
  258. begin with. For example if you want to begin with the number 2,
  259. replace "nn" with the number 1: 1+IF(SYSTEM-
  260. >CNTR_GRAND<=1,1,SYSTEM->PAGENUMBER)
  261.                              
  262.    
  263.                          Summary values
  264.                                 
  265. Q    Whenever I print a report from my set my summary totals are
  266. always higher than I expected. What could be causing this?
  267.  
  268. A    Whenever you link three or more databases into a set and at
  269. least two of the links is a one-to-many link (Link to? set to
  270. "All") you take the risk of creating more virtual records than
  271. you intended. The reason for this is that Alpha FOUR tries to
  272. show you all the possible combinations of matching records in all
  273. the linked databases. For example, suppose you have three
  274. databases A, B and C. You create a set of these databases with
  275. database A as the primary database and both database B and C
  276. linked directly to database A on the same common field.
  277.  
  278. If database B and C always have only than one record that matched
  279. the parent record (A) then you would not have a problem. Alpha
  280. FOUR would simply show you one "virtual" record that displayed
  281. the single matching records from database A, B and C on the
  282. screen at one time (one "virtual" record).
  283.  
  284. Let's take this a step further. Suppose database C has two
  285. matching records for a given record in database A but database B
  286. still has only one match for that record. This causes Alpha FOUR
  287. to show two virtual records; since database C has two records
  288. that match the one record in database A and B, this accounts for
  289. the two virtual records shown by the set.
  290.                                 
  291.  
  292. Finally let's assume that database B now also has two matches
  293. along with the two matches in database C. At first  it seems that
  294. Alpha FOUR should show two virtual records. Looking more closely
  295. you realize that all possible matches must be shown so four
  296. virtual records are displayed. One representing each possible
  297. combination.
  298.                                 
  299. In the report, you are actually "feeding" the report 4 virtual
  300. records and this is why the totals are always coming out higher
  301. than you expect. Let's assume that the field you are totaling
  302. comes from the parent (A) database. Remember that one record from
  303. database A will be fed to the report with each virtual record.
  304. Therefore the same value from database A gets fed to the report 4
  305. times even though there is only one physical record in database
  306. A; there are four virtual records. This explains why the totals
  307. are higher than expected.
  308.  
  309. To better illustrate this, try including the field you are
  310. totaling in the detail section (as a value). When you print this
  311. report you will probably notice that the field value is printed
  312. more than you expected. With two or more child databases a set
  313. linked one-to-many this is actually what is supposed to happen.
  314. Alpha FOUR is printing the field value as many times as there are
  315. virtual records.
  316.  
  317. One option for getting around this is to make all but one of the
  318. links a one-to-one (link to "first" or "last" rather than all).
  319. In the example above, if you linked database A to B as "first"
  320. and left the A-C link as "all" you would limit Alpha FOUR to
  321. showing only one match (the first match) from database B and this
  322. would show only two virtual records much like the first example
  323. above.
  324.  
  325. This may not work for some. If you actually need to link more
  326. than one of the databases as one-to-many, realize that you are
  327. potentially creating more virtual records and will need to
  328. account for this in any summary totals.
  329.  
  330. If you are grouping on a field in the primary database and would
  331. like to increment the total for a field only once per grouping
  332. you could use a calculated field with the expression:
  333.      IF(CNTR_GRP_1=1,FIELD,0)
  334. Then take the total of this calculated field as a summary value
  335. rather than taking a total of the original FIELD. This expression
  336. will only return a value for FIELD for the first record in each
  337. group. All subsequent records in the group will return 0. This
  338. prevents the total from over-incrementing by adding a value for
  339. every record in that group.
  340.  
  341.  Section        Summarizing the FIELD          Summarizing the
  342.                                               calculated field
  343.  Detail                     FIELD=595           CALC FIELD=595
  344.  Detail                     FIELD=595             CALC FIELD=0
  345.  Detail                     FIELD=595             CALC FIELD=0
  346.  Group1 ftr/Group total of FIELD=1785  Group total of CALC=595
  347.  Detail                     FIELD=645           CALC FIELD=645
  348.  Detail                     FIELD=645             CALC FIELD=0
  349.  Group1 ftr/Group total of FIELD=1290  Group total of CALC=645
  350.  Detail                     FIELD=234           CALC FIELD=234
  351.  Detail                     FIELD=234             CALC FIELD=0
  352.  Group1 ftr/ Group total of FIELD=468  Group total of CALC=234
  353.  Summary    Grand total of FIELD=3543 Grand total of CALC=1474
  354.  
  355.  
  356. Q    I have a report that prints information from a relational
  357. set that uses a one-to-many link. How can I get Alpha FOUR to
  358. include the AMOUNT only once for each record in the primary
  359. database, instead of multiple times for each link to a child
  360. record?
  361.  
  362. A    To accomplish this create a calculated field in the report
  363. that will capture the AMOUNT only once for each primary database
  364. record. Then summarize the calculated field to print the total in
  365. the report's Summary Section.
  366.  
  367. The calculated field expression uses the System Database subgroup
  368. counter field, so you must first specify one level of grouping on
  369. the (F7) Report Parameters screen in the Report Layout. On the
  370. (F7) Grouping Parameters screen, specify as the group 1 break
  371. field any field in the primary database that will change with
  372. each new record (SYSTEM->REC_NUMBER is good). Next, use the
  373. following expression in a calculated field called AMTCALC (F2,
  374. Define Calculated Field):
  375.      IF(SYSTEM->CNTR_GRP1=1,PRIMARY->AMOUNT,0)
  376. Place the SYSTEM->CNTR_GRP1 field in the above expression by
  377. pressing F2 Fields, System and selecting CNTR_GRP1 from the list
  378. of system database fields. In this example, the primary database
  379. in the set is named PRIMARY and the field to summarize is named
  380. AMOUNT.
  381.  
  382. Once you have defined the calculated field AMTCALC, press F10 to
  383. return to the Report Layout screen. Position the cursor in the
  384. report's Summary Section where you want the amount total to
  385. appear. Press F2 Fields, Select Field, Calculated and select
  386. AMTCALC. On the summary options list, choose TOTAL. Alpha FOUR
  387. will now total the calculated field AMTCALC which only returns
  388. AMOUNT once for each master record.
  389.  
  390.  
  391. Q    How can I total just the last values from each subgroup in a
  392. Report without including every record in that group?
  393.  
  394. A    This illustrates how to only include the last record from
  395. each subgroup in the total. It ignores, from the total, all
  396. records that are not the last record in the subgroup.
  397.  
  398. This example assumes that you have at least on level of sub
  399. grouping. First you need to determine the last record of a
  400. subgroup. To do this create a summary field based on the SYSTEM-
  401. >CNTR_GRP1 system field, set the summary column to "Last", set
  402. the Level to "Grand", and set Process to "Pre-processed". Call
  403. this field GRP1LST
  404.  
  405. Next, create a calculated field in the Report that will test to
  406. determine if the system field SYSTEM->CNTR_GRP1 is equal to the
  407. Preprocessed summary field defined above, SUMARY->GRP1LST. Call
  408. this field CALC1.
  409.      IF(SYSTEM->CNTR_GRP1=SUMMARY->GRP1LST,fieldname,0)
  410. "Fieldname" in the above expression refers to the numeric field
  411. you wish to total. Place CALC1 in the summary section of the
  412. report as a total. This returns a "fieldname" total but includes
  413. only the last record in each subgroup.
  414.                                 
  415.                            Subgrouping
  416.  
  417. Q    How do indexes relate to subgrouping?
  418.  
  419. A    The index controls the order in which the records are "fed"
  420. to the report. The subgroup simply breaks the report into groups
  421. but it cannot control the order of the records. This is why it is
  422. so important to include the subgroup fields in your index. If the
  423. database records are being fed to the report in record number
  424. order for example you will not have related records grouped
  425. together. The subgroup will then group all the related records
  426. that happen to be next to each other into one group.
  427.  
  428. Another way to look at it is this. Alpha FOUR simply watches the
  429. subgroup field for a change as records are fed to the report. As
  430. far as the subgroup is concerned, there is nothing in the
  431. database except for the subgroup field in the current record and
  432. that same field from the previous record. When Alpha FOUR sees a
  433. change in this field from the last record it inserts a group
  434. break, but the subgroup cannot move records around if they are
  435. out of order. The index must group all related records together
  436. so that when the subgroup places a break it makes sense.
  437.  
  438.        Database Indexed on            Database Indexed on
  439.                  Last name            Company
  440.                         
  441.    Anderson, Bob, Alpha Co.           Alpha Co., Anderson,Bob
  442.    Jones, Stephen,Alpha Co.           Alpha Co., Jones,Stephen
  443.  
  444.   Marchant, Claud, Beta Co.           Alpha Co., Marsh,Gloria
  445.  
  446.    Marsh, Gloria, Alpha Co.           Beta Co., Marchant,Claud
  447.     Smith, Nancy, Gamma Co.           Beta Co., Via, Marie
  448.  
  449. Thompson, Howard, Gamma Co.           Gamma Co., Smith,Nancy
  450.                                       Gamma Co., Thompson,Howard
  451.        Via, Marie, Beta Co.           Gamma Co., Wood,Burt
  452.  
  453.       Wood, Burt, Gamma Co.           
  454.                                         
  455.  
  456. Q    How can I subgroup my report by every nth record?
  457.  
  458. A    Grouping a report by every nth record (every 4th record
  459. represents a new group for example) involves creating a
  460. calculated expression in the report and using this calculated
  461. field as the subgroup field. You want an expression that will
  462. return the same character(s) for 4 consecutive records then
  463. change and remain constant for the next 4 records and so on. The
  464. following expression does this using the INT function:
  465.      INT((SYSTEM_CNTR_GRAND-1)/4))
  466. This expression makes use of the report's counter and returns the
  467. integer portion of the result of subtracting 1 from the system
  468. counter then dividing it by 4 (or any number you want).
  469.  
  470. SYSTEM_CNTR_GRAND  (SYSTEM_CNTR_GRAND-1)/4  Subgroup looks at
  471.                                             the integer
  472.        1                  0                     0
  473.        2                 0.25                   0
  474.        3                 0.5                    0
  475.        4                 0.75                   0
  476.        5                 1.0                    1
  477.        6                 1.25                   1
  478.        7                 1.5                    1
  479.        8                 1.75                   1
  480.        9                 2.0                    2
  481.  
  482. Grouping by week: Grouping by the week involves a similar logic.
  483. Create a calculated group break field with the following
  484. expression: INT(DATEFIELD-{DATE_VALUE},/7) Use this field as your
  485. subgroup break field. The key to making this work is the date
  486. that you place in the field DATE_VALUE. This date must be the
  487. same day of the week as the day you want to break on--Sunday,
  488. Monday, etc. and also a date that is at least two weeks earlier
  489. than the first record you will be printing. For example if the
  490. earliest date in your database is 6/1/92 and you want to group by
  491. week starting on Sunday, DATE_VALUE could be 5/10/92 (a Sunday at
  492. least two weeks before 6/1/92).
  493.                                 
  494.                           Miscellaneous
  495.  
  496. Calculated Field Tip: If you are using virtually the same
  497. expression in multiple calculated fields you may want to consider
  498. using the clipboard and pasting the expression multiple times.
  499. Use Alt-F5 to copy the expression to the clipboard and use Alt-F6
  500. to paste. Then simply edit the expression with any changes.
  501.