home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / rbnotes2.zip / EDTORIAL.14 < prev    next >
Text File  |  1986-07-03  |  28KB  |  739 lines

  1. MICRORIM TECHNICAL NOTE
  2. ________________________________________________________
  3.  
  4. HOW TO DISPLAY TIME DATA TYPE IN DIFFERENT FORMATS
  5.  
  6. DATE      :  05/86                   NUMBER       :  EX-5-1
  7. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  8. CATEGORY  :  FORMATS                 SUBCATEGORY  :  TIME DATA TYPE
  9.  
  10. ________________________________________________________
  11.  
  12. DESCRIPTION:   How can I display or enter data into a TIME type column or
  13. variable in military format or without the seconds?
  14.  
  15.  
  16.  
  17.  
  18. EXPLANATION:   Time type variables and columns can be displayed or entered in
  19. any of the following four formats:
  20.  
  21.   o  am/pm format with seconds by using a location/display width of 9
  22.   o  am/pm format without seconds by using a location/display width of 6
  23.   o  military format with seconds by using a location/display width of 8
  24.   o  military format without seconds by using a location/display width of 5 or
  25.   7.
  26.  
  27. For example, 6:35pm can be entered as 6:35p or 18:35:00 and displayed as:
  28.  
  29.   o  6:35:00p
  30.   o  6:35p
  31.   o  18:35:00
  32.   o  18:35
  33.  
  34. If you are entering 6:35p, remember to include the p (for pm) or the value
  35. entered will be assumed to be 6:35 am.
  36.  
  37.  
  38.  
  39.  
  40. SOLUTION:   When entering data, use any of the four formats.  To display data
  41. in a certain format, set the width of the output by using the location width
  42. (including the S and the E) in your report or form.  Or you can use the =w
  43. option available in the SHOW VARIABLE and SELECT commands.
  44.  
  45. For example, if you want to select the time columns START and STOP and display
  46. them in am/pm format without seconds, use the following command:
  47.  
  48. SELECT START=6 STOP=6 FROM tblname
  49.  
  50. If START and STOP are variables, use the following commands to display their
  51. values in military format without seconds:
  52.  
  53. SHOW VAR START=5
  54. SHOW VAR STOP=5
  55.  
  56. It does not matter how the data was originally entered because these are
  57. display formats.  The data is not actually changed in any way.
  58.  
  59. Use the following table as a general guide:
  60.  
  61. WIDTH   TWO SAMPLE DISPLAYS
  62. ----   --------------------
  63.   5     12:16      18:35
  64.   6     12:16p      6:35p
  65.   7     12:16      18:35
  66.   8     12:16:10   18:35:45
  67.   9     12:16:10p   6:35:45p
  68.  
  69. Note that the displays for widths of five or seven are the same.
  70.  
  71.  
  72.  
  73.  
  74.  
  75. MICRORIM TECHNICAL NOTE
  76. ________________________________________________________
  77.  
  78. USING VARIABLE FORMS AS HELP SCREENS IN APPLICATIONS
  79.  
  80. DATE      :  05/86                   NUMBER       :  EX-5-2
  81. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  82. CATEGORY  :  VARFORMS                SUBCATEGORY  :  HELP SCREENS
  83.  
  84. ________________________________________________________
  85.  
  86. DESCRIPTION:   I have discovered that I can draw as many variable forms as I
  87. want to, without having to issue a NEWPAGE, if I do not locate any variables
  88. in them as long as I check for an error code of 616 and redraw the form if it
  89. is found.  In other words, if I meet these two conditions, I do not have to do
  90. a NEWPAGE after five DRAW commands.  How can I make use of this undocumented
  91. feature?
  92.  
  93.  
  94.  
  95.  
  96. EXPLANATION:   Tim Smith, a registered R:BASE consultant, explains his use for
  97. this feature below.
  98.  
  99. One of the subtle areas of power most R:BASE users may not know about is the
  100. ability to use informational text-only variable forms as a help box to remind
  101. casual users of an application of the choices they have.
  102.  
  103. There are three basic methods that can be used to make and use text-only help
  104. boxes (screens):
  105.  
  106.   o  Use physical DOS text files that you TYPE or DISPLAY.
  107.   o  Use help screens created by Application EXPRESS.
  108.   o  Use WRITE statements to write the help on the screen.
  109.   o  Use text-only variable forms.
  110.  
  111. We have found that the use of physical DOS text files to store help screens is
  112. slow, limited, and can clutter your disk with a number of small files.
  113. Additionally, it is difficult to EDIT the help screens created by Application
  114. EXPRESS because the application has been compiled.  If you use WRITE
  115. statements then you also must go into your application itself and change the
  116. code whenever you want to revise your help information.  This makes updates to
  117. an application difficult.
  118.  
  119. Text-only variable forms can be drawn anywhere, up and down the screen, as
  120. many times as you like, as long as you draw the screen twice when encountering
  121. a 616 error code.  If the need arises to change the help screen, all you need
  122. to do is update the forms table and send a disk to the customer with an
  123. RBASE.DAT file that automatically updates their FORMS table.
  124.  
  125. An application using several FILLIN commands will run fastest by using
  126. consecutive WRITE commands to draw your help screens.  However it may be
  127. difficult and time consuming to modify.  Text-only variable forms are the next
  128. fastest method because by using variable forms you never have to find and open
  129. a DOS file.  Because text-only variable forms are the easiest to modify, we
  130. use them extensively in our applications.
  131.  
  132.  
  133.  
  134.  
  135. SOLUTION:   Here, Tim describes the text-only variable forms method and gives
  136. an example.
  137.  
  138. Making the Variable Form Help Box
  139.  
  140. Create a variable form with the text information you want.  It is best to keep
  141. help boxes short and simple.  Six lines or less is best.  Make sure to put a
  142. border around it.  The border is necessary if you want to create a blank box
  143. to blank out your help box.  The blankout form will not work unless there are
  144. characters on the righthand border of the form.
  145.  
  146. When you QUIT and SAVE the form you have just created, you may get an error
  147. message warning you that no variables are located; just ignore it.  Save the
  148. form with a context sensitive name such as TRANCODE if the transaction codes
  149. for a general ledger are what is stored in the form.
  150.  
  151. Using the Variable Form Help Box
  152.  
  153. To use the variable form, DRAW it onto the top or the bottom of the screen.
  154. This way the user has a continual reminder of appropriate reactions to the
  155. FILLIN prompts and the application developer can control the location,
  156. content, and timing.
  157.  
  158. Also, the help boxes can be drawn over each other or a blanking box can be
  159. drawn on top of them to make them go away.  Your application will run faster,
  160. be more manageable (because of fewer files), be easier to modify, and will
  161. take up less storage (because of DOS minimum file size).  The example below
  162. relates a common usage.
  163.  
  164. Exercise
  165.  
  166. Create a variable form TRANCODE that looks like the sample help box below
  167.  
  168. Sample help box:
  169.  
  170.  _______________________
  171. |    NCR Trancodes     |
  172. |    -------------     |
  173. |    1. Cash           |
  174. |    2. Charge         |
  175. |    3. Layaway        |
  176. |    4. Paidout        |
  177. |______________________|
  178.  
  179. Now, make a second variable form that has blank lines in it by issuing the
  180. following commands:
  181.  
  182. PROJECT TEMP FROM FORMS USING ALL WHERE FNAME EQ TRANCODE
  183. CHANGE FNAME TO BLANKBOX IN TEMP WHERE FNAME EQ TRANCODE
  184. APPEND TEMP TO FORMS
  185. REMOVE TEMP
  186. FORMS BLANKBOX
  187.  
  188. At this point, press E to edit the form and the BLANKBOX form will come up on
  189. the screen ready for you to edit it.  Leave the box outline marks and space
  190. over the letters inside the box to create a blank box.  Save the form and you
  191. have your blank box.
  192.  
  193. TEST.CMD, the command file listed below, is an example of how to implement
  194. this concept.  This particular example is set up to run through the WHILE loop
  195. eight times.  The eight was simply chosen to demonstrate the concepts
  196. involved.  You will want to modify the code to better reflect your actual
  197. situation.
  198.  
  199. *( TEST.CMD shows the value of being able to DRAW a text-only variable
  200.    form in an R:BASE 5000 command File.)
  201. SET MESS OFF
  202. SET ERR MESS OFF
  203. SET ERR VAR CHECKIT
  204. SET V vwhile TO 8
  205. WHILE vwhile GT 0 THEN
  206.   *(Draw the HELP BOX and if it fails then DRAW it again)
  207.   DRAW TRANCODE AT 1
  208.     IF CHECKIT = 616 THEN
  209.       DRAW TRANCODE AT 1
  210.     ENDIF
  211.   FILLIN vaction USING " " AT 19,25
  212.   *(Now blank out the HELP BOX area)
  213.   DRAW BLANKBOX AT 1
  214.     IF CHECKIT = 616 THEN
  215.       DRAW BLANKBOX AT 1
  216.     ENDIF
  217.   SET v vwhile TO .vwhile - 1
  218. ENDWHILE
  219.  
  220. The IF blocks are necessary because if this is the sixth DRAW the DRAW will
  221. fail and the error variable CHECKIT will have a value of 616.  But because the
  222. buffer is cleared when the error is encountered all you need to do is redraw
  223. the form to start counting over again.
  224.  
  225. These help boxes can be used in a variety of applications.  Anyone who uses
  226. the FILLIN command to have the user pick from a number of valid choices can
  227. make use of this feature.
  228.  
  229.  
  230.  
  231.  
  232.  
  233. MICRORIM TECHNICAL NOTE
  234. ________________________________________________________
  235.  
  236. OUTPUTTING TO VARIOUS OUTPUT DEVICES
  237.  
  238. DATE      :  05/86                   NUMBER       :  EX-5-3
  239. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  240. CATEGORY  :  REPORTS                 SUBCATEGORY  :  OUTPUT/DEVICES
  241.  
  242. ________________________________________________________
  243.  
  244. DESCRIPTION:   How can I output reports and other types of output to different
  245. printers or other output devices such as modems?
  246.  
  247.  
  248.  
  249.  
  250. SOLUTION:   Use the OUTPUT command to specify the correct device name.  For
  251. example, the following code will send the report NAMES to the printer attached
  252. to the LPT1 port and send the DOLLARS report to the printer attached to the
  253. COM1 port:
  254.  
  255. OUTPUT LPT1     *( Notice no colon )
  256. PRINT NAMES
  257. OUTPUT COM1
  258. PRINT DOLLARS
  259. OUTPUT SCREEN
  260.  
  261. This works because of a feature of DOS.  R:BASE creates a file with the same
  262. name as the output device and whenever DOS finds a filename that is the same
  263. as the name of the device, DOS sends the contents of the file to the device.
  264. To DOS the filename and device are the same thing.
  265.  
  266.  
  267.  
  268.  
  269.  
  270. MICRORIM TECHNICAL NOTE
  271. ________________________________________________________
  272.  
  273. R:BASE 5000 WITH THE HP LASERJET
  274.  
  275. DATE      :  05/86                   NUMBER       :  EX-5-4
  276. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  277. CATEGORY  :  PRINTERS                SUBCATEGORY  :  HP LASERJET
  278.  
  279. ________________________________________________________
  280.  
  281. DESCRIPTION:   R:BASE 5000 interfaces with the HP Laserjet printer just as it
  282. does with any other printer that works with DOS.  However, there are a few
  283. differences in terms of set-up and operation of the printer.
  284.  
  285.  
  286.  
  287.  
  288. EXPLANATION:   The Laserjet interfaces with the serial port on the computer.
  289. Most dot matrix printers use the parallel port.  Therefore, the following two
  290. commands must be executed at the DOS level, usually in an AUTOEXEC.BAT  file:
  291.  
  292. MODE COM1:9600,N,8,1,P
  293. MODE LPT1:=COM1
  294.  
  295. These commands redirect the output to the serial port instead of the parallel
  296. port.  Without these mode settings, if you try to output to the printer, it
  297. will go to the parallel port.  If you don't have a printer hooked into your
  298. parallel port, the computer will hang.
  299.  
  300. Escape sequences function much the same as with other printers.  The Laserjet
  301. stores some fonts in memory, but others are stored in replaceable cartridges.
  302. Only the fonts in the currently installed cartridge or in memory are
  303. supported.
  304.  
  305. The Laserjet often does not appear to print the last page of a report.  This
  306. is due to the fact that it stores each page of data in its memory before it
  307. prints it.  Whenever the "form feed" light is on, it indicates that there is
  308. data in the printer's memory.  If the memory contains less than a page of
  309. data, it will not print that data until the page fills up or it is sent a page
  310. eject.  There are several ways to force the last page of a report to print as
  311. indicated in the solution section.
  312.  
  313.  
  314.  
  315.  
  316. SOLUTION:   Try the following suggestions to get the contents of the printer
  317. memory buffer to print:
  318.  
  319.   o  Turn the printer offline by pressing the "online" key so that the light
  320.   on that key is off, and then press the "form feed" key.  When there is no
  321.   longer any data in the printer's memory buffer, the light above the "form
  322.   feed" key will go off.  Make sure to press the "online" key to put the
  323.   printer back online in order to do more printing.
  324.  
  325.   o  At the R>, if the output is still directed to the printer, type
  326.   "newpage".  This sends a page eject to the printer and causes it to print
  327.   the data in the buffer.
  328.  
  329.   o  Specify a page eject after the report footer.  If you don't have a report
  330.   footer in your report, simply mark a blank line as report footer - it won't
  331.   affect the appearance of the report.
  332.  
  333.   o  Define a report variable as a page eject and locate it in the report
  334.   footing.
  335.  
  336.  
  337. A common misconception is that Laserjet escape codes are too long for R:BASE
  338. report variables, which have a maximum length of 30 characters.  The only time
  339. that this should be a problem is if the escape codes are concatenated.  The
  340. Laserjet will allow several escape codes to be concatenated together into one
  341. long escape code.  Instead of concatenating, define each escape code as a
  342. separate report variable.  Make sure that the report variables are located in
  343. the correct order because the Laserjet will perform the escape sequences in
  344. the order in which they are specified.
  345.  
  346. Finally, study the Laserjet Owner's Manual, Chapters 3 and 4 in particular.
  347. Chapter 3 discusses the operation of the printer, and Chapter 4 discusses the
  348. use of escape sequences.  These two chapters cover a great deal of information
  349. that warrants careful study.
  350.  
  351.  
  352.  
  353.  
  354.  
  355. MICRORIM TECHNICAL NOTE
  356. ________________________________________________________
  357.  
  358. ERRORS WITH ENTER FORMNAME FROM FILENAME
  359.  
  360. DATE      :  05/86                   NUMBER       :  EX-5-5
  361. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  362. CATEGORY  :  ERRORS                  SUBCATEGORY  :  ENTER form FROM file
  363.  
  364. ________________________________________________________
  365.  
  366. DESCRIPTION:   I am getting the error message:
  367.  
  368. - ERROR - No WHILE or IF blocks are open on the current input source
  369.  
  370. I know that I do not have any extra ENDWHILE or ENDIF commands.  Why am I
  371. getting this erroneous message?
  372.  
  373.  
  374.  
  375.  
  376. EXPLANATION:   You will get the above error message, If you have the following
  377. command inside an IF block or WHILE block:
  378.  
  379. ENTER formname FROM filename
  380.  
  381. This version of the ENTER command is used to load a formatted file using a
  382. form.
  383.  
  384. In addition to the error message problem, this particular ENTER command can
  385. also cause parts of your command file to repeat itself if any commands follow
  386. it, even if it is not inside an IF or WHILE block.  Therefore, we suggest
  387. using the solution below to solve both problems.
  388.  
  389.  
  390.  
  391.  
  392. SOLUTION:   Put the ENTER command line in a separate one-line file and then
  393. run the one-line file when you want to enter data through a form.  For
  394. example:
  395.  
  396. IF X1 = 0 THEN
  397.    RUN INFORM
  398. ENDIF
  399.  
  400. where the file INFORM contains the following command:
  401.  
  402. ENTER formname FROM filename
  403.  
  404.  
  405.  
  406.  
  407.  
  408. MICRORIM TECHNICAL NOTE
  409. ________________________________________________________
  410.  
  411. FDATA NOT DEFINED WHEN RUNNING REORD.FM
  412.  
  413. DATE      :  06/86                   NUMBER       :  EX-6-1
  414. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  415. CATEGORY  :  PROGRAM                 SUBCATEGORY  :  ERROR MESSAGE
  416.  
  417. ________________________________________________________
  418.  
  419. DESCRIPTION:   In attempting to use the program REORD.FM on a particular
  420. database, I get the following error message:
  421.  
  422. - ERROR - Variable FDATA is not defined
  423.  
  424.  
  425.  
  426.  
  427.  
  428. EXPLANATION:   The database is probably an R:BASE 4000 database that has not
  429. been converted to R:BASE 5000.  To be sure, list the FORMS table with the
  430. following command:
  431.  
  432. LIST TABLE FORMS
  433.  
  434. In R:BASE 4000, the two columns in the FORMS table are FNAME and DATA.  In
  435. R:BASE 5000, they are FNAME and FDATA.  R:BASE 4000 FORMS tables work just
  436. fine with R:BASE 5000 applications as long as you are not literally referring
  437. to the FDATA column.  The REORD.FM program does refer to the FDATA column,
  438. hence the problem with R:BASE 4000 FORMS tables.
  439.  
  440.  
  441.  
  442.  
  443. SOLUTION:   First, remove the temporary table that REORD.FM creates by issuing
  444. the following command:
  445.  
  446. REMOVE TT1
  447.  
  448. Next, use the following command to rename the affected column in the FORMS
  449. table and you are all set to reorder the prompting order in your forms with
  450. the REORD.FM program.
  451.  
  452. RENAME COLUMN DATA TO FDATA IN FORMS
  453.  
  454.  
  455.  
  456.  
  457.  
  458. MICRORIM TECHNICAL NOTE
  459. ________________________________________________________
  460.  
  461. BUILDING CHOOSE MENUS BASED ON COLUMN VALUES
  462.  
  463. DATE      :  06/86                   NUMBER       :  EX-6-2
  464. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  465. CATEGORY  :  MENUS                   SUBCATEGORY  :  TABLE BASED
  466.  
  467. ________________________________________________________
  468.  
  469. DESCRIPTION:   A traditional menu with fixed choices is fine in some
  470. applications but sometimes I need to build menus based on the values stored in
  471. a column.  An example would be a General Ledger for a Multi-Department Company
  472. or office.  The traditional method of building a menu quickly becomes obsolete
  473. as the possible choices change.  If a user wishes to add, delete, or change a
  474. costing center the menu must be updated.  I need to to be able to create a
  475. menu based on choices that are stored in a table.  The command file listed
  476. below will create a CHOOSE MENU by using the CHOOSE command itself, a simple
  477. command file, and a one line report.
  478.  
  479.  
  480.  
  481.  
  482. EXPLANATION:   CHOOSE menus are menus used with the CHOOSE command.  They are
  483. created automatically by EXPRESS or you can create your own.  The solution
  484. presented here automates the process of changing the choices presented in a
  485. CHOOSE menu during processing of the application.  As the choices change, the
  486. application automatically changes the menu choices.
  487.  
  488. CHOOSE menus can be blocks in procedure files or can be actual DOS files.
  489. They must follow a specific format and may have the choices listed verically
  490. (a column menu) or horizontally (a row menu).  The first line must be the word
  491. MENU.  The second line's first word is ROW or COLUMN, depending on the type of
  492. menu, followed by the title to be printed at the top of the menu.  The
  493. remaining lines are the choices to be listed in the menu.
  494.  
  495. You can have up to a maximum of 382 characters per menu.  Vertical (column)
  496. menus have have up to 9 choices and horizontal (row) menus may have up to 40
  497. items as long as you stay within the maximum of 382 characters..
  498.  
  499. If the menu is a DOS file, name it with the name you will use to call it.  For
  500. example, if the file is named FUND, you would use the following R:BASE command
  501. line to execute it:
  502.  
  503. CHOOSE OPTION FROM FUND
  504.  
  505. In this example, the variable OPTION will hold the choice that the operator
  506. picks from the menu FUND.
  507.  
  508. For more information on menus and the CHOOSE command, see your R:BASE 5000
  509. manuals.
  510.  
  511.  
  512.  
  513.  
  514. SOLUTION:   This solution was contributed by Tim Smith an R:BASE 5000
  515. registered Value Added Reseller (VAR).
  516.  
  517. The following describes the database used in this example:
  518.  
  519. Table:     PROGRAMS   (Contains general ledger entries.  It is used to track
  520.                        23 community service programs).
  521.  
  522. Columns:   PRGRM#  Integer  -  The Number of the Costing Center or Department
  523.            PRGRMNM Text 40  -  The Name of the Program
  524.  
  525. Report:    FUNDMENU
  526.  
  527. CREATING THE REPORT
  528.  
  529. Create the FUNDMENU report and locate the column containing the menu choices
  530. (PRGRMNM in this example).  Next, mark the line containing the PRGRMNM
  531. location with a D for detail.  The entire layout will consist of the following
  532. single line:
  533.  
  534. D S                                    E
  535.  
  536. Do not mark a REPORT HEADING, but do select it in order to TURN OFF INITIAL
  537. CARRIAGE RETURN.  If you omit this step, you will end up with a blank line as
  538. a choice in your menu.
  539.  
  540. Print the FUNDMENU report sorted by PRGRM#.
  541.  
  542. THE COMMAND FILE
  543.  
  544. RUN the following simple command file to create the menu named FUND and prompt
  545. the operator for his choice.  The FUND menu lists the choices which are, in
  546. this example, names of costing centers and programs.  This method creates
  547. descriptive prompts and allows a menu to build itself as the menu options
  548. change over time.
  549.  
  550. *(FUNDMENU.CMD creates a menu named FUND which is then used in the R:BASE
  551.   application with the CHOOSE command )
  552.  
  553. OUTPUT FUND                            *(DIRECT OUTPUT TO fILE)
  554. WRITE "MENU"                           *(BEGIN BUILDING A MENU FILE)
  555. WRITE "ROW CHOOSE FUND TO WORK WITH"   *(CHOOSE ROW OR COLUMN MENU TYPE)
  556. PRINT FUNDMENU SORTED BY PRGRM#        *(PRINT CURRENT LIST OF MENU CHOICES)
  557. OUTPUT SCREEN                          *(CLOSE THE FILE)
  558. CHOOSE FUNDNM FROM FUND                *(GET THE OPERATOR'S CHOICE)
  559.  
  560. That's all there is to it! When the operator adds, changes, or deletes a
  561. program or costing center, the new menu is automatically created when you RUN
  562. FUNDMENU.CMD.  Your application automatically grows and changes as needs grow
  563. and change.
  564.  
  565. If you prefer you can put the word MENU on the first line of the report (in
  566. the heading) and the ROW... line as the second line in the heading.  This
  567. would eliminate the need for the two WRITE commands in the command file.  Also
  568. keep the limits of a MENU in mind.  You can have a maximum of 40 menu items or
  569. 382 characters whichever comes first.
  570.  
  571. For example, the above process may result in the following menu file being
  572. generated:
  573.  
  574. MENU
  575. ROW CHOOSE FUND TO WORK WITH
  576. CCFP
  577. Family Day Care Homes
  578. CSBG
  579. Chore / Homemaker
  580. Insurance
  581. III-B Transportation
  582. CEOP
  583. RCS Audit
  584. Non-Federal
  585.  
  586. This horizontal (row) menu has nine options and a total of 107 characters (a
  587. total of 99 characters plus the eight spaces between each of the choices).  In
  588. this example all the menu options fit within the CHOOSE menu limits.
  589.  
  590.  
  591.  
  592.  
  593.  
  594. MICRORIM TECHNICAL NOTE
  595. ________________________________________________________
  596.  
  597. PRINTING AN AGED ACCOUNTS RECEIVABLE REPORT
  598.  
  599. DATE      :  06/86                   NUMBER       :  EX-6-3
  600. PRODUCT   :  R:BASE 5000             VERSIONS     :  1.01
  601. CATEGORY  :  REPORTS                 SUBCATEGORY  :  AGED A/R REPORT
  602.  
  603. ________________________________________________________
  604.  
  605. DESCRIPTION:   What is a good way to go about printing an aged accounts
  606. receivable report?  In other words, I want to print a report where a balance
  607. is printed in one of three columns (30 days, 60 days, and 90 days) based on
  608. the age of the balance.  How can I do this type of columnar report in R:BASE?
  609.  
  610.  
  611.  
  612.  
  613. EXPLANATION:   In R:BASE 5000 any value divided by a NULL value returns a NULL
  614. result.  Using this feature we developed the solution presented here.
  615.  
  616.  
  617.  
  618.  
  619. SOLUTION:   Set your report up using the principles and ideas presented in
  620. this example solution.
  621.  
  622. Table ACCT
  623.  
  624. This example uses a table named ACCT:
  625.  
  626. ACT# AMT               TDATE
  627. ---- ----------------- --------
  628. 101            $100.00 05/20/86
  629. 102            $200.00 04/19/86
  630. 103            $300.00 03/19/86
  631. 104            $400.00 04/20/86
  632.  
  633. Aged Accounts Receivable Report
  634.  
  635. The report calculates the number of days an account is overdue, and displays
  636. it in a 30 days overdue column, 60 days overdue column, or 90 days overdue
  637. column, as appropriate.  Totals for each group are also given.  Assuming a
  638. system date of 6/19/86, the sample report looks like this:
  639.  
  640. ACT#     0-30 DAYS   31-60 DAYS   61-90 DAYS       # DAYS
  641. ----    ----------   ----------   ----------   ----------
  642. 101        $100.00                                     30
  643. 102                                  $200.00           61
  644. 103                                  $300.00           92
  645. 104                     $400.00                        60
  646.  
  647. -----------------------------------------------------------------
  648. TOTALS:         30 DAY           60 DAY            90 DAY
  649.             ----------       ----------        ----------
  650.                $100.00          $400.00           $500.00
  651.  
  652. Special Table DAYTAB Used By Report Variables
  653.  
  654. The DAYTAB table is a special three-row look up table used by the report
  655. variables to look up the values needed to make the report format you want.
  656.  
  657. The columns DAYS, C1, C2, and C3 in the table DAYTAB are all integers.  The
  658. DAYTAB table has the following contents:
  659.  
  660. DAYS        C1       C2       C3
  661. ----------- -------- -------- ----------
  662.          61        1      -0-        -0-
  663.          31      -0-        1        -0-
  664.           0      -0-      -0-          1
  665.  
  666. You can modify the number in the DAYS column to fit the conditions you want.
  667. For example, if you wanted a 60, 90, 120 day aged accounts receivable report,
  668. you would modify the contents of the DAYTAB table to match the following:
  669.  
  670. DAYS        C1       C2       C3
  671. ----------- -------- -------- ----------
  672.          91        1      -0-        -0-
  673.          61      -0-        1        -0-
  674.           0      -0-      -0-          1
  675.  
  676. The positioning of the ones and nulls in the DAYTAB table is critical.
  677.  
  678. Report Variables
  679.  
  680. Define the following report variables in the define mode of the report writer.
  681. Be certain that the order of the variables is exactly as shown here.
  682.  
  683. Expression:                                  [F3] to list, [ESC]
  684.  
  685. 1:DATE     : DT1        = .#DATE
  686. 2:INTEGER  : DT2        = DT1    - TDATE
  687. 3:INTEGER  : F1         = C3     IN DAYTAB   WHERE DAYS LE DT2
  688. 4:INTEGER  : F2         = C2     IN DAYTAB   WHERE DAYS LE DT2
  689. 5:INTEGER  : F3         = C1     IN DAYTAB   WHERE DAYS LE DT2
  690. 6:DOLLAR   : 30DAY      = AMT    / F1
  691. 7:DOLLAR   : 60DAY      = AMT    / F2
  692. 8:DOLLAR   : 90DAY      = AMT    / F3
  693. 9:DOLLAR   : 30TOT      = 30DAY  + 30TOT
  694. 10:DOLLAR  : 60TOT      = 60DAY  + 60TOT
  695. 11:DOLLAR  : 90TOT      = 90DAY  + 90TOT
  696.  
  697. The first two report variables are used to calculate the number of days an
  698. account is overdue by comparing the date column to the current system date.
  699.  
  700. F1, F2, and F3 are the lookup factors to be used as denominators.  Only one of
  701. these three variables will be 1, the other two will be null, since that is
  702. what is stored in the DAYTAB table.
  703.  
  704. In the sixth, seventh, and eighth report variable expressions, AMT is divided
  705. by each of the factors (F1, F2, and F3) to calculate each of the variables
  706. 30DAY, 60DAY, 90DAY.  The variables 30DAY, 60DAY, and 90DAY are located on the
  707. report.  Because two of the factors are NULL, and division by NULL returns a
  708. NULL, two of these located variables will be NULL.  Therefore, before printing
  709. the report, set NULL to a blank.  For example:
  710.  
  711. SET NULL " "
  712. PRINT reptname
  713. SET NULL -0-
  714.  
  715. With null set to display as a blank, only one of the located variables will
  716. show up on the report because only one of the variables will have a non-null
  717. value.
  718.  
  719. The last 3 report variable expressions calculate the report totals for each of
  720. the three (30 day, 60 day, and 90 day) report column.
  721.  
  722. Report LAYOUT
  723.  
  724. This final chart shows the layout section of the report:
  725.  
  726. HP                                  <1,1> [F3] to list, [ESC] to exit
  727. HP ACT#     0-30 DAYS   31-60 DAYS   61-90 DAYS      # DAYS
  728. HP ----    ----------   ----------   ----------   ---------
  729. HP
  730. D S   E    S        E   S        E   S        E   S       E
  731. FR
  732. FR---------------------------------------------------------------------
  733. FR TOTALS:       30 DAY           60 DAY             90 DAY
  734. FR           ----------       ----------        -----------
  735. FR           S        E       S        E        S         E
  736. FR
  737.  
  738.  
  739.