home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / easybas / PACK1.PRG / EBOUT / EB3.REP < prev    next >
Encoding:
Text File  |  1996-12-01  |  199.9 KB  |  8,922 lines

  1.  
  2.  
  3.       ════════════════════════════════════════════════════════════════
  4.                   EASY BASE PROGRAMMERS REFERENCE
  5.                             Contents
  6.       ────────────────────────────────────────────────────────────────
  7.  
  8.                   Procedure Commands            Page
  9.                   ──────────────────
  10.  
  11.                   Clear Records From             11
  12.                   Copy All From                  14
  13.                   Create Temp As                 15
  14.                   Declare                        27
  15.                   Delay                          30
  16.                   Delete Record                  32
  17.                   Derive Off                     33
  18.                   Display Status                 36
  19.                   Do..Loop                       37
  20.                   Escape On/Off                  39
  21.                   Exit Batch Menu                40
  22.                   Exit Procedure                 41
  23.                   For..Next                      48
  24.                   If Then Else                   62
  25.                   Index Off                      64
  26.                   List Variables                 74
  27.                   Lock / Unlock                  75
  28.                   Manual Feed                    80
  29.                   Multiple Lines                 87
  30.                   Next Batch                     88
  31.                   Odd/Even Page Print            89
  32.                   Pack                           98
  33.                   Pause On/Off                  101
  34.                   Preselect                     103
  35.                   Print                         104
  36.                   Printer Control               105
  37.                   Recall Input Screen           111
  38.                   Remark                        113
  39.                   Reset Sequence                114
  40.                   Run                           122
  41.                   Show Picklist                 129
  42.                   Skip Group                    131
  43.                   Skip Record                   132
  44.                   Subindex                      138
  45.                   Update Record                 148
  46. ................................................................................
  47.  
  48.  
  49.                   Functions                     Page
  50.                   ─────────
  51.  
  52.                   Abs                             1
  53.                   Chr$                           10
  54.                   Datetext                       23
  55.                   Dayofmonth                     24
  56.                   Dayofweek                      25
  57.                   Dayofyear                      26
  58.                   Default                        28
  59.                   Hours                          60
  60.                   If                             61
  61.                   Intext                         69
  62.                   Jointext                       70
  63.                   Lefttext                       71
  64.                   Lengthtext                     72
  65.                   Lookup                         76
  66.                   Lower                          77
  67.                   Makedate                       78
  68.                   Maketime                       79
  69.                   Maths                          81
  70.                   Midtext                        83
  71.                   Minutes                        84
  72.                   Mod                            85
  73.                   Month                          86
  74.                   Proper                        107
  75.                   Random                        108
  76.                   Retail                        116
  77.                   Reverse                       118
  78.                   Righttext                     119
  79.                   Round                         120
  80.                   Seconds                       124
  81.                   Spacepad                      133
  82.                   Spellday                      134
  83.                   Spellmonth                    135
  84.                   Stringof                      137
  85.                   Timeampm                      145
  86.                   Upper                         149
  87.                   V.A.T. Functions              150
  88.                   Year                          152
  89.                   Zeropad                       153
  90.  
  91.  
  92.                   Operators                     Page
  93.                   ─────────
  94.  
  95.                   Arithmetic                     93
  96.                   Logical                        95
  97.                   Relational                     94
  98. ................................................................................
  99.  
  100.  
  101.                   Utilities                     Page
  102.                   ─────────
  103.  
  104.                   Alter Vat Rates                 2
  105.                   Backup Application              4
  106.                   Change Password                 8
  107.                   Data Import                    20
  108.                   Delete Choice Lists            31
  109.                   Install Form                   65
  110.                   Install Printer                66
  111.                   Install Procedure              67
  112.                   List File Names                73
  113.                   Options                        96
  114.                   Pack Data Forms                99
  115.                   Rebuild Directories           110
  116.                   Restore                       115
  117.                   Screen Colours                123
  118.                   Set Paper Length              127
  119.  
  120.  
  121.                   Field Types                   Page
  122.                   ───────────
  123.  
  124.                   Choice                          9
  125.                   Date                           22
  126.                   Fixed Point                    46
  127.                   Floating Point                 47
  128.                   Formatted Text                 55
  129.                   Integer                        68
  130.                   Text                          142
  131.                   Text Block                    143
  132.                   Time                          144
  133.  
  134.  
  135.                   Field Derivation Prefixes     Page
  136.                   ─────────────────────────
  137.  
  138.                   Autodial                        3
  139.                   Current                        16
  140.                   Disable                        34
  141.                   Goto (Field) Next              58
  142.                   Help                           59
  143.                   Retest                        117
  144.                   Start Here                    136
  145.  
  146.  
  147.                   User Menu Functions           Page
  148.                   ───────────────────
  149.  
  150.                   Menu Calls                     82
  151. ................................................................................
  152.  
  153.  
  154.                   System Values                 Page
  155.                   ─────────────
  156.  
  157.                   Blank.                          6
  158.                   Bottom Margin                   7
  159.                   Current Record                 17
  160.                   Cur_fld                        19
  161.                   File_date File_time            42
  162.                   File_len                       43
  163.                   File_pos                       44
  164.                   Fun_key                        56
  165.                   Global Number                  57
  166.                   Output                         97
  167.                   Page Number                   100
  168.                   Pi                            102
  169.                   Prog_dir                      106
  170.                   Record Number                 112
  171.                   Sequence                      126
  172.                   System Date                   140
  173.                   System Time                   141
  174.                   Total Copies                  146
  175.                   Total Records                 147
  176.  
  177.  
  178.                   File Commands
  179.                   ─────────────
  180.  
  181.                   Close                          13
  182.                   Erase                          38
  183.                   Find                           45
  184.                   Open                           92
  185.                   Read                          109
  186.                   Seek                          125
  187.                   Shell                         128
  188.                   Write                         151
  189.  
  190.  
  191.                   Field Controls                Page
  192.                   ──────────────
  193.  
  194.                   Beep                            5
  195.                   Clearfields                    12
  196.                   Cursor                         18
  197.                   Delay                          29
  198.                   Disable                        35
  199.                   Run                           121
  200. ................................................................................
  201.       ABS                        FUNCTION                         ABS
  202.  
  203.       This function returns the absolute (positive) value of a
  204.       number.
  205.  
  206.       Ex. abs(length - breadth)
  207.          This returns 6 if length = 12 and breadth = 6
  208.          or if length = 6 and breadth = 12
  209.  
  210.  
  211.       Acceptable parameters
  212.  
  213.       Numeric value
  214.       Numeric expression
  215.       Numeric field/variable
  216.       Any function which returns a numeric value
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.                                 - 1 -
  257. ................................................................................
  258.       ALTER VAT RATES            UTILITY              ALTER VAT RATES
  259.  
  260.       The five VAT rates used by the VAT functions can be altered
  261.       either from the utilities menu or from a user menu function.
  262.       Just select "Alter VAT rates" - edit the percentages and press
  263.       F2 to save the new values.
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.                                 - 2 -
  314. ................................................................................
  315.       AUTODIAL               DERIVATION PREFIX               AUTODIAL
  316.  
  317.       Easy Base will dial (via a Hayes compatible modem) direct from
  318.       any form or procedure input screen.
  319.  
  320.       To use the Auto dialling facility, all you have to do is place
  321.       the "autodial" keyword in the derivation of the field which
  322.       contains the telephone number. If the field already has a
  323.       derivation then add "autodial" as a prefix.
  324.  
  325.       Ex. Autodial Lookup(customers,phone)
  326.  
  327.       To initiate the call type Ctrl + D.
  328.  
  329.       By default Easy Base uses tone dialling via COM1. If your modem
  330.       is connected to COM2 you can set this up from the Options item
  331.       on the Utilities menu.
  332.  
  333.       If your exchange does not recognize tone dialling then you can
  334.       pulse dial by pressing Ctrl + P.
  335.  
  336.       If you operate from a private exchange and have to wait for an
  337.       outside line after dialling 9 then place a "W" between the 9
  338.       and the rest of the number.
  339.  
  340.  
  341.       Note:-
  342.  
  343.       1.   You can have more than one prefix on any one field
  344.            derivation provided there is a space between each.
  345.  
  346.       2.   The Autodial prefix cannot be tested in derivation test
  347.            mode.
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.                                 - 3 -
  371. ................................................................................
  372.       BACKUP APPLICATION         UTILITY           BACKUP APPLICATION
  373.  
  374.       Easy Base includes an inbuilt Backup system for your
  375.       applications and data.
  376.  
  377.       If you select "Backup Application" from the utilities menu then
  378.       Easy Base will backup your entire application - Choicelist
  379.       fields - Forms - Data and procedures. The backup system will
  380.       split large files across multiple disks automatically.
  381.  
  382.       When an application is finished and you have backup copies then
  383.       backing up choice lists and procedures is wasteful of time and
  384.       floppies. You can backup only the users data by calling "Backup
  385.       Data" from a user menu.
  386.  
  387.       Backup Principles.
  388.  
  389.       The reason for a backup is that in the event of a computer or
  390.       hard disk failure you will have your application or data to
  391.       restore on the new machine.
  392.  
  393.  
  394.       If you have no backup and your machine fails then you have lost
  395.       all your data. If you have only one backup and your machine
  396.       fails while doing a backup then you have lost all your data.
  397.  
  398.       The principle of safe backing up is to keep two sets of backup
  399.       disks in separate boxes marked "Latest" and "Previous".
  400.       Whenever you do a backup you use the disks from the "Previous"
  401.       box - move the disks from the "Latest" to the "Previous" and
  402.       put your new backups in the latest box when completed.
  403.  
  404.       This not only overcomes the problem of a failure during backup
  405.       but also provides a secondary set of disks if any of the
  406.       "Latest" disks turn out to be faulty when you come to restore.
  407.  
  408.       If you ever have to use a backup disk and find that it has
  409.       developed a bad sector then you can attempt a recovery with a
  410.       utility such as "Norton" Disk Test. Easy Base leaves
  411.       approximately 5K of unused disk space on all backup disks so
  412.       that such a utility has somewhere to move bad sectors to.
  413.  
  414.       To save disk space, Easy Base does not backup index files. If
  415.       you ever have to use a backup disk then the index files are
  416.       rebuilt after restoring the data.
  417.  
  418.  
  419.       See Also:-  Restore
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.                                 - 4 -
  428. ................................................................................
  429.       BEEP                     FIELD CONTROL                     BEEP
  430.  
  431.       The "beep" control is used in field derivations to alert the
  432.       user to input errors. In addition to sounding the beeper the
  433.       "beep" control has two optional additional parts - A message to
  434.       be sent to the message line and cursor redirection. This is
  435.       normally to the field in which the error has been made but can
  436.       be to any field.  Field controls are appended to field
  437.       derivations and are enclosed in square brackets.
  438.  
  439.       Ex.  If(partno < 0,blank[beepPart Numbers must not be
  440.       negativeCursor partno],partno)
  441.  
  442.       In this example, if the user enters a negative number in the
  443.       partno field the computer will beep,the number will be cleared
  444.       from the field, the message "Part Numbers must not be negative"
  445.       will be displayed on the message line and the cursor will
  446.       return to the "partno" field.
  447.  
  448.       Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  449.       has been paid or cheque number entered in errorCursor
  450.       paid],paid)
  451.  
  452.       In Easy Base, division by zero is not trapped as an error.
  453.       There is a very good reason for this.  When you start a new
  454.       record and all the fields are blank then any field which
  455.       provides a value for a division in another field would cause a
  456.       division by zero error before its value had been entered.
  457.  
  458.       Whenever Easy Base encounters a division by Zero it divides by
  459.       one instead.  This is perfectly acceptable in most business
  460.       applications.  However, if you need to be warned of a division
  461.       by zero in formulae then you can provide your own error trap
  462.       using the "Beep" control.
  463.  
  464.       Ex.
  465.  
  466.          If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  467.                       T4)
  468.  
  469.  
  470.       NETWORK VERSIONS
  471.  
  472.       From the release of Network V1 there is also a Beep command in
  473.       the procedure language.
  474.  
  475.       See Example under "Recall Input Screen"
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.                                 - 5 -
  485. ................................................................................
  486.       BLANK.                   SYSTEM VALUE                    BLANK.
  487.  
  488.       In Easy Base the value of any field which does not contain
  489.       characters is represented by the word "Blank" irrelevant of
  490.       data type.
  491.  
  492.       A numeric field returns the value "Blank" only when the field
  493.       is empty. If it has a value of zero then it is NOT blank.  In
  494.       fact, the main advantage of recognizing "Blank" is that you can
  495.       distinguish between zero value and empty numeric fields.
  496.  
  497.       There is, however, one slight disadvantage.  If a text field
  498.       contains ONLY the word blank and you use its value in a
  499.       derivation then the word "Blank" from the field will disappear.
  500.  
  501.       The "Name" field at the top left hand side of this page is
  502.       derived by the formula Upper(Name).  You will notice that
  503.       "Blank" is followed by a full stop.  If it were not then the
  504.       upper function would return "                    ".
  505.  
  506.       You can also remove a fields contents by setting it equal to
  507.       blank.
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.                                 - 6 -
  542. ................................................................................
  543.       BOTTOM MARGIN            SYSTEM VALUE             BOTTOM MARGIN
  544.  
  545.       Throughout a procedure which has a printed output, Easy base
  546.       keeps track of the length of page remaining (in inches) in the
  547.       system value "Bottom Margin". The Bottom margin value is used
  548.       to control pagination in procedures which "Report" on data.
  549.  
  550.       The "Bottom Margin" value is based on the paper type entered
  551.       from the Utilities Menu. You must set the type of paper you are
  552.       using before using "Bottom Margin".
  553.  
  554.       Ex.
  555.       Line feed: Line feed: Line feed
  556.       For employees
  557.          print list items
  558.          if bottom margin < .5 then
  559.             page feed: line feed :line feed : line feed
  560.          else
  561.             line feed
  562.          end if
  563.       next
  564.  
  565.       In the above example the list items section is printed with a
  566.       blank line between each and with a half inch top and bottom
  567.       page margin.
  568.  
  569.       When you base decisions on the "Bottom margin" value you should
  570.       always do so with a "Greater Than" or "Less Than" operator. If
  571.       you used " If Bottom margin = .5 then Page feed" your page
  572.       would only be ejected if and when the "Bottom Margin" value was
  573.       exactly 0.5  As most printing is done at six lines to the inch
  574.       it is most unlikely that the "Bottom margin" value would ever
  575.       be half an inch.
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                 - 7 -
  599. ................................................................................
  600.       CHANGE PASSWORD            UTILITY              CHANGE PASSWORD
  601.  
  602.       You can change your developers access password with this item
  603.       on the utilities menu.
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.                                 - 8 -
  656. ................................................................................
  657.       CHOICE                    FIELD TYPE                     CHOICE
  658.  
  659.       If you define a field as the "Choice" type a window will open
  660.       into which you can type up to thirty four different choices.
  661.       When you have entered your choices you will be asked to give a
  662.       name to your choice list. Once a choice list has been saved it
  663.       can be used in any other choice field in any other form or
  664.       input screen.
  665.  
  666.       Once a choice list has been saved you can edit the contents but
  667.       not the field length. Editing a choice list in one form
  668.       automatically edits it for any other form.
  669.  
  670.       If you need to alter a list such that the field length will
  671.       change then you must create a new list. You can erase the old
  672.       one from the utilities menu.  If the list is used in more than
  673.       one form then you must redefine it in all the other forms in
  674.       which it is used
  675.  
  676.       When the cursor enters a choice field your choice list will be
  677.       displayed for the user to choose from. He cannot enter any
  678.       value other than one from the list.
  679.  
  680.       When the cursor enters a choice field that is blank, the list
  681.       will pop up for the user to choose from. If there are more than
  682.       nine choices on the list then only the first nine will display
  683.       automatically. For up to nine choices the user can pick one by
  684.       pressing the number of the choice or leave the field blank by
  685.       simply moving the cursor. If there are more than nine choices
  686.       then the entire list can be displayed by pressing the space
  687.       bar. When a list of more than nine is displayed the user must
  688.       select a choice or press the Escape key.
  689.  
  690.       When the cursor re enters a choice field in which a choice has
  691.       already been made the same events occur except that in the case
  692.       of a two choice list the two choices are toggled on the space
  693.       bar without actually being displayed.
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.                                 - 9 -
  713. ................................................................................
  714.       CHR$                       FUNCTION                        CHR$
  715.  
  716.       The Chr$ function returns the character whose ASCII number is
  717.       supplied as the parameter.
  718.  
  719.       Ex.   Chr$(171)
  720.             < Returns "½">
  721.  
  722.       Ex.   Jointext(Chr$(227),"r",Chr$(253))
  723.             < Returns "πr²"
  724.  
  725.       In Easy Base, text fields are automatically justified left.
  726.       This is desirable in record entry as it prevents the user from
  727.       entering leading spaces in indexed fields and consequently
  728.       trashing alphabetic printouts. However, you may wish to right
  729.       justify or centre justify text in printouts. For example, the
  730.       righthand "Chr$" at the top of this page is right justified in
  731.       its field. You can use the ASCII character 255 to achieve right
  732.       or centre justification.
  733.  
  734.       Ex.
  735.  
  736.       Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  737.       name)
  738.           < This centres name in the 30 character field "heading">
  739.  
  740.       Ex.
  741.  
  742.       Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  743.  
  744.          < This right justifies name in a 40 character field
  745.            "Heading">
  746.  
  747.  
  748.       CAUTION:
  749.  
  750.       You can produce any ASCII character ( 0 - 255 ) with the Chr$
  751.       function. ASCII characters 0 to 31 are used as printer controls
  752.       and although you can use them freely on screen you should never
  753.       include them in a procedure output which will be sent to the
  754.       printer.
  755.  
  756.       The ASCII character 127 is used internally by Easy Base to
  757.       replace quotation marks within quoted text. It should not be
  758.       used for any other purpose.
  759.  
  760.       Acceptable parameters:
  761.  
  762.       Numeric value, field, variable, expression or function
  763.       returning a number between 0 and 255
  764.  
  765.  
  766.  
  767.  
  768.  
  769.                                 - 10 -
  770. ................................................................................
  771.       CLEAR RECORDS FROM     PROCEDURE COMMAND     CLEAR RECORDS FROM
  772.  
  773.       The "Clear Records From" command clears all records from a form
  774.       by erasing its data and index files. If you need to erase all
  775.       records form a form always use the "Clear Records" command
  776.       rather than "Delete Record" command. It is much faster and does
  777.       not require the form to be re-packed afterward.
  778.  
  779.       Ex.
  780.  
  781.       If input.confirm = "yes" then clear records from invoices
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.                                 - 11 -
  827. ................................................................................
  828.       CLEARFIELDS              FIELD CONTROL              CLEARFIELDS
  829.  
  830.       The "Clearfields" control blanks out all other fields on a form
  831.       or procedure input screen whenever the field containing the
  832.       control is changed.
  833.  
  834.       The primary use for the "Clearfields" control is to force
  835.       default lookups to re-derive for procedures which edit data.
  836.  
  837.       For Example - If you wrote a procedure to alter customers
  838.       addresses and telephone numbers then you would have three
  839.       fields on the input screen.
  840.  
  841.       Accountno   derived   lookup(customers,accountno)
  842.  
  843.       address     derived   default(lookup(customers,address))
  844.  
  845.       Tel         derived   default(lookup(customers,tel))
  846.  
  847.       When you enter a customers account number, his old address and
  848.       telephone number will be looked up, but the "Default" function
  849.       will allow you to edit them. The procedure code would then
  850.       update the record with the new address and phone number.
  851.  
  852.       The problem is, that having entered an account number and
  853.       looked up the other fields, if you then realize you have
  854.       entered the wrong account number and change it, the other
  855.       fields will not re-derive because they now have a default
  856.       value.  To get them to lookup based on the new account number
  857.       you would have to take the cursor to each field and clear it
  858.       with the F6 key.
  859.  
  860.       you can automate this process by adding the "Clearfields"
  861.       control to the accountno derivation:-
  862.  
  863.       lookup(customers,accountno)[clearfields]
  864.  
  865.  
  866.       Note:  The "Clearfields" control will only work when appended
  867.       to a derivation which is already dependent on the value of the
  868.       field. If you want to clear fields based on a change to a field
  869.       which has no other derivation then you must derive the field
  870.       with its own name plus the "Clearfields" control.
  871.  
  872.       In a field "Number" the derivation - Number[clearfields] - will
  873.       clear all other fields when the "Number" field is edited but
  874.       the derivation [clearfields] will have no effect.
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.                                 - 12 -
  884. ................................................................................
  885.       Close                    File Command                     Close
  886.  
  887.       The "Close" command closes a non Easy Base file which has been
  888.       opened with the "Open" command.
  889.  
  890.       If a procedure only opens a single external file then the close
  891.       command can be ommitted, but if several files are opened within
  892.       a procedure then each must be closed before the next is opened.
  893.       You can only have one external file open at any one time.
  894.  
  895.       ....................
  896.       declare output fields
  897.          Files : Path
  898.       end
  899.       declare variables
  900.         Ln as text
  901.       end
  902.       Open  "C:\CONFIG.SYS"
  903.       do
  904.          Read line to Ln
  905.          if lefttext(Ln,6) = "files=" then exit do
  906.       Loop
  907.       Files = Ln
  908.       Close
  909.       Open "C:\AUTOEXEC.BAT"
  910.       Do
  911.          read line to Ln
  912.          if Lefttext(Ln,4) = "path" then exit do
  913.       Loop
  914.       Close
  915.       Path = Ln
  916.       Print List Items
  917.  
  918.  
  919.       See also: Open, Seek, Read, Write, Find, Erase
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.                                 - 13 -
  941. ................................................................................
  942.       COPY ALL FROM          PROCEDURE COMMAND          COPY ALL FROM
  943.  
  944.       When you are transferring values from the fields of one form to
  945.       the fields of another in preparation for a "New Record" or
  946.       "Update Record"  you can use "Copy All From" to save time.
  947.  
  948.       Ex.
  949.  
  950.       for invoiceitems new record
  951.          invoiceitems.item = input.item
  952.          invoiceitems.price = input.price
  953.          invoiceitems.quantity = input.quantity
  954.          invoiceitems.vatrate = input.vatrate
  955.       next
  956.  
  957.       can be replaced with:-
  958.  
  959.       for invoiceitems new record
  960.          copy all from input
  961.       next
  962.  
  963.       The data transfer in a "Copy All From" is based on the source
  964.       and destination fields having the same name.
  965.  
  966.       If the source and destination fields have different data types
  967.       Easy Base will attempt a conversion.
  968.  
  969.       The conversion will succeed between different numeric types and
  970.       from numeric to text. It will fail from text to numeric and
  971.       between any mismatch of date and time.
  972.  
  973.  
  974.  
  975.  
  976.       See also:-  Derive Off, Duplicate Prevention
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.                                 - 14 -
  998. ................................................................................
  999.       CREATE TEMP AS         PROCEDURE COMMAND         CREATE TEMP AS
  1000.  
  1001.       The "Create Temp As" command makes a temporary form during a
  1002.       procedure. There are two main uses for the temporary form.
  1003.  
  1004.       1.  To physically sort the records in a form.
  1005.  
  1006.       Ex.
  1007.  
  1008.       create temp as addresses
  1009.       index off:pause off:escape off:derive off
  1010.       for addresses with surname in order
  1011.          for temp new record
  1012.             copy all from addresses
  1013.          next
  1014.       next
  1015.       rename temp as addresses
  1016.  
  1017.       The other main use for the temporary file is to save time when
  1018.       the majority of records in a form are to be deleted.
  1019.  
  1020.       Ex.
  1021.       A purchases ledger form is to be cleared down at the year end
  1022.       but any unreconciled payment entries are to be retained and
  1023.       flagged as last years. If there were 15000 records in the form
  1024.       of which only 50 were unreconciled then the procedure
  1025.  
  1026.       for purchases
  1027.          if purchases.reconciled = "yes" then
  1028.             delete record
  1029.          else
  1030.             purchases.lastyear = "yes"
  1031.             update record
  1032.          end if
  1033.       next
  1034.  
  1035.       would not only take a very long time to run but would leave the
  1036.       form full of deleted records and it would have to be re-packed.
  1037.  
  1038.       The same result can be achieved very quickly and without the
  1039.       need to re-pack with the following procedure.
  1040.  
  1041.       create temp as purchases
  1042.       for purchases with reconciled = "no"
  1043.          for temp new record
  1044.             copy all from purchases
  1045.             temp.lastyear = "yes"
  1046.          next
  1047.       next
  1048.       rename temp as purchases
  1049.  
  1050.       Do not use the "Clear Records" command to wipe the old file
  1051.       before using "Rename Temp As".  If you suffered a power failure
  1052.       after clearing and before renaming you would lose your data.
  1053.  
  1054.                                 - 15 -
  1055. ................................................................................
  1056.       CURRENT                DERIVATION PREFIX                CURRENT
  1057.  
  1058.       In Easy Base, fields are not normally derived when a previously
  1059.       entered record is viewed on screen. You can force a field to be
  1060.       rederived when viewed by prefixing the derivation with
  1061.       "current".
  1062.  
  1063.       Ex.  An invoice form has three fields Ivdate,Cdate and age.
  1064.  
  1065.       Ivdate is derived as   "system date"
  1066.       Cdate is derived as    "current system date"
  1067.       age is derived as      jointext(Cdate-Ivdate," Days old")
  1068.  
  1069.       Each time a record is viewed the Cdate field is rederived with
  1070.       the current system date and the age field shows the number of
  1071.       days since the record was filed.
  1072.  
  1073.       Ex.
  1074.  
  1075.       A form is used to price a certain job. It consists of fields
  1076.       for materials and their prices which are looked up from a
  1077.       "stock" form. If the primary lookup fields are prefixed with
  1078.       "current"   -  "current lookup(stock,item)"
  1079.  
  1080.       then each time a record is viewed it will reprice the job using
  1081.       the latest prices from the "stock" file.
  1082.  
  1083.       Please note that in the case of lookups, prefixing a secondary
  1084.       lookup has no effect. In the above example
  1085.  
  1086.         "current lookup(stock,price)"  would not work
  1087.  
  1088.       Provided that the primary lookup field is prefixed with
  1089.       "current" then any secondary lookups will also be rederived.
  1090.  
  1091.  
  1092.       The values of "Current" fields are also rederived whenever they
  1093.       are accessed in procedure code but they are NOT REDERIVED when
  1094.       they are accessed by a Lookup function.
  1095.  
  1096.  
  1097.       1. You can have more than one prefix on any one field
  1098.          derivation provided there is a space between each.
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.                                 - 16 -
  1112. ................................................................................
  1113.       Current Record           SYSTEM VALUE            Current Record
  1114.  
  1115.       Whenever a procedure is processing a "For" loop the number of
  1116.       the record being processed is available in the system value
  1117.       "Current Record".
  1118.  
  1119.       NETWORK VERSIONS
  1120.  
  1121.       From the release of Network V1 the system value Current Record
  1122.       has been replaced by a pseudo field Form.Record Number
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.                                 - 17 -
  1169. ................................................................................
  1170.       Cursor                   FIELD CONTROL                   Cursor
  1171.  
  1172.       The field control "Cursor" sends the cursor to the named field.
  1173.  
  1174.       if(condition,fieldname[cursor fieldname2],fieldname)
  1175.  
  1176.       The cursor control can also be embedded in the beep control.
  1177.  
  1178.       See also "Beep"
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.                                 - 18 -
  1226. ................................................................................
  1227.       Cur_Fld                  SYSTEM VALUE                   Cur_Fld
  1228.  
  1229.       The System value Cur_Fld holds the number of the field which
  1230.       the cursor is in.
  1231.  
  1232.       The Cur_Fld value can be used in form and input screen
  1233.       derivations to create pop up prompt fields or to change
  1234.       additional help fields.
  1235.  
  1236.       if(Cur_Fld > 2,"Enter the price",blank)
  1237.  
  1238.       If(Cur_Fld < 7,"Help for first six fields",Help for later
  1239.       fields")
  1240.  
  1241.       The Cur_Fld value can also be used to delay lookups when a
  1242.       screen first loads.
  1243.  
  1244.       if(Cur_Fld < 5,blank,lookup(customers,name))
  1245.  
  1246.       In the case of input screens the value is also carried forward
  1247.       to the procedure code so you can tell which field the cursor
  1248.       was in when the procedure was run.
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.                                 - 19 -
  1283. ................................................................................
  1284.       Data Import                UTILITY                  Data Import
  1285.  
  1286.       There are four Data Import routines in Easy Base. The first
  1287.       imports data from files which conform to the Xbase standard
  1288.       first introduced by Dbase. The second imports data from "Comma
  1289.       Delimited" files. This is the standard used by most sequencial
  1290.       access and non relational data systems. The third routine
  1291.       imports data from fixed length record text files. This is the
  1292.       format which is used by all systems to output data. You can
  1293.       therefore import data from virtually any other system by first
  1294.       reporting on it to a disk file and then importing it with the
  1295.       fixed length ASCII import routine. The fourth routine imports
  1296.       one ASCII line per field.
  1297.  
  1298.       XBASE
  1299.  
  1300.       If the data you wish to import is in Xbase format, Easy Base
  1301.       will report the structure of the file. You can print this out
  1302.       by pressing F10. You now design a form to hold the imported
  1303.       data. The names that you give to the Easy Base fields do not
  1304.       have to be the same as the Xbase field names but they must be
  1305.       in the same order. If the Xbase fields are text then the Easy
  1306.       Base fields must be the same length. If the Xbase fields are
  1307.       numeric then the Easy Base fields must be numeric. It does not
  1308.       matter if they are different lengths and any of the three
  1309.       types, integer, fixed point or floating point can be used.
  1310.       If an Xbase field is a date field then it must be imported to
  1311.       an eight character text field in Easy Base. You can reformat it
  1312.       to an Easy Base date field after importation (See the Method -
  1313.       Data Type Conversion).  Easy Base does not support "Memo" data.
  1314.       If the Xbase file has a memo field you can still import from it
  1315.       but the memo field itself will be skipped by the import
  1316.       routine.
  1317.  
  1318.       COMMA DELIMITED
  1319.  
  1320.       To import data from comma delimited files all you have to do is
  1321.       design a form with the same number of fields as there are in
  1322.       the file to be imported. Numeric fields can be any of the three
  1323.       types and text fields should be long enough to hold the longest
  1324.       data expected in the incoming field. If any of the fields to be
  1325.       imported holds a date then it must be imported to a text field.
  1326.       You can convert it to a date later.
  1327.  
  1328.       FIXED LENGTH ASCII
  1329.  
  1330.       To import data from fixed length ASCII files you must design a
  1331.       form in which all fields are text and are exactly the same
  1332.       length and in the same order as the fields in the file to be
  1333.       imported. If the file to be imported has a header you can allow
  1334.       for this by entering the header length in bytes.
  1335.  
  1336.       If you are using the fixed length import routine to import data
  1337.       which you have output as a report from another system then
  1338.  
  1339.                                 - 20 -
  1340. ................................................................................
  1341.       Data Import                UTILITY                  Data Import
  1342.  
  1343.       please note the following points.
  1344.  
  1345.       The output report from the original system should have no
  1346.       headers, footers or left margin and there should be no spaces
  1347.       between fields.
  1348.  
  1349.       When the original system outputs the data it will add a
  1350.       carriage return and line feed sequence to the end of each
  1351.       record. When you design the form to import this data to, you
  1352.       must have a final two character text field to trap this
  1353.       sequence and maintain the same record length.  This field can
  1354.       be deleted after importation.
  1355.  
  1356.       All fields are imported as text. If any of them contain numeric
  1357.       values which you wish to convert to numeric fields you must do
  1358.       this after importation. (See Method Data Type Conversion)
  1359.  
  1360.       ASCII LINE
  1361.  
  1362.       The ASCII line import routine imports one line per field from
  1363.       an ASCII text file. If you have one field on the form to which
  1364.       you import then you will have one line per record. If you have
  1365.       two fields on the form to which you import then you will have
  1366.       two lines per record Etc.
  1367.  
  1368.       The import routines are for loading entire data files into Easy
  1369.       Base. For Flexible import and export to any part of any file
  1370.       see the External File Commands documentation.
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395.  
  1396.                                 - 21 -
  1397. ................................................................................
  1398.       DATE                      FIELD TYPE                       DATE
  1399.  
  1400.       Date fields hold dates in the eight character format 11/11/94
  1401.  
  1402.       The assumed century runs from the first of January 1981 to the
  1403.       31st of december 2080.
  1404.  
  1405.       You can select whether you wish your dates to be displayed as
  1406.       day/month/year (European) or month/day/year (North American)
  1407.       from the "options" item on the utilities menu.
  1408.  
  1409.       You can perform addition and subtraction operations on date
  1410.       values in days.
  1411.  
  1412.       Ex.  System date + 30
  1413.  
  1414.       Arithmetic operations are only correct for the assumed century.
  1415.  
  1416.       Date fields are automatically checked for validity by the
  1417.       system.
  1418.  
  1419.       Easy base does not provide a ready made ten character date
  1420.       field but you can define one with the "Formatted Text" field
  1421.       type.
  1422.  
  1423.  
  1424.       See Also:-   Makedate
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.                                 - 22 -
  1454. ................................................................................
  1455.       DATETEXT                   FUNCTION                    DATETEXT
  1456.  
  1457.       This function returns the date parameter in the form:-
  1458.  
  1459.       14th October 1994  or
  1460.       October 14th 1994  depending on the date format selected in
  1461.                          the utilities menu.
  1462.  
  1463.  
  1464.       Ex.    datetext(system date)
  1465.  
  1466.       Ex.    datetext(invoicedate + 30)
  1467.  
  1468.       Acceptable parameters:
  1469.  
  1470.       System date
  1471.       Date field
  1472.       Makedate function
  1473.       Date expression
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.                                 - 23 -
  1511. ................................................................................
  1512.       DAYOFMONTH                 FUNCTION                  DAYOFMONTH
  1513.  
  1514.       This function returns the day no.(1-31) of the date parameter.
  1515.  
  1516.       Ex. dayofmonth(system date)
  1517.  
  1518.       Ex  dayofmonth(registered)
  1519.  
  1520.       Ex.
  1521.  
  1522.       if dayofmonth(system date) = 28 then
  1523.          for statements with settled = "No"
  1524.             statements.overdue = "Yes"
  1525.             update record
  1526.          next
  1527.       end if
  1528.  
  1529.       Acceptable parameters:
  1530.  
  1531.       System date
  1532.       Date field
  1533.       Makedate function
  1534.       Date expression
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.                                 - 24 -
  1568. ................................................................................
  1569.       DAYOFWEEK                  FUNCTION                   DAYOFWEEK
  1570.  
  1571.       This function returns the day no.(1-7) of the date parameter.
  1572.  
  1573.       Ex.  dayofweek(system date)
  1574.  
  1575.       Ex.  day = spellday(dayofweek(diary.date))
  1576.  
  1577.       Ex.  The following procedure, if called from a batch execute
  1578.       menu will only run on a Monday.
  1579.  
  1580.       declare output fields
  1581.          takings.date
  1582.          takings.dailytotal
  1583.       end
  1584.       if dayofweek(system date) = 1 then
  1585.          for takings with date in reverse order
  1586.             print list items
  1587.             if system date - takings.date > 7 then exit for
  1588.          next
  1589.       end if
  1590.  
  1591.       Acceptable parameters:
  1592.  
  1593.       System date
  1594.       Date field
  1595.       Makedate function
  1596.       Date expression
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.                                 - 25 -
  1625. ................................................................................
  1626.       DAYOFYEAR                  FUNCTION                   DAYOFYEAR
  1627.  
  1628.       This function returns the day no.(1-365) of the date parameter.
  1629.  
  1630.       Ex.   dayofyear(system date)
  1631.  
  1632.       Ex.   days = dayofyear(events.date)
  1633.  
  1634.       Acceptable parameters:
  1635.  
  1636.       System date
  1637.       Date field
  1638.       Makedate function
  1639.       Date expression
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.                                 - 26 -
  1682. ................................................................................
  1683.       DECLARE                PROCEDURE COMMAND                DECLARE
  1684.  
  1685.       If you write a procedure which outputs information to the
  1686.       screen, printer or a disk file you must start it by declaring
  1687.       the output fields.
  1688.  
  1689.       Ex.
  1690.       Declare output fields
  1691.          Input.name
  1692.          Customers.name:customers.address:customers.acno
  1693.          countofinvoices
  1694.       end
  1695.  
  1696.       If fields you intend to print exist in a form then declare them
  1697.       as Formname.Fieldname.  Fields from the procedures Input Screen
  1698.       are declared as Input.fieldname. Easy Base will then use the
  1699.       field definitions from the form as defaults when you create the
  1700.       Output Format for the procedure.
  1701.  
  1702.       If a field which you intend to print is to be derived during
  1703.       the procedure and does not exist in a form as "countofinvoices"
  1704.       you can give it any name you wish up to forty characters but
  1705.       the name must not contain a ".". Once you have declared fields
  1706.       you can create the Output Format.
  1707.  
  1708.       If you declare an "Ad Hoc" field such as "countovinvoices" then
  1709.       you must include it in the format in order to define its type
  1710.       and length.
  1711.  
  1712.       If you require variables to store values during a procedure but
  1713.       you will not be out-putting their values then declare them as
  1714.       variables not fields.
  1715.  
  1716.       Ex.
  1717.  
  1718.       declare variables
  1719.          count as number
  1720.          lasttype as text
  1721.       end
  1722.  
  1723.       Unprinted variables can only have one of the two types "Number"
  1724.       or "Text".
  1725.  
  1726.       Field declarations must precede Variable declarations and both
  1727.       must precede executable code.
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.                                 - 27 -
  1739. ................................................................................
  1740.       DEFAULT                    FUNCTION                     DEFAULT
  1741.  
  1742.       This function returns the parameter if not overridden by user
  1743.       entry.
  1744.  
  1745.  
  1746.       Ex.    Default(5)
  1747.  
  1748.       Ex.    Default(system date)
  1749.  
  1750.       Ex.    Default(lookup(stock,price))
  1751.  
  1752.       The Default function is only used in form and input screen
  1753.       field derivations - It has no meaning in procedure code.
  1754.  
  1755.       Acceptable parameters
  1756.  
  1757.       Any value, expression, field, variable or nested function of
  1758.       the same type as the field in which it is used.
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.                                 - 28 -
  1796. ................................................................................
  1797.       DELAY                    FIELD CONTROL                    DELAY
  1798.  
  1799.       The "delay" control suspends processing for a given number of
  1800.       milliseconds.
  1801.  
  1802.       Ex.
  1803.  
  1804.       A procedure screen is used from a startup Batch execute menu as
  1805.       an opening screen to an application and has the following field
  1806.       derivations
  1807.  
  1808.       1.  "Welcome to this wonderful program" [delay 1000]
  1809.  
  1810.       2.  "Copyright Fred blogs"[delay 1000]
  1811.  
  1812.       3.  "Press F2 to start"
  1813.  
  1814.       If the field colours are "text" ,"alt1" or "alt2" then the
  1815.       three fields will "Popup" with a one second delay between each.
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                                 - 29 -
  1853. ................................................................................
  1854.       DELAY                  PROCEDURE COMMAND                  DELAY
  1855.  
  1856.       The "Delay" command suspends processing for a given number of
  1857.       milliseconds (1 - 5000).
  1858.  
  1859.       Ex.
  1860.  
  1861.       declare variables
  1862.          x as number : total as number
  1863.       end
  1864.       for customers
  1865.          customers.balance = 0
  1866.          for invoices with acno = customers.acno
  1867.             display status "Totalling invoices for" + Customers.name
  1868.             delay 200
  1869.             customers.balance = customers.balance + invoices.total
  1870.          next
  1871.          update record
  1872.       next
  1873.  
  1874.       In the above example, wherever a customer only has one or two
  1875.       invoices to total, the status display would change very
  1876.       quickly.  By including a 200 millisecond delay you can ensure
  1877.       that each customers name is on screen at least long enough to
  1878.       be read.
  1879.  
  1880.       Delay values outside of 1 - 5000 are ignored.
  1881.       The delay parameter cannot be supplied as a variable.
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.                                 - 30 -
  1910. ................................................................................
  1911.       DELETE CHOICE LISTS        UTILITY          DELETE CHOICE LISTS
  1912.  
  1913.       If you have Choice lists for choice fields that are no longer
  1914.       required you can delete them with this utility.
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.                                 - 31 -
  1967. ................................................................................
  1968.       DELETE RECORD          PROCEDURE COMMAND          DELETE RECORD
  1969.  
  1970.       The "Delete Record" command is used for the selective deletion
  1971.       of records in a form.
  1972.  
  1973.       Ex.
  1974.  
  1975.       for books with title = input.title
  1976.          delete record
  1977.       next
  1978.  
  1979.       This deletes the single book whose title is that entered on the
  1980.       input screen.
  1981.  
  1982.       for books with author = input.author
  1983.          delete record
  1984.       next
  1985.  
  1986.       This deletes the records of all books by the author entered on
  1987.       the input screen.
  1988.  
  1989.       When you use the "Delete Record" command it has the same effect
  1990.       as deleting a record in data entry. In other words the record
  1991.       is marked for deletion but will not actually be removed from
  1992.       the form until the next re-pack.
  1993.  
  1994.       If you use the "Delete Record" command to delete large numbers
  1995.       of records then you should pack the form afterward.
  1996.  
  1997.       If you wish to delete all records in a form use the "Clear
  1998.       records" command not the "Delete Record" command.
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.                                 - 32 -
  2024. ................................................................................
  2025.       DERIVE OFF             PROCEDURE COMMAND             DERIVE OFF
  2026.  
  2027.       Whenever an Easy Base procedure adds or updates a record then
  2028.       by default it checks the derivations of all fields during an
  2029.       add operation and any fields that are affected by an update
  2030.       operation. In other words, if you update the netprice field in
  2031.       a stock form and that form has derived fields for VAT and
  2032.       grossprice then those fields will also be updated.
  2033.  
  2034.       If the procedure adds or updates all fields then this process
  2035.       is superfluous and simply slows the procedure. You can disable
  2036.       form derivation checking with the "Derive Off" command.
  2037.  
  2038.       derive off
  2039.       for stock with item = input.item
  2040.          copy all from input
  2041.          update record
  2042.       next
  2043.  
  2044.       In the above example a stock form has several derived fields
  2045.       but the input screen also does the same derivations. There is
  2046.       therefore no need to re-check them when the record is updated.
  2047.  
  2048.       As a general rule, in procedures which add or update records
  2049.       from an input screen, you should derive all fields on the input
  2050.       screen rather than during the update process. The user will not
  2051.       notice the time taken to derive fields while he is filling them
  2052.       in but he will notice the time taken to derive them after he
  2053.       has pressed F2
  2054.  
  2055.       There is no corresponding "Derive On" command. Derivation
  2056.       checking is automatically turned back on at the end of the
  2057.       loop to which is prefixed by the "Derive Off" command. If you
  2058.       require derivation checking to be off for more than one loop in
  2059.       a procedure then you must issue the command before each loop.
  2060.  
  2061.  
  2062.       Note:-
  2063.  
  2064.       If the "Derive Off" command is not issued before a loop then
  2065.       form level derivations override procedure derivations. This is
  2066.       not normally a problem, but can be if you try to change the
  2067.       case of a field for printing.
  2068.  
  2069.       For customers
  2070.          customers.name = proper(customers.name)
  2071.          print list items
  2072.       next
  2073.  
  2074.       If the "Name" field on the "Customers" form is derived as
  2075.       Upper(name) then the procedure will print the customers names
  2076.       in upper case.  You can overcome the problem either by
  2077.       cancelling the field derivation or by transferring the
  2078.       customers name to a variable and converting that to proper.
  2079.  
  2080.                                 - 33 -
  2081. ................................................................................
  2082.       Disable                DERIVATION PREFIX                Disable
  2083.  
  2084.       When an Easy Base procedure has an input screen it can be run
  2085.       by pressing any of the function keys 2,4,5,7,8,9 or 10.
  2086.  
  2087.       Where a procedure only does one job, the fact that all keys
  2088.       will initiate it is not important. The default help line states
  2089.       F2 and you can replace this if you want the user to use
  2090.       another.
  2091.  
  2092.       If however you wish to disable function keys which your
  2093.       procedure does not use you can do so by adding the prefix
  2094.       "Disable" followed by the keys you wish to deactivate in
  2095.       quotation marks. You can also disable the Escape Key.
  2096.  
  2097.       Ex.
  2098.  
  2099.       Disable "5789"
  2100.  
  2101.       It does not matter which field you use the "Disable" prefix in
  2102.       and if the field already has a derivation formula it can
  2103.       follow.
  2104.  
  2105.       Disable "4578910Esc" lookup(units,price)
  2106.  
  2107.       In the above example the only active function key is F2 and the
  2108.       user cannot Escape to the menu. The procedure must be run.
  2109.  
  2110.       Disabling the Escape key is useful where a procedure is part of
  2111.       a chain, ie it is run by the run command from a main procedure
  2112.       or it is on a batch menu. You should be careful not to disable
  2113.       the Escape key on procedures that are stand alone with
  2114.       repeating input screens or on main procedures which run other
  2115.       procedures which in turn run the main procedure.
  2116.  
  2117.       Notes:
  2118.  
  2119.       1.  The Disable prefix has no meaning in data entry forms.
  2120.  
  2121.       2.  There must be a space between "Disable" and the key string.
  2122.           The key string must be in quotation marks.
  2123.  
  2124.       3.  You can combine prefixes in any field derivation provided
  2125.           there is a space between them
  2126.  
  2127.       Ex.
  2128.  
  2129.       Disable "4578910" Help "Press F2 when ready" Start Here
  2130.  
  2131.  
  2132.       See also: "Run" "Fun_Key" "Dissable Control"
  2133.  
  2134.  
  2135.  
  2136.  
  2137.                                 - 34 -
  2138. ................................................................................
  2139.       Disable                  FIELD CONTROL                  Disable
  2140.  
  2141.       The Disable control is used to change the disabled function
  2142.       keys from within field derivations in a procedure's input
  2143.       screen.
  2144.  
  2145.       Ex.
  2146.  
  2147.       if(actn = "new",actn[disable "4578910"],actn[disable "2"])
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.                                 - 35 -
  2195. ................................................................................
  2196.       DISPLAY STATUS         PROCEDURE COMMAND         DISPLAY STATUS
  2197.  
  2198.       If you write a procedure which has no output then Easy Base
  2199.       will display a "Running" flash at the top right hand side of
  2200.       the screen. For procedures which only take a few seconds to run
  2201.       this is sufficient to let the operator know that something is
  2202.       happening. For procedures that take some time to complete you
  2203.       should include a status display showing the progress of the
  2204.       procedure. A status display not only allays the nagging
  2205.       suspicion that the system has hung up but also allows the
  2206.       operator to estimate how long it will take.
  2207.  
  2208.       To create a status display just issue the command "Display
  2209.       Status" followed by a message composed of text in quotation
  2210.       marks and fields or variables concatenated by the + sign.
  2211.  
  2212.       Ex.
  2213.  
  2214.  
  2215.       declare variables
  2216.          x as number : y as number
  2217.       end
  2218.       for employees with taxcode = input.oldtaxcode
  2219.          y = employees.total copies :exit for
  2220.       next
  2221.       for employees with taxcode = input.oldtaxcode
  2222.          x = x + 1
  2223.          display status "Updating Record" + x + "of" + y
  2224.          employees.taxcode = input.newtaxcode
  2225.          update record
  2226.       next
  2227.  
  2228.       The status line is displayed centrally in a small window when
  2229.       the procedure runs. A Status line can have a maximum of 68
  2230.       characters. If you create a status line of more than 68
  2231.       characters then it will be cut short to that length.
  2232.  
  2233.       If you need to display counters in two nested loops then write
  2234.       the full display line in the outer loop and "display status"
  2235.       with no parameters in the inner loop.
  2236.  
  2237.       for customers
  2238.          x = x + 1
  2239.          - loop statements -
  2240.          display status "Checking Invoice" + y + "of customer" + x
  2241.          for invoices with customer = customers.name
  2242.             y = y + 1
  2243.             - Loop Statements -
  2244.             display status
  2245.          next
  2246.       next
  2247.  
  2248.  
  2249.  
  2250.  
  2251.                                 - 36 -
  2252. ................................................................................
  2253.       DO..LOOP               PROCEDURE COMMAND               DO..LOOP
  2254.  
  2255.       The "Do" loop structure is used in the Easy Base Procedure code
  2256.       to repeat a series of commands or statements. Whenever a
  2257.       procedure reaches a "Do" command it repeats all the statements
  2258.       between the "Do" and the "Loop" statements until the loop is
  2259.       broken by an "Exit Do" command.
  2260.  
  2261.       Ex.
  2262.  
  2263.       The following code fragment prints 10 copies of the top fifty
  2264.       best selling items in a "stock" form.
  2265.  
  2266.  
  2267.       .........................code............................
  2268.       declare output fields
  2269.          stock.item : stock.sales : today
  2270.       end
  2271.       Declare variables
  2272.          copies as number : items as number
  2273.       end
  2274.       today = system date
  2275.       do
  2276.          copies = copies + 1 :items = 0
  2277.          if copies = 11 then exit do
  2278.          bold on
  2279.          print report header
  2280.          bold off
  2281.          for stock with sales in reverse order
  2282.             items = items + 1
  2283.             if items = 51 then exit for
  2284.             print list items
  2285.          next
  2286.          bold on : print report footer : bold off
  2287.          page feed
  2288.       loop
  2289.       ............................format.....................
  2290.       .Report Header
  2291.          ═════════════════════════════════════════════════════
  2292.          Top 50 Best Selling Items               {today field}
  2293.          ═════════════════════════════════════════════════════
  2294.       .list items
  2295.             {stock.item field}        {stock.sales field}
  2296.       .Report Footer
  2297.          ═════════════════════════════════════════════════════
  2298.       .end
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.                                 - 37 -
  2309. ................................................................................
  2310.       Erase                    File Command                     Erase
  2311.  
  2312.       The "Erase" command erases files. It accepts wildcard
  2313.       parameters.
  2314.  
  2315.       ex.
  2316.  
  2317.       Erase "C:\letters\*.doc"
  2318.  
  2319.       Ex.
  2320.  
  2321.       index off
  2322.       For faxlog with date < system date - 30
  2323.          erase jointext("C:\Fax\",faxlog.filename)
  2324.          delete record
  2325.       next
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.                                 - 38 -
  2366. ................................................................................
  2367.       ESCAPE ON/OFF          PROCEDURE COMMAND          ESCAPE ON/OFF
  2368.  
  2369.       When a procedure is running in Easy Base, it cannot, by
  2370.       default, be interrupted. If your procedure simply lists data to
  2371.       the screen then the end user may not need to see the entire
  2372.       output. You can allow the user to terminate a procedure
  2373.       prematurely with the "Escape On" command.
  2374.  
  2375.       If a procedure performs several tasks, you can selectively
  2376.       enable and disable the Escape Key with the commands "Escape On"
  2377.       and "Escape" Off"
  2378.  
  2379.       Ex.
  2380.  
  2381.       For newpayscales
  2382.          print list items
  2383.       next
  2384.       escape off
  2385.       for newpayscales
  2386.          for employees with scale = newpayscales.scale
  2387.             employees.rate = newpayscales.rate
  2388.             update record
  2389.          next
  2390.       next
  2391.       escape on
  2392.       for employees
  2393.          print newpay
  2394.       next
  2395.  
  2396.       In the above example a procedure lists new pay scales, updates
  2397.       the "Employees" form with the new pay rate and then lists the
  2398.       employees with their new rates.
  2399.  
  2400.       While the procedure is running the operator can terminate it
  2401.       during either of the lists but he cannot terminate it during
  2402.       the process of updating the "Employees" form.
  2403.  
  2404.       See also: Pause On/Off
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.                                 - 39 -
  2423. ................................................................................
  2424.       EXIT BATCH MENU        PROCEDURE COMMAND        EXIT BATCH MENU
  2425.  
  2426.       The "Exit Batch Menu" command terminates a current Batch Menu
  2427.       and returns control to the menu which called it.
  2428.  
  2429.       Ex.
  2430.  
  2431.       An application starts with a batch menu which calls a second
  2432.       batch menu which performs regular daily tasks. It then calls
  2433.       the main user menu. If the application is exited after the
  2434.       daily tasks batch menu has been completed then you will not
  2435.       wish to re-run the daily tasks when the application is
  2436.       restarted on the same day. To prevent this create a form
  2437.       "tasksdone" with a single field "date" and enter a single
  2438.       record with yesterdays date.
  2439.  
  2440.       The first procedure on the daily tasks batch menu would then be
  2441.  
  2442.       for tasksdone
  2443.          if tasksdone.date = system date then
  2444.             exit batch menu
  2445.          else
  2446.             tasksdone.date = system date
  2447.             update record
  2448.          end if
  2449.       next
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.                                 - 40 -
  2480. ................................................................................
  2481.       EXIT PROCEDURE         PROCEDURE COMMAND         EXIT PROCEDURE
  2482.  
  2483.       The "Exit Procedure" command terminates a procedure.
  2484.  
  2485.       Ex.
  2486.  
  2487.       if input.codeword <> "fred" then exit procedure
  2488.       for staffconfidential with name = input.name
  2489.          print list items
  2490.       next
  2491.  
  2492.  
  2493.       If the procedure has a repeating input screen then this is
  2494.       cancelled by the "Exit Procedure" command.
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.                                 - 41 -
  2537. ................................................................................
  2538.       File_Date File_Time      System value       File_Date File_Time
  2539.  
  2540.       Whenever you open a non Easy Base file it's date and time stamp
  2541.       are available in the system values File_Date and File_Time.
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.                                 - 42 -
  2594. ................................................................................
  2595.       File_Len                 System Value                  File_Len
  2596.  
  2597.       Whenever you open an external file with the "Open" Command the
  2598.       length of the opened file is available in the system value
  2599.       File_Len.
  2600.  
  2601.       The main use of the File_Len value is to position the
  2602.       Read/Write pointer ready to append data to an existing file.
  2603.  
  2604.       ...................
  2605.       declare variables
  2606.          CR as text
  2607.       end
  2608.       CR = jointext(chr$(13),chr$(10))
  2609.       Open "C:\WP\Address.txt"
  2610.       seek File_Len + 1
  2611.       Write Input.name
  2612.       Write CR
  2613.       Write Input.address1
  2614.       Write CR
  2615.       Write Input.address2
  2616.       Write CR
  2617.       Write input.address3
  2618.       Write CR
  2619.       Close
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.                                 - 43 -
  2651. ................................................................................
  2652.       File_Pos                 System Value                  File_Pos
  2653.  
  2654.       Whenever you open an external file with the "Open" command,
  2655.       The position of the file read/write pointer is available in the
  2656.       system value File_Pos.
  2657.  
  2658.       The value is in bytes counting the first byte as 1.
  2659.  
  2660.       The File_Pos value is used to make relative movements of the
  2661.       Read/write pointer  with the "Seek" command
  2662.  
  2663.       .....................................
  2664.       Open "C:\myfiles\Report.txt"
  2665.       for reports new record
  2666.          Read 10 to reports.CustNo
  2667.          Seek File_pos + 3
  2668.          read 20 to reports.Custname
  2669.       next
  2670.       close
  2671.       ......................................
  2672.  
  2673.       You can move the Read/Write pointer in either direction.
  2674.  
  2675.       Seek File_Pos - 20
  2676.  
  2677.       If you move the pointer back beyond the start of the file Easy
  2678.       Base generates the error message "Seek Value < 1 !".
  2679.  
  2680.  
  2681.       See Also: Open, Close, Seek, Read, Write
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.                                 - 44 -
  2708. ................................................................................
  2709.       Find                     File Command                      Find
  2710.  
  2711.       The "Find" command is used to select non Easy Base files using
  2712.       a wildcard Spec. When you issue the command Find with a
  2713.       wildspec parameter, Easy Base finds the first file to match the
  2714.       spec and puts its name in the Found_File system value. If you
  2715.       then repeat the command without a spec, Easy Base finds the
  2716.       next matching filename and puts it in Found_File. When all
  2717.       files have been found the Found_File value reverts to "Blank".
  2718.  
  2719.       Example: A company recieves replacement part orders by FAX.
  2720.       After the Address lines the FAX is formatted in four lines
  2721.  
  2722.       "Order Start:" - Engineers ID - Part ID - Quantity.
  2723.  
  2724.       All incoming FAXes for parts are filed in C:\FAX\ORDERS.
  2725.  
  2726.       The following procedure imports the orders to the Orders form
  2727.       and then deletes the FAX files.
  2728.  
  2729.       Declare variables
  2730.          Ln as text
  2731.       end
  2732.       Find "C:\FAX\ORDERS\*.*"
  2733.       Do
  2734.          If Found_File = Blank then exit do
  2735.          For orders new record
  2736.             open jointext("C:\FAX\ORDERS\",Found_File)
  2737.             Do
  2738.                Read line to Ln
  2739.                If Ln = "Order start:" then exit do
  2740.             Loop
  2741.             Read line to orders.engineer
  2742.             Read line to order.part
  2743.             read line to orders.quantity
  2744.          next
  2745.          Close
  2746.          Find
  2747.       Loop
  2748.       Erase "C:\FAX\ORDERS\*.*"
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.                                 - 45 -
  2765. ................................................................................
  2766.       FIXED POINT               FIELD TYPE                FIXED POINT
  2767.  
  2768.       Fixed point fields can display up to 14 digits. They use the
  2769.       comma for thousands separation and the full stop for decimal
  2770.       separation.
  2771.  
  2772.       There are no rounding errors with fixed point fields.
  2773.  
  2774.       See - Operators arithmetic
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.                                 - 46 -
  2822. ................................................................................
  2823.       FLOATING POINT            FIELD TYPE             FLOATING POINT
  2824.  
  2825.       Floating point fields can display up to 14 digits. They do not
  2826.       have a thousands separator. They are left justified.
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.  
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.                                 - 47 -
  2879. ................................................................................
  2880.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2881.  
  2882.       The "For" command initiates loops which load records from forms
  2883.       for processing. All statements between the "For" and the "Next"
  2884.       commands are repeated for each record selected.
  2885.  
  2886.       Ex.
  2887.  
  2888.       For Videos
  2889.          If Videos.price = 2.00 then Videos.price = 2.50
  2890.          update record
  2891.       next
  2892.  
  2893.       In the above example each record in the "Videos" form is loaded
  2894.       into memory - the price field is checked and if it is 2.00 then
  2895.       it is altered to 2.50 - the record is then updated on disk.
  2896.  
  2897.       "For" loops can be nested to any depth.
  2898.  
  2899.       Ex.
  2900.  
  2901.       for videoprices
  2902.          for videos
  2903.             if videos.price = videoprices.price then
  2904.                print list items
  2905.             end if
  2906.          next
  2907.       next
  2908.  
  2909.       In the above example the outer loop loads each record from the
  2910.       "Videoprices" form.  While each of these is in memory it then
  2911.       loads each record from the "Videos" form, tests to see if the
  2912.       price field in "Videos" is the same as the price field in
  2913.       "Videoprices" and if so prints the list items section of the
  2914.       report format thus grouping all video titles by price.
  2915.  
  2916.       If a "For" loop is unqualified as above then every record is
  2917.       processed starting at one and advancing in sequence. "For"
  2918.       loops can be qualified in several ways in order to select
  2919.       records in other orders or groups. The following qualifications
  2920.       are available:-
  2921.  
  2922.       For (form) with (fieldname) in order
  2923.       For (form) with (fieldname) in reverse order
  2924.       For (form) with (fieldname) =  (value)
  2925.       For (form) with (fieldname) >  (value)
  2926.       For (form) with (fieldname) <  (value)
  2927.       For (form) with (fieldname) >= (value)
  2928.       For (form) with (fieldname) <= (value)
  2929.       For (form) new record
  2930.       For (form) Selected in Browse
  2931.  
  2932.       With the exception of the "New Record" qualification, all
  2933.       accept the suffix "Unique" and an "Alias" for the form name.
  2934.  
  2935.                                 - 48 -
  2936. ................................................................................
  2937.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2938.  
  2939.       If a "For" loop is qualified by "in order" or "in reverse
  2940.       order" then the records are selected in alphabetical or reverse
  2941.       alphabetical order if the selection field is text, and in
  2942.       numeric or reverse numeric order if the selection field is
  2943.       numeric.
  2944.  
  2945.       Ex.
  2946.  
  2947.       for books with title in order
  2948.          print list items
  2949.       next
  2950.  
  2951.       Ex.
  2952.  
  2953.       for salesmen with monthlysales in reverse order
  2954.          print list items
  2955.       next
  2956.  
  2957.       If a "For" loop is qualified by "in order unique" or "in
  2958.       reverse order unique" then records will be selected in order or
  2959.       in reverse order as above. However, where there are multiple
  2960.       occurrence of the same field value a "unique" loop will only
  2961.       select the first occurrence of each value if the loop is in
  2962.       order or the last occurrence if the loop is in reverse order.
  2963.  
  2964.       Ex.
  2965.  
  2966.       for books with category in order unique
  2967.          count = count + 1
  2968.          print list items
  2969.       next
  2970.       print categorycount
  2971.  
  2972.       This example prints and counts the different categories in the
  2973.       "books" form.
  2974.  
  2975.       Ex.
  2976.  
  2977.       for theatreseats with price in reverse order unique
  2978.          for seatprices new record
  2979.             seatprices.price = theatreseats.price
  2980.          next
  2981.       next
  2982.  
  2983.       The above example selects one example only of each seat price
  2984.       in an existing "theatreseats" form in descending price order
  2985.       and enters a new record in the new "seatprices" form.
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.                                 - 49 -
  2993. ................................................................................
  2994.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2995.  
  2996.       If a "For" loop is qualified by a "Fieldname = " condition then
  2997.       only the record or records where the field contents match the
  2998.       condition will be selected.
  2999.  
  3000.       Ex.
  3001.  
  3002.       for books with category = "fiction"
  3003.          print list items
  3004.       next
  3005.  
  3006.       This example prints all books which have the category "fiction"
  3007.  
  3008.       Ex.
  3009.  
  3010.       For customers with acno = input.acno
  3011.          creditlimit = input.creditlimit
  3012.          update record
  3013.       next
  3014.  
  3015.       In this example the procedure has an input screen where the
  3016.       operator enters a customers account number and new credit
  3017.       limit. On pressing F2 the procedure finds the single record in
  3018.       the "Customers" form which has the input account number and
  3019.       updates the "creditlimit" field.
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.                                 - 50 -
  3050. ................................................................................
  3051.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3052.  
  3053.       If a "For" loop is qualified by a "with (fieldname) > " or
  3054.       "with (fieldname) >= " condition then records are selected in
  3055.       order like the "with (fieldname) in order" qualification but
  3056.       starting with the first record where the field contents match
  3057.       the condition value rather than the first record.
  3058.  
  3059.       Similarly the qualifications "with (fieldname) < " and "with
  3060.       (fieldname) <= " select records in reverse order but starting
  3061.       with the last record to match the condition value.
  3062.  
  3063.       In case you are new to progamming it should be pointed out that
  3064.       the relational operators >, <, >= and <= can be applied to text
  3065.       as well as to numbers. When they are applied to text they
  3066.       relate to the text's alphabetical order.
  3067.  
  3068.       These four qualifications provide the means to select any
  3069.       subset of records which has a range of values in a particular
  3070.       field.
  3071.  
  3072.       Ex.
  3073.  
  3074.       for pupils with age > 6
  3075.          if pupils.age = 12 then exit for
  3076.          print list items
  3077.       next
  3078.  
  3079.       This example prints the names of all pupils between the ages of
  3080.       seven and eleven. The "For" qualification starts selection in
  3081.       numeric order of age starting at seven and the "Exit for"
  3082.       command terminates the loop when the first pupil aged twelve is
  3083.       loaded.
  3084.  
  3085.       Ex.
  3086.  
  3087.       A "Videos" form has a compound index field called "catorder"
  3088.       which is derived by joining the text of the "category" and
  3089.       "title" fields. The following procedure selects all the videos
  3090.       which have the category entered on the input screen and lists
  3091.       them with the title in alphabetic order.
  3092.  
  3093.       for videos with catorder >= input.category
  3094.          if videos.category > input.category then exit for
  3095.          print list items
  3096.       next
  3097.  
  3098.       Ex.
  3099.  
  3100.       for vehicles with seats > 4 unique
  3101.          count = count + 1
  3102.       next
  3103.  
  3104.       "count" returns the number of different seat capacities > 4
  3105.  
  3106.                                 - 51 -
  3107. ................................................................................
  3108.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3109.  
  3110.       If a "For" loop is qualified by "new record" then no records
  3111.       are selected from the form. Instead, a new blank record is
  3112.       created at the "For" command, all statements between the "For"
  3113.       and "Next" commands apply to this new record and it is entered
  3114.       to the form at the "Next" command.
  3115.  
  3116.       Ex.
  3117.  
  3118.       for books new record
  3119.          books.dateinstock = system date
  3120.          copy all from input
  3121.       next
  3122.  
  3123.       This example enters a new record to the "Books" form making the
  3124.       "dateinstock" field equal the system date and copying all other
  3125.       fields from the procedures input screen.
  3126.  
  3127.       Ex.
  3128.  
  3129.       declare variables
  3130.         hourcount as number
  3131.       end
  3132.       '..............clear last wages
  3133.       clear records from wagelist
  3134.       '..........count employees hours from timesheet...
  3135.       for employees
  3136.          hourcount = 0
  3137.          for timesheet with worksno = employees.worksno
  3138.             hourcount = hourcount + timesheet.hours
  3139.          next
  3140.          for wagelist new record
  3141.             wagelist.worksno = employees.worksno
  3142.             wagelist.name = employees.name
  3143.             wagelist.hours = hourcount
  3144.             wagelist.grosswage = employees.wagerate * hourcount
  3145.          next
  3146.       next
  3147.       '.................print the wages list
  3148.       for wagelist with worksno in order
  3149.          print list items
  3150.       next
  3151.  
  3152.       This procedure starts by erasing the present contents of the
  3153.       "wagelist" form. It then selects each record from the
  3154.       "employees" form, counts all entries in the "timesheet" form
  3155.       for the employee and enters a new record in the "wagelist"
  3156.       form. Finally it prints the new wage list.
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.                                 - 52 -
  3164. ................................................................................
  3165.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3166.  
  3167.       Occasionally you may need to nest a "For" loop of a form within
  3168.       another "For" loop of the same form. If you do this, then in
  3169.       order to differentiate between the fields in the outer and
  3170.       inner loops you must allocate an "alias" name to the form in
  3171.       one of the loops. When you allocate an alias to a form name
  3172.       then all the fields of the form can also be referenced by the
  3173.       alias name.
  3174.  
  3175.       Ex.
  3176.       .......................procedure code...........
  3177.       declare output fields
  3178.          males : females : pupils.age
  3179.       end
  3180.       for pupils with age in order unique
  3181.          males = 0 : females = 0
  3182.          for pupils alias agegroups with age = pupils.age
  3183.             if agegroups.sex = "male" then
  3184.                males = males + 1
  3185.             else
  3186.                females = females + 1
  3187.             end if
  3188.          next
  3189.          print list items
  3190.       next
  3191.       ....................output format......................
  3192.       .list items
  3193.       There are {males} males and {females} females aged {pupils.age}
  3194.       .end
  3195.  
  3196.  
  3197.       This example counts and prints the number of male and female
  3198.       pupils in each age group.
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.                                 - 53 -
  3221. ................................................................................
  3222.       FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3223.  
  3224.       If a For loop is qualified by "Selected in Browse" then Easy
  3225.       Base loads the record which was on screen in Data-Browse when
  3226.       the F2 key was pressed. Although Easy Base procedures allow
  3227.       total flexibility in processing records, creating an input
  3228.       screen with a lookup and associated relationship is complicated
  3229.       if you only wish to process a single record. To select a record
  3230.       using the form search capabilities and then run a procedure
  3231.       processing the selected record, create a batch menu with
  3232.       Data-Browse to the form followed by the procedure and call that
  3233.       batch menu from one of your normal user menus. Run the item
  3234.       from your user menu and select the record you wish to process.
  3235.       With the record on screen, press F2.   Example:-
  3236.  
  3237.       Main Menu Item:-
  3238.          Print Envelopes    User Menu         Address Envelope
  3239.  
  3240.       Address Envelope Menu (Batch execute)
  3241.                             Data Browse       Addresses
  3242.                             Run Procedure     Print Envelope
  3243.  
  3244.       Print envelope Procedure:-
  3245.  
  3246.       Declare Output Fields
  3247.          Addresses.Name : Addresses.line1 : addresses.line2
  3248.          Addresses.city : Addresses.postcode
  3249.       end
  3250.       for addresses selected in browse
  3251.          print list items
  3252.          next batch 1
  3253.       next
  3254.  
  3255.       The output fields are then arranged on the output format such
  3256.       that they print centrally on your envelope.
  3257.  
  3258.       NOTES:-
  3259.  
  3260.       1. Whenever the Esc key is pressed in data browse, Easy Base
  3261.          AUTOMATICALLY exits any batch menu it was on.
  3262.  
  3263.       2. By including the command "Next Batch 1" within the loop, The
  3264.          data browse screen will repeat after each envelope is
  3265.          printed.
  3266.  
  3267.       3. Once a record has been selected by pressing F2 in Data
  3268.          Browse, it remains available until the next record is
  3269.          selected. You can therefore run several procedures based on
  3270.          the last record selected in browse
  3271.  
  3272.       4. To test procedures which use "Selected in browse" before
  3273.          putting them on a user menu, view the form in data entry and
  3274.          press F2 ( Update record) with a record selected. This
  3275.          record will then be used by the procedure.
  3276.  
  3277.                                 - 54 -
  3278. ................................................................................
  3279.       FORMATTED TEXT            FIELD TYPE             FORMATTED TEXT
  3280.  
  3281.       If you define a field with the type "formatted text" a window
  3282.       opens up in which you enter the formatting characters. The
  3283.       characters which are to be entered by the user are shown as
  3284.       question marks. Any other characters which you enter become
  3285.       permanent fixtures in the field. The "formatted text" field can
  3286.       be up to twenty characters long and can be used for dates,
  3287.       national insurance numbers etc.
  3288.  
  3289.       Formatted text fields should not be derived.
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.                                 - 55 -
  3335. ................................................................................
  3336.       Fun_Key                  SYSTEM VALUE                   Fun_Key
  3337.  
  3338.       The Fun_Key system value holds the number of the function key
  3339.       which was pressed to run a procedure from its input screen. If
  3340.       the procedure was started automatically by a [Run] field
  3341.       control then Fun_Key returns the value 0.
  3342.  
  3343.       The main use of the Fun_Key value is to branch from one
  3344.       procedure to another using the Run command. Its value is also
  3345.       available immediately to the input screen field derivations.
  3346.       You can therefore make any field entry mandatory or not
  3347.       depending on which function key was pressed.
  3348.  
  3349.       Example.
  3350.  
  3351.       If you set the Mandatory entry attribute of field "Name" to
  3352.       "If" and enter the condition "Fun_Key = 2 or Fun_Key 4" then
  3353.       the procedure cannot be run with the F2 or F4 keys unless the
  3354.       Name field has been filed but it can be run with the name field
  3355.       blank if any of the other function keys were pressed.
  3356.  
  3357.       The value of disabled function keys is also available to input
  3358.       screen derivations. You can use disabled function keys to
  3359.       redirect the cursor:
  3360.  
  3361.       if(Fun_Key = 7,fieldname[cursor size],fieldname)
  3362.  
  3363.       By using disabled function keys to redirect the cursor to
  3364.       fields on a different page you can make a single procedure
  3365.       appear to have more than on input screen for different
  3366.       purposes.
  3367.  
  3368.  
  3369.  
  3370.       See also "Run" "Disable"
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.                                 - 56 -
  3392. ................................................................................
  3393.       GLOBAL NUMBER            SYSTEM VALUE             GLOBAL NUMBER
  3394.  
  3395.       The variables you create in Easy Base procedures are local
  3396.       variables - they cease to exist when the procedure ends. So
  3397.       that you can pass messages between procedures Easy base
  3398.       provides a single global variable "Global Number".  Once you
  3399.       allocate a value to "Global Number" that value remains
  3400.       unchanged (even if your computer has been turned off) until you
  3401.       allocate another value to it. You can of course pass many
  3402.       messages between procedures simply by entering records in forms
  3403.       and re-reading them but using "Global Number" is much quicker.
  3404.  
  3405.       The following example uses "Global Number" to make access to a
  3406.       user menu restricted by password.
  3407.  
  3408.       Two procedures are defined. The first, "getpassword" has a
  3409.       password field on its input screen and the following code:-
  3410.  
  3411.       if input.password = "gingerbread" then
  3412.          global number = 1
  3413.       else
  3414.          global number = 0
  3415.       end if
  3416.  
  3417.       The second procedure "checkpassword" has the following code:-
  3418.  
  3419.       if global number <> 1 then exit batch menu
  3420.       global number = 0
  3421.  
  3422.       The open access menu system has an item for the restricted menu
  3423.       but instead of calling it direct it calls the menu "Password"
  3424.       which is a batch execute menu with the items
  3425.  
  3426.       run procedure ----  getpassword
  3427.       run procedure ----  checkpassword
  3428.       user menu     ----  restricted
  3429.  
  3430.       If the password "gingerbread" has not been entered in the
  3431.       "getpassword" input screen then "checkpassword" will return
  3432.       control to the original menu.
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.  
  3448.                                 - 57 -
  3449. ................................................................................
  3450.       GOTO (FIELD) NEXT      DERIVATION PREFIX      GOTO (FIELD) NEXT
  3451.  
  3452.       In an Easy Base form or procedure input screen the cursor moves
  3453.       from field to field in the default order top left to bottom
  3454.       right when you press the Return key. You can alter this default
  3455.       order by deriving any field with "Goto (fieldname) next". If
  3456.       the field from which you wish to redirect the cursor already
  3457.       has a derivation formula you simply add the "Goto - Next" as a
  3458.       prefix.
  3459.  
  3460.       Ex.
  3461.  
  3462.       goto price next
  3463.  
  3464.       goto item next default(lookup(stock,name))
  3465.  
  3466.       Cursor redirection with the "Goto - next" derivation only
  3467.       occurs when the Return key is pressed it is not activated if
  3468.       you move the cursor with the directional arrow keys.
  3469.  
  3470.       1. You can have more than one prefix on any one field
  3471.          derivation provided there is a space between each.
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.                                 - 58 -
  3506. ................................................................................
  3507.       Help                   DERIVATION PREFIX                   Help
  3508.  
  3509.       Easy Base provides a default help line for all data entry and
  3510.       procedure input screens. You can replace the system default
  3511.       help line with your own default help line by pressing F6 during
  3512.       form or screen design.
  3513.  
  3514.       You can also override the default with a field specific help
  3515.       line by using the derivation prefix "Help" followed by the help
  3516.       line in quotation marks.
  3517.  
  3518.       Field specific help lines replace the default help line
  3519.       whenever the cursor is in the field with the derivation prefix.
  3520.  
  3521.       Example: If, in the derivation formula for field "Name" you
  3522.       type:-
  3523.  
  3524.       Help "Enter Customers name and press return"
  3525.  
  3526.       then the help line will show the quoted text whenever the
  3527.       cursor is in the Name field but will revert to the default when
  3528.       the cursor moves to another field.
  3529.  
  3530.       You can use the Help prefix in any or all fields.
  3531.  
  3532.       The help line has a maximum length of 80 characters. If you
  3533.       quote a help line greater than 80 characters it will be
  3534.       truncated at run time. Help lines of less than 80 characters
  3535.       are automatically padded to 80 with space characters.
  3536.  
  3537.       If the field already has a derivation formula, add the help as
  3538.       a prefix:-
  3539.  
  3540.       Help "Enter Part Name" proper(partname)
  3541.  
  3542.       Notes:
  3543.  
  3544.       1.  There must be a space between Help and the quoted line.
  3545.  
  3546.       2.  The line must be in quotes and quotation marks cannot be
  3547.           included in the line.
  3548.  
  3549.       3.  You can have more than one prefix on any one field
  3550.           derivation provided there is a space between each.
  3551.  
  3552.       Ex.
  3553.  
  3554.       Autodial Help "Press Ctrl + D to Dial" lookup(customers,No)
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.                                 - 59 -
  3563. ................................................................................
  3564.       HOURS                      FUNCTION                       HOURS
  3565.  
  3566.       This function returns the hour ( 1 to 23) of the time parameter
  3567.  
  3568.       Ex.  Hour(system time)
  3569.  
  3570.       Ex.
  3571.  
  3572.       Labourcharge = (hours(endtime)-hours(starttime))* rate
  3573.  
  3574.  
  3575.       Acceptable parameters:
  3576.  
  3577.       System time
  3578.       Time field
  3579.       Maketime function
  3580.       Time expression
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.                                 - 60 -
  3620. ................................................................................
  3621.       IF                         FUNCTION                          IF
  3622.  
  3623.       Ex.  if(num >= 0,"Positive","negative")
  3624.  
  3625.       The first parameter of the "if" function is an expression, the
  3626.       second is the value to be returned if the expression is true
  3627.       and the third is the value to be returned if the expression is
  3628.       false.
  3629.  
  3630.       If the third parameter is omitted and the expression is false
  3631.       then the field or variable retains any value it had before the
  3632.       function was called.
  3633.  
  3634.       The "if" function can be extended to a full "case" function
  3635.       simply by adding more expressions and return values.
  3636.  
  3637.       Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  3638.  
  3639.       There is no limit to the number of expressions and return
  3640.       values. If more than one expression is true the value returned
  3641.       is that for the first true expression. If none are true then
  3642.       the trailing value is returned as the "case else".
  3643.  
  3644.       Acceptable Parameters:
  3645.  
  3646.       Numeric expressions
  3647.       Quoted text
  3648.       Fields and variables
  3649.       Other nested functions
  3650.       System Values
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.                                 - 61 -
  3677. ................................................................................
  3678.       IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3679.  
  3680.       Easy Base recognizes the following "If Then Else"
  3681.       constructions.
  3682.  
  3683.       1.    if (condition) then (action)
  3684.             ------------------------------------------
  3685.       2.    if (condition) then (action) else (action)
  3686.             ------------------------------------------
  3687.       3.    if (condition) then
  3688.                (action)
  3689.                (action)
  3690.                (action)
  3691.             end if
  3692.             -----------------------------------------
  3693.       4.    if (condition) then
  3694.                (action)
  3695.                (action)
  3696.             else
  3697.                (action)
  3698.                (action)
  3699.             end if
  3700.  
  3701.       If then constructions can be nested to any depth.
  3702.  
  3703.       if (condition) and (condition) then
  3704.          (action)
  3705.          if (condition) or (condition) then
  3706.             (action)
  3707.             (action)
  3708.          else
  3709.             (action)
  3710.             if (condition) eqv (condition) then (action)
  3711.             (action)
  3712.          end if
  3713.          if (condition) then (action)
  3714.       else
  3715.          (action)
  3716.       end if
  3717.  
  3718.       Easy base does not interpret "Else if" constructions.
  3719.  
  3720.       Easy base does not interpret two "if" conditions on one line.
  3721.  
  3722.  
  3723.       In the above examples "action" applies to any Easy base command
  3724.       or full "Do Loop" or full "For Next" structure.
  3725.  
  3726.       You cannot split a "Do Loop" structure and you can only split a
  3727.       "For Next" structure by a simple "If then" and "End if" with no
  3728.       "else" command.
  3729.  
  3730.       Ex. on next page.
  3731.  
  3732.  
  3733.                                 - 62 -
  3734. ................................................................................
  3735.       IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3736.  
  3737.       In the following example the procedure has an input screen with
  3738.       a field "type". "type" is a choice field with the choices "In
  3739.       age order", "In alphabetic order" and "By sex". The procedure
  3740.       code selects one of three listings from the "Pupils" form by
  3741.       splitting "For Next" structures by "If Then" structures.
  3742.  
  3743.       if input.type = "in age order" then
  3744.          for pupils with age in order
  3745.       end if
  3746.       if input.type = "in alphabetic order" then
  3747.          for pupils with name in order
  3748.       end if
  3749.       if input.type = "by sex" then
  3750.          for pupils with sex in order
  3751.       end if
  3752.          print list items
  3753.       next
  3754.       next
  3755.       next
  3756.  
  3757.       The structure above is the only one in which "For Next"
  3758.       structures can be split. There must be a separate "If Then"
  3759.       followed by "End If" for each "For". There must be a "Next for
  3760.       each "For"  and there cannot be an "Else" anywhere in the
  3761.       construction.
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.                                 - 63 -
  3791. ................................................................................
  3792.       INDEX OFF              PROCEDURE COMMAND              INDEX OFF
  3793.  
  3794.       When an Easy Base procedure adds, updates or deletes a record
  3795.       then by default it updates any affected index files. As the
  3796.       majority of transaction procedures act on a single record this
  3797.       is the fastest method of processing. It does of course require
  3798.       that the form is periodically re-packed.  If, however, a
  3799.       procedure is to add, update or delete many records then
  3800.       updating each affected index file on each iteration of the
  3801.       "For" loop can be much slower than ignoring the indices during
  3802.       the loop and re-writing them from scratch afterward.
  3803.  
  3804.       You can take the "re-write" option by issuing the command
  3805.       "Index off" before the "For" loop.
  3806.  
  3807.       index off
  3808.       for employees
  3809.         for wagelist new record
  3810.            wagelist.worksno = employees.worksno
  3811.            wagelist.taxcode = employees.taxcode
  3812.         next
  3813.       next
  3814.  
  3815.       Obviously re-writing an entire index file when only one or two
  3816.       records are affected would be slower than simply updating the
  3817.       indices. The actual point at which "Index Off" becomes faster
  3818.       can only be determined by trial but as a general rule the two
  3819.       systems take equal time when between 12 and 15 percent of the
  3820.       records of a file are affected and the advantage of "Index Off"
  3821.       becomes greater the bigger this percentage.
  3822.  
  3823.       There is no corresponding "Index On" command. Indexing is
  3824.       turned back on automatically and the index files are re-written
  3825.       at the end of the loop to which the command applies. If you
  3826.       require indexing off during more than one loop you must issue
  3827.       the command before each.
  3828.  
  3829.       index off
  3830.       for invoices with date < makedate(05,04,93)
  3831.          delete records
  3832.       next
  3833.       index off
  3834.       for invoices with customer = "john smith"
  3835.          invoices.customer = "John Smith Ltd"
  3836.          update record
  3837.       next
  3838.  
  3839.       If you prefix a loop which deletes records from a form then the
  3840.       form is packed at the end of the loop.
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.  
  3847.                                 - 64 -
  3848. ................................................................................
  3849.       INSTALL FORM               UTILITY                 INSTALL FORM
  3850.  
  3851.       The "Install Form" utility is accessed from the Utilities menu.
  3852.       If you wish to include a form in one application which you
  3853.       designed in another then you cannot simply copy the files to
  3854.       the new applications directory as there will be no entry in the
  3855.       "Forms Directory" file.
  3856.  
  3857.       To install a form from another application - first get the
  3858.       forms DOS filename from that application then select "Install
  3859.       Form" from the utilities menu. You will be asked to supply the
  3860.       forms name and the full path and filename from where it is to
  3861.       be copied. Easy Base will then copy the forms definition file
  3862.       and make the appropriate entry in the "Forms Directory". It
  3863.       will then ask whether or not you wish the data to be copied
  3864.       from the original application.
  3865.  
  3866.       If you install a form from another application and it has
  3867.       "lookup" derivations or Choice List fields then you will have
  3868.       to create the relationships and choice lists in the new
  3869.       application. They are not automatically reproduced.
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.                                 - 65 -
  3905. ................................................................................
  3906.       INSTALL PRINTER            UTILITY              INSTALL PRINTER
  3907.  
  3908.       The "Install printer" utility is accessed from the
  3909.       Configuration item on the main menu. This can also be included
  3910.       in a user menu so that end users of finished applications can
  3911.       install their printer without access to the system menus.
  3912.  
  3913.       When you select "Install Printer" you are offered a choice of
  3914.       six generic drivers. The drivers supplied cover virtually all
  3915.       printers except dedicated postscript.
  3916.  
  3917.       When you have chosen your printer driver Easy Base then asks
  3918.       for the parallel port number to which printer output is to be
  3919.       sent - one or two. Easy Base does not have a built in serial
  3920.       port printer output. If your printer only has a serial input
  3921.       then you must redirect a parallel port with the DOS "Mode"
  3922.       command.
  3923.  
  3924.       Easy Base then asks how much paper wastage there is at the top
  3925.       of the page. This is quite important as it is used in
  3926.       conjunction with the paper size in use to determine the
  3927.  
  3928.       "Bottom Margin" value, used for pagination in printed reports.
  3929.  
  3930.       You are then asked for the wastage at the left margin. This
  3931.       information is used in the format editor to display the right
  3932.       edge of the paper at the different print sizes. There are only
  3933.       two settings for wastage at the left margin - zero and ¼ inch.
  3934.       If you have a cartridge fed printer such as a Laser or Bubble
  3935.       Jet then it will almost certainly be ¼ inch. If you have a
  3936.       traction or manual feed then you will be able to adjust the
  3937.       left margin and you should set it to zero.
  3938.  
  3939.       Finally you are asked for the top margin required in printed
  3940.       reports. This can only be between the value set as the printers
  3941.       inherent wastage and one inch.  The value you set here will be
  3942.       the default top margin for all printouts. If you need a larger
  3943.       top margin for certain printouts then you must include blank
  3944.       lines in the page header of the procedures output format.
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.                                 - 66 -
  3962. ................................................................................
  3963.       INSTALL PROCEDURE          UTILITY            INSTALL PROCEDURE
  3964.  
  3965.       The "Install procedure" utility is accessed from the
  3966.       Utilities menu and allows you to install procedures which you
  3967.       designed in another application. It is used exactly like the
  3968.       "Install Form" utility previously described.
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.                                 - 67 -
  4019. ................................................................................
  4020.       INTEGER                   FIELD TYPE                    INTEGER
  4021.  
  4022.       Integer fields can have up to 14 digits and use a comma as the
  4023.       thousands separator.
  4024.  
  4025.       Although integer fields display integers they store the result
  4026.       of any division correct to 15 significant figures.
  4027.  
  4028.       See - Operators Arithmetic
  4029.  
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.                                 - 68 -
  4076. ................................................................................
  4077.       INTEXT                     FUNCTION                      INTEXT
  4078.  
  4079.       This function returns the starting character number of one
  4080.       length of text within another.
  4081.  
  4082.       Ex.    Intext(companyname," and ")
  4083.              < Returns 7 if companyname = "Turner and Smith"
  4084.  
  4085.       The intext function returns 0 if the second parameter is not
  4086.       found in the first.
  4087.  
  4088.       Ex.
  4089.  
  4090.       If intext(customers.companyname," Ltd") <> 0 then
  4091.          customers.Ltd  = "yes"
  4092.          update record
  4093.       end if
  4094.  
  4095.       Acceptable parameters:
  4096.  
  4097.       Text field/variable
  4098.       Any function returning a text value
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.                                 - 69 -
  4133. ................................................................................
  4134.       JOINTEXT                   FUNCTION                    JOINTEXT
  4135.  
  4136.       Ex.  Jointext(forename,surname)
  4137.  
  4138.       The jointext function takes any number of parameters.
  4139.  
  4140.       Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  4141.       Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  4142.  
  4143.       The "jointext" function will also perform any arithmetic
  4144.       operations required for a text output.
  4145.  
  4146.       Ex. Jointext("The Gross price is ",netprice *120/100)
  4147.  
  4148.       The "jointext" function is also used for creating compound
  4149.       index fields.
  4150.  
  4151.       Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  4152.  
  4153.       This creates a field whose index allows a stock file to be
  4154.       listed with stockitem in alphabetical order but grouped by
  4155.       price in reverse order.
  4156.  
  4157.       If you "Jointext" a date or time field you will get the date or
  4158.       time's numeric value not the date or time's string
  4159.       representation. (See Compound Index)
  4160.  
  4161.       By default the "Jointext" function strips trailing blank space
  4162.       characters from the texts being joined. If you wish to join
  4163.       text in a Text Block field so that the second text starts on a
  4164.       new line then you can force this by including Chr$(13) which
  4165.       Easy base uses as a "New Line" flag.
  4166.  
  4167.       Ex.
  4168.  
  4169.           Jointext(block1,chr$(13),block2)
  4170.  
  4171.           <The text from block2 will start on a new line>
  4172.  
  4173.       Ex.
  4174.  
  4175.           Jointext(block1,chr$(13),chr$(13),block2)
  4176.  
  4177.          <There will be a blank line between block1 and block2>
  4178.  
  4179.       Acceptable Parameters:
  4180.  
  4181.       Numeric expressions
  4182.       Quoted text
  4183.       Fields and variables
  4184.       Other nested functions
  4185.       System Values
  4186.  
  4187.  
  4188.  
  4189.                                 - 70 -
  4190. ................................................................................
  4191.       LEFTTEXT                   FUNCTION                    LEFTTEXT
  4192.  
  4193.       This function returns a specified number of characters from the
  4194.       start of a field or variable.
  4195.  
  4196.       Ex.   Lefttext(salutation,2)
  4197.             < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  4198.  
  4199.       Ex.   Lefttext(datetext(system date),4)
  4200.             < Returns 12th , 20th Etc.>   (European date format)
  4201.  
  4202.  
  4203.  
  4204.  
  4205.       Acceptable parameters:
  4206.  
  4207.       Text field/variable
  4208.       Any function returning a text value
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.                                 - 71 -
  4247. ................................................................................
  4248.       LENGTHTEXT                 FUNCTION                  LENGTHTEXT
  4249.  
  4250.       This function returns the length of text in a field or variable
  4251.  
  4252.       Ex.   lengthtext(name)
  4253.             < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  4254.  
  4255.  
  4256.       Acceptable parameters:
  4257.  
  4258.       Text field/variable
  4259.       Any function returning a text value
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.  
  4274.  
  4275.  
  4276.  
  4277.  
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.                                 - 72 -
  4304. ................................................................................
  4305.       LIST FILE NAMES            UTILITY              LIST FILE NAMES
  4306.  
  4307.       When you give a name to a Form or Procedure in Easy Base it is
  4308.       not the actual DOS file name used. A Form has separate DOS
  4309.       files for its definition, its data and its indices. Similarly a
  4310.       procedure can have one or two files depending on whether or not
  4311.       it has an input screen. Within an application you never need to
  4312.       know the DOS filenames as Easy Base takes care of all disk
  4313.       activity in the background.
  4314.  
  4315.       You may however need to know the DOS filenames if you intend to
  4316.       export data to another program or copy a Form or Procedure from
  4317.       one application to another.
  4318.  
  4319.       You can list the DOS filenames for Forms and reports with the
  4320.       "List File Names" utility.
  4321.  
  4322.       The "List File Names" utility can also be called from a user
  4323.       menu without accessing the system.
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.                                 - 73 -
  4361. ................................................................................
  4362.       LIST VARIABLES         PROCEDURE COMMAND         LIST VARIABLES
  4363.  
  4364.       The "List Variables" command is a de-bugging facility for
  4365.       developers. If a procedure is not producing the expected
  4366.       results you can interrupt it at any point and view the contents
  4367.       of all fields and variables in memory at that point.
  4368.  
  4369.       Ex.
  4370.  
  4371.       for authors with surname in order
  4372.          if authors.surname = "kippling" then list variables
  4373.          for books with author = authors.surname
  4374.             print list items
  4375.          next
  4376.       next
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.                                 - 74 -
  4418. ................................................................................
  4419.       Lock / Unlock          Procedure Command          Lock / Unlock
  4420.  
  4421.       Network versions only
  4422.  
  4423.       Easy Base automatically places protective locks whenever any
  4424.       process might cause a multiple access confliction. You do not
  4425.       have to use the Lock and Unlock commands to avoid such
  4426.       conflicts.
  4427.  
  4428.       There will however be occasions where multiple access would
  4429.       prevent the correct execution of an application even though no
  4430.       access conflict would occur.
  4431.  
  4432.       For Example, if a procedure collects statistics from form a and
  4433.       form b then updates form c with the information, you might not
  4434.       wish to have any other workstation access form c until the
  4435.       update is complete. Easy Base would not automatically prevent
  4436.       access to form c while your procedure read from a and b as this
  4437.       would not cause any access conflicts.
  4438.  
  4439.       To prevent access in such cases use the Lock and Unlock
  4440.       Commands.
  4441.  
  4442.       Declare variables
  4443.          Count as number
  4444.       end
  4445.       Lock Stats : Lock Stock
  4446.       for Stock with Location = input.location
  4447.          delete record
  4448.       next
  4449.       Pack Stock
  4450.       Unlock Stock
  4451.       For stock
  4452.          count = stock.total records
  4453.          exit for
  4454.       next
  4455.       for stats
  4456.          stats.stockitems = count
  4457.          update record
  4458.       next
  4459.       Unlock stats
  4460.  
  4461.       Locks placed with the Lock command are total locks. There is no
  4462.       option to place read only locking. Once a lock command has been
  4463.       executed it remains in force until the same workstation issues
  4464.       an unlock command for the form. If you need a form to remain
  4465.       locked between procedures you can issue the Lock command in one
  4466.       procedure and the Unlock command in another. In such cases you
  4467.       need to ensure that there is no way to avoid running the
  4468.       procedure with the Unlock command.
  4469.  
  4470.       Similarly, when the Lock and Unlock commands are within a
  4471.       single procedure, there must not be any option to exit the
  4472.       procedure between the two commands.
  4473.  
  4474.                                 - 75 -
  4475. ................................................................................
  4476.       LOOKUP                     FUNCTION                      LOOKUP
  4477.  
  4478.       Ex. Lookup(customers,surname)
  4479.           Lookup(customers,surname,address)
  4480.  
  4481.       The first parameter is the name of a relationship defined in
  4482.       the relationships form. The second parameter is the name of the
  4483.       field in the secondary file whose value is to be looked up. The
  4484.       third parameter, which is optional, specifies that a field
  4485.       other than the looked up field is to be listed for selection
  4486.       when there is more than one match. (The looked up field must be
  4487.       indexed)
  4488.  
  4489.       The parameters are absolute. You cannot supply them as
  4490.       variables, fields or the results of other functions.
  4491.  
  4492.       In the first example, if you enter "Sm*" in the field with the
  4493.       derivation and there are several names beginning with Sm, then
  4494.       the names will be listed for you to choose from. This is most
  4495.       useful if all the names are different. If, however, there are
  4496.       several names beginning with Sm but they are all "Smith" then
  4497.       it will be more useful to use the second example which will
  4498.       list all the addresses for the "Smith" names.
  4499.  
  4500.       Lookup functions which have two parameters do not list
  4501.       duplicates when there is more than one match, whereas lookup
  4502.       functions with three parameters do. You can therefore use one
  4503.       lookup of the first type and one lookup of the second type to
  4504.       resolve ambiguities.
  4505.  
  4506.       For example, to perform lookups from the customers form (which
  4507.       has duplicates in the "Surname" field), you would firstly
  4508.       create an additional invisible field on the input screen
  4509.       (surname2) derived surname. You then enter two relationships
  4510.       between the screen and the customers form. The first, called
  4511.       customers, links surname with surname and the second, called
  4512.       customers2, links surname2 with surname.
  4513.  
  4514.       The surname field on the input screen is derived -
  4515.       Lookup(customers,surname). All the other fields to be looked up
  4516.       are derived - Lookup(customers2,fieldname) but one of them (Any
  4517.       one) has the third parameter added :-
  4518.  
  4519.       Lookup(customers2,forename,address)
  4520.  
  4521.       When you enter "Sm" in the surname field, the first lookup will
  4522.       list all the customer surnames beginning with "Sm". When you
  4523.       choose "Smith" from this list, "Smith" will be copied to the
  4524.       invisible field Surname2 and the second lookup will trigger
  4525.       listing all the addresses of the Smith customers.
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.                                 - 76 -
  4532. ................................................................................
  4533.       LOWER                      FUNCTION                       LOWER
  4534.  
  4535.       Returns the lower case of the parameter.
  4536.  
  4537.       Ex. lower(partname)
  4538.  
  4539.  
  4540.       Ex.
  4541.  
  4542.       Heading = Jointext("List of parts supplied by ",lower(makers.
  4543.       name))
  4544.  
  4545.  
  4546.       Acceptable parameters:
  4547.  
  4548.       Quoted text
  4549.       Text Field/variable
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.                                 - 77 -
  4589. ................................................................................
  4590.       MAKEDATE                   FUNCTION                    MAKEDATE
  4591.  
  4592.       The Easy base Date field is a six digit field which covers the
  4593.       century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  4594.       perform addition and subtraction operations in days.
  4595.  
  4596.       Ex. Duedate = Invoicedate + 30
  4597.  
  4598.       In order to provide this facility the date is held as a numeric
  4599.       value. You can only type a date directly into a date field.
  4600.  
  4601.       If you need to enter a date in a derivation or in a procedure
  4602.       code you must use the "makedate" function.
  4603.  
  4604.       Ex.  Makedate(5,11,95)
  4605.           < Returns 05/11/95 >
  4606.  
  4607.       Ex.  Nextmonth = month(system date)+1
  4608.            if nextmonth = 13 then nextmonth = 1
  4609.            Nextdelivery = makedate(1,nextmonth,year(system date))
  4610.            < Returns the date of the first of next month >
  4611.  
  4612.       Acceptable parameters
  4613.  
  4614.       Numeric value
  4615.       Numeric expression
  4616.       Numeric field/variable
  4617.       Any other function which returns a numeric value
  4618.  
  4619.       Note:- The parameters for the makedate function are:-
  4620.  
  4621.       Makedate(Day,Month,Year)
  4622.  
  4623.       Irrelevant of whether you are using dates Day/Month/Year or
  4624.       Month/Day/Year.
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.  
  4634.  
  4635.  
  4636.  
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.                                 - 78 -
  4646. ................................................................................
  4647.       MAKETIME                   FUNCTION                    MAKETIME
  4648.  
  4649.       The value of a time field in Easy base is held as a numeric
  4650.       value representing the number of seconds past midnight. This
  4651.       allows you to perform addition and subtraction operations in
  4652.       seconds.
  4653.  
  4654.       Ex. Timetaken = Round(Endtime - Starttime / 60)
  4655.           < This returns the time taken in minutes >
  4656.  
  4657.       You can only enter a time directly into a time field.
  4658.  
  4659.       If you need to enter a time in a field derivation or in a
  4660.       procedure code you must use the "Maketime" function.
  4661.  
  4662.       Ex. Time = Maketime(20,20,00)
  4663.            <  returns 20:20:00  >
  4664.  
  4665.  
  4666.       Acceptable parameters:
  4667.  
  4668.       Numeric value
  4669.       Numeric expression
  4670.       Numeric field/variable
  4671.       Any other function which returns a numeric value
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.  
  4696.  
  4697.  
  4698.  
  4699.  
  4700.  
  4701.  
  4702.                                 - 79 -
  4703. ................................................................................
  4704.       Manual Feed            Procedure Command            Manual Feed
  4705.  
  4706.       When you set the paper type in use from the utilities menu, you
  4707.       tell Easy Base whether you have a manual or continuous feed
  4708.       printer. This is then used throughout all procedures.
  4709.  
  4710.       If your printer has a continuous feed but a particular
  4711.       procedure requires manual eg label or envelope printing you can
  4712.       force Easy Base to pause after each page without changing the
  4713.       default by issuing the Manual Feed command within the procedure
  4714.       code.
  4715.  
  4716.       Declare output fields
  4717.          mail.name :mail.address
  4718.       end
  4719.       manual feed
  4720.       for mail
  4721.          print envelope
  4722.       next
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.                                 - 80 -
  4760. ................................................................................
  4761.       MATHS                      FUNCTION                       MATHS
  4762.  
  4763.       The following maths functions can be used anywhere in Easy Base
  4764.       code or field derivations.
  4765.  
  4766.       Log()
  4767.       Log10()
  4768.       Sqrt()
  4769.       Sin()
  4770.       Cos()
  4771.       Tan()
  4772.       Atan()
  4773.       Deg_rad()     converts degrees to radians
  4774.       Rad_deg()     converts radians to degrees
  4775.       Exp()         Raises e (the base of natural logarithms) to the
  4776.                     power of the parameter
  4777.  
  4778.  
  4779.       Acceptable parameters:
  4780.  
  4781.       Numeric value
  4782.       Numeric expression
  4783.       Numeric field/variable
  4784.       Any function returning a numeric value
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.                                 - 81 -
  4817. ................................................................................
  4818.       MENU CALLS               MENU FUNCTION               MENU CALLS
  4819.  
  4820.       In addition to the utilities which can be called from user
  4821.       menus the following calls can also be made.
  4822.  
  4823.       Run Procedure        :   Runs a pre-defined procedure
  4824.  
  4825.       Last Output          :   Recalls the output from a procedure
  4826.  
  4827.       Data Entry           :   Allows direct access to a form
  4828.  
  4829.       User Menu            :   Calls another user menu
  4830.  
  4831.       Data Browse          :   Veiw or process a form (See For..Next)
  4832.  
  4833.       System Menus         :   Calls the Easy Base System menus
  4834.  
  4835.       Exit to DOS          :   Terminates Easy Base
  4836.  
  4837.       Run external program : Shells to another program
  4838.  
  4839.       Notes:
  4840.       You cannot run another major program from within Easy Base -
  4841.       there is very little spare memory - this call is however useful
  4842.       for calling batch files which export data to other programs for
  4843.       later use.
  4844.  
  4845.       If you place "Exit to DOS" on a normal menu the user will be
  4846.       asked to confirm that he wishes to exit. If you place it on a
  4847.       batch execute menu he will not.
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867.  
  4868.  
  4869.  
  4870.  
  4871.  
  4872.  
  4873.                                 - 82 -
  4874. ................................................................................
  4875.       MIDTEXT                    FUNCTION                     MIDTEXT
  4876.  
  4877.       This function returns a given number of characters from a given
  4878.       starting point in a field or variable.
  4879.  
  4880.       Ex.   Midtext(fileref,4,4)
  4881.             < Returns "Bill" from "TR/Bill/1243"
  4882.  
  4883.  
  4884.       Acceptable parameters:
  4885.  
  4886.       Text field/variable
  4887.       Any function returning a text value
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.                                 - 83 -
  4931. ................................................................................
  4932.       MINUTES                    FUNCTION                     MINUTES
  4933.  
  4934.       This function returns the minutes number from the time field
  4935.       parameter.
  4936.  
  4937.       Ex.    minutes(system time)
  4938.  
  4939.       Ex.
  4940.  
  4941.       Unitsperhour = rounddown(60/(minutes(endtime)-
  4942.       minutes(starttime)))
  4943.  
  4944.       Acceptable parameters:
  4945.  
  4946.       System time
  4947.       Time field
  4948.       Maketime function
  4949.       Time expression
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.                                 - 84 -
  4988. ................................................................................
  4989.       MOD                        FUNCTION                         MOD
  4990.  
  4991.       The Mod function returns the remainder of an integer division
  4992.  
  4993.       Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  4994.  
  4995.  
  4996.       Ex.
  4997.  
  4998.       for Historydates
  4999.          historydates.leapyear = "No"
  5000.          if mod(historydates.year,4) = 0 then
  5001.             historydates.leapyear = "Yes"
  5002.             update record
  5003.          end if
  5004.       next
  5005.       < This example fills a new field "leapyear" which has been
  5006.       added to the "Historydates" form after data has been entered>
  5007.  
  5008.       Acceptable parameters:
  5009.  
  5010.       Numeric value
  5011.       Numeric expression
  5012.       Numeric field/variable
  5013.       Any other function which returns a numeric value
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.  
  5035.  
  5036.  
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042.  
  5043.  
  5044.                                 - 85 -
  5045. ................................................................................
  5046.       MONTH                      FUNCTION                       MONTH
  5047.  
  5048.       This function returns the month number from a date parameter.
  5049.  
  5050.       Ex.    Month(system date)
  5051.  
  5052.       Ex.    Month(birthdate)
  5053.  
  5054.  
  5055.       Acceptable parameters
  5056.  
  5057.       System date
  5058.       Date field
  5059.       Makedate function
  5060.       Date expression
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.                                 - 86 -
  5102. ................................................................................
  5103.       MULTIPLE LINES         PROCEDURE COMMAND         MULTIPLE LINES
  5104.  
  5105.       You can place multiple code instructions on a single line of
  5106.       the code editor by separating them with a colon.
  5107.  
  5108.       Ex.
  5109.  
  5110.       for ledger with lineno = input.lineno
  5111.          ledger.net = input.net:ledger.vat = input.vat
  5112.          ledger.acno = input.acno:ledger.gross = input.gross
  5113.          update record
  5114.       next
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.                                 - 87 -
  5159. ................................................................................
  5160.       Next Batch             Procedure Command             Next Batch
  5161.  
  5162.       The Next Batch command resets the batch menu pointer from
  5163.       within a procedure. By using the Next Batch command you can
  5164.       cause a batch of procedures to repeat without returning to the
  5165.       menu in the same way that you can repeat a single procedure
  5166.       with an input screen.
  5167.  
  5168.       For example, in a variable length invoicing system you might
  5169.       have three procedures on a batch menu. The first procedure
  5170.       selects the current customer and invoice number, the second
  5171.       writes invoice lines to the lineitems form and the third prints
  5172.       the invoice. To have the entire process repeated after each
  5173.       invoice the last line of the last procedure should be:
  5174.  
  5175.       Next Batch 1
  5176.  
  5177.       Similarly, if the user inadvertently selects the wrong customer
  5178.       in the first procedure you can use an input screen field in the
  5179.       second to return to the first.
  5180.  
  5181.       If input.reselect = "yes" then Next Batch 1
  5182.  
  5183.       By using Next Batch and Global Number you can create a batch
  5184.       menu which reacts like a single procedure repeating until the
  5185.       Escape key is pressed.
  5186.  
  5187.       To exit from a batch of procedures on the escape key, set
  5188.       Global Number to 1 in the first procedure and to 0 in the last.
  5189.       Add a procedure immediately after the first with the code:-
  5190.  
  5191.       If Global Number = 0 then exit batch menu
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.                                 - 88 -
  5216. ................................................................................
  5217.       ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5218.  
  5219.       If you want to print procedure output on both sides of the
  5220.       paper then, unless you have a VERY expensive printer, the only
  5221.       way to achieve this is to print the odd pages, turn your paper
  5222.       over and print the even pages.  For a short report you can do
  5223.       this by setting paper feed to "Manual" from the utilities menu
  5224.       and turning each sheet over individually. If, however, you have
  5225.       a cut sheet feeder or a cartridge fed printer it is much
  5226.       quicker to print all the odd pages, turn them all over and then
  5227.       print all the even pages.
  5228.  
  5229.       To do this in Easy Base, issue the command "Odd Page Print"
  5230.       immediately before the print output and "Even Page Print"
  5231.       immediately after it.
  5232.  
  5233.       declare output fields
  5234.          customers.name : customers.phone
  5235.       end
  5236.       odd page print
  5237.       for customers with surname in order
  5238.          if bottom margin < .75 then page feed
  5239.          print list items
  5240.       next
  5241.       even page print    '(Easy Base pauses here till you are ready)
  5242.  
  5243.       If you will be binding your printed report down the left hand
  5244.       edge then you will need a larger left margin on the odd pages
  5245.       than on the even. If you start odd page printing with the
  5246.       command "Odd Page Print for Binding" then Easy Base will add
  5247.       half an inch to the format left margin when it prints the odd
  5248.       pages. You cannot alter the fixed value of half an inch but if
  5249.       you create your output format with a left margin of half an
  5250.       inch(suitable for the even pages) and print for binding, you
  5251.       will find that the resulting output suits most office binding
  5252.       systems.
  5253.  
  5254.       If you use Odd/Even page printing then it is important that you
  5255.       realize it is achieved by running the portion of your procedure
  5256.       between the "Odd Page Print" and "Even Page Print" twice -
  5257.       simply cancelling output to the printer at the appropriate
  5258.       times.  You must not, therefore include any commands which add,
  5259.       update or delete records between the commands. If you do they
  5260.       will be performed twice. Similarly if you are running a loop
  5261.       counter during the print process then it will have double the
  5262.       expected value after the "Even Page Print" command.
  5263.  
  5264.       The system value "Page Number" is reset to one at the "Even
  5265.       Page Print" command. If you include two separate sets of odd
  5266.       and even printing in a single procedure then you cannot use
  5267.       "Page Number" to number the second printout. You can of course
  5268.       use an ad hoc field. Just remember to reset it to one
  5269.       immediately before the "Even Page Print" command.
  5270.  
  5271.  
  5272.                                 - 89 -
  5273. ................................................................................
  5274.       ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5275.  
  5276.       This document was written in an Easy Base form "Ref" which has
  5277.       fields "Name", "Type", "Pageno" "Topicpage" and three text
  5278.       block fields "T1", "T2" and "T3". Each record holds one page of
  5279.       the reference manual and the pages were entered in no
  5280.       particular order. The following procedure was used to number,
  5281.       sort, index and print the manual.
  5282.  
  5283.       declare output fields
  5284.          ref.name : ref.type :ref.pageno
  5285.          ref.t1 : ref.t2 : ref.t3 : type : name
  5286.       end
  5287.       declare variables
  5288.          x as number : y as number
  5289.          namelen as number : typelen as number
  5290.       end
  5291.       '.....................NUMBER REFERENCE PAGES....
  5292.       for ref with name in order
  5293.          y = ref.total records
  5294.          x = x + 1
  5295.          display status "Numbering page" + x + "of" + y
  5296.          ref.pageno = x : update record
  5297.       next
  5298.       odd page print for binding
  5299.       '...............PRINT COMMANDS INDEX........
  5300.       bold on : print commandheader : bold off
  5301.       for ref with type = "procedure command"
  5302.          subindex name
  5303.       next
  5304.       for ref with subindex in order
  5305.          if topicpage > 1 then skiprec  'only first page
  5306.          ref.name = proper(ref.name)    'of each topic listed
  5307.          print commands
  5308.       next
  5309.       '..............PRINT SYSTEM VALUES INDEX...
  5310.       bold on : print valuesheader : bold off
  5311.       for ref with type = "system value"
  5312.          subindex name
  5313.       next
  5314.       for ref with subindex in order
  5315.          if topicpage > 1  then skiprec
  5316.          ref.name = proper(ref.name)
  5317.          print values
  5318.       next
  5319.       page feed       '... eject first index page
  5320.  
  5321.       '......... subsequent index pages are produced with exactly
  5322.       '........ the sane code as above and are omitted for clarity.
  5323.  
  5324.       '......................MAIN REFERENCE.............
  5325.       page feed
  5326.       for ref with name in order
  5327.          namelen = lengthtext(ref.name)
  5328.  
  5329.                                 - 90 -
  5330. ................................................................................
  5331.       ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5332.  
  5333.          typelen = lengthtext(ref.type)
  5334.          '....centre justify type
  5335.          type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  5336.          '....right justify name
  5337.          name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  5338.          bold on : print refheader : bold off  'type and names fields
  5339.          print list items                      't1, t2, t3
  5340.          bold on print reffoot                 'pageno
  5341.          page feed
  5342.       next
  5343.       even page print
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386.                                 - 91 -
  5387. ................................................................................
  5388.       Open                     File Command                      Open
  5389.  
  5390.       The "Open" command is used to open a non-Easy Base file.
  5391.  
  5392.       The filename can be supplied within quotes or as a text
  5393.       variable or field.
  5394.  
  5395.       The filename can include a complete path. If a path is not
  5396.       included then the file is opened in the Easy Base System
  5397.       directory.
  5398.  
  5399.       If the filename supplied is that of an existing file, that file
  5400.       is opened for access with the Read or Write commands. If there
  5401.       is no file with the supplied filename then a new file with that
  5402.       name is created and opened.
  5403.  
  5404.       Ex.
  5405.  
  5406.       Open "C:\config.sys"
  5407.  
  5408.       Open Files.name
  5409.  
  5410.       Open jointext("C:\wp\",input.filename)
  5411.  
  5412.       See also: Close, Seek, Read, Write, Find, Erase
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.  
  5436.  
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.                                 - 92 -
  5444. ................................................................................
  5445.       OPERATORS                 ARITHMETIC                  OPERATORS
  5446.  
  5447.       The arithmetic operators used in Easy Base are:-
  5448.  
  5449.       +   (addition)
  5450.  
  5451.       -   (subtraction and negation)
  5452.  
  5453.       *   (multiplication)
  5454.  
  5455.       /   (division)
  5456.  
  5457.       ^   (exponentiation)
  5458.  
  5459.       Where there are multiple operators in a derivation they are
  5460.       processed with the following precedence:-
  5461.  
  5462.       1.   Exponentiation
  5463.       2.   Negation
  5464.       3.   Multiplication and Division
  5465.       4.   Addition and Subtraction
  5466.  
  5467.       The default precedence can be altered by the use of
  5468.       parenthesis.
  5469.  
  5470.            Easy base does not perform Integer Arithmetic.
  5471.  
  5472.       When a numeric field shows the result of a division the
  5473.       "displayed" number is "truncated" to an integer in Integer
  5474.       fields and has the last digit rounded in Fixed Point and
  5475.       Floating Point fields.  The "Stored" value which is used in any
  5476.       further calculations, however, is always correct to 15
  5477.       significant figures irrelevant of field type.  For Example: If
  5478.       three fields x,y and z are defined as integers, y is derived as
  5479.       x/4 and z is derived as y*4 then when 9 is entered in x, y will
  5480.       derive as 2 but z will derive as 9 because it multiplies the
  5481.       "stored value" of 2.25 by 4 not the displayed value of 2.
  5482.  
  5483.       Handling arithmetic in this way means that, by default there
  5484.       are no rounding errors. This has several advantages not least
  5485.       that currency values need only ever be defined to two decimal
  5486.       places.
  5487.  
  5488.       It does mean, however, that should you require rounding errors
  5489.       to be carried forward you must use one of the Easy Base
  5490.       rounding functions on the result of any intermediate division.
  5491.  
  5492.       In the above example, had y been derived as "round(x/4)" then z
  5493.       would derive as 8.
  5494.  
  5495.       If a fourth field had the formula:- if(y = 2,5,10) it would
  5496.       only derive as 5 if y had been rounded or if 8 had been entered
  5497.       in x.
  5498.  
  5499.  
  5500.                                 - 93 -
  5501. ................................................................................
  5502.       OPERATORS                 RELATIONAL                  OPERATORS
  5503.  
  5504.       Easy base uses the following relational operators:-
  5505.  
  5506.       =    (equals)
  5507.       <>   (not equals)
  5508.       >    (greater than)
  5509.       <    (less than)
  5510.       >=   (greater than or equal to)
  5511.       <=   (less than or equal to)
  5512.  
  5513.  
  5514.       Where relational operators and arithmetic operators are both
  5515.       used in a derivation. Relational operations are performed after
  5516.       arithmetic operations.
  5517.  
  5518.       Text values are not case sensitive when compared with
  5519.       relational operators.
  5520.  
  5521.       When you compare two fields or variables, the comparison is
  5522.       numeric if both are numeric and alphabetic if both are
  5523.       alphabetic.  If you compare a numeric field with a text field
  5524.       then Easy Base will test to see if the text field contains a
  5525.       number.  If it does then the comparison will be numeric and if
  5526.       it does not then the comparison will be alphabetic.
  5527.  
  5528.       WARNING
  5529.  
  5530.       If you compare the result of a division in an integer or fixed
  5531.       point field using the = or the <> operators, then the value
  5532.       used for comparison will be the (accurate) stored value and not
  5533.       the "Truncated" number shown in the field.
  5534.  
  5535.       See Operators Arithmetic
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.  
  5552.  
  5553.  
  5554.  
  5555.  
  5556.  
  5557.                                 - 94 -
  5558. ................................................................................
  5559.       OPERATORS                  LOGICAL                    OPERATORS
  5560.  
  5561.       Easy Base uses the following logical operators:-
  5562.  
  5563.       1.  and
  5564.       2.  or
  5565.       3.  xor     (or exclusive)
  5566.       4.  eqv     (equivalence)
  5567.       5.  imp     (implication)
  5568.  
  5569.       Logical operations are performed last after arithmetic and
  5570.       relational.
  5571.  
  5572.       Logical operators return a boolean (true or false) value from
  5573.       two other boolean expressions.
  5574.  
  5575.       Ex.
  5576.  
  5577.       If(x = y and a = b,"Yes","No")
  5578.          < Yes is returned if both expressions are true >
  5579.  
  5580.       If(x = y or a = b,"Yes","No")
  5581.          < Yes is returned if either or both expressions are true >
  5582.  
  5583.       If(x = y xor a = b,"Yes","No")
  5584.          < Yes is returned if either one but not both are true >
  5585.  
  5586.       If(x = y eqv a = b,"Yes","No")
  5587.          < Yes is returned if both expressions are true or if both
  5588.            expressions are false >
  5589.  
  5590.       If(x = y imp a = b,"Yes","No")
  5591.  
  5592.          < Yes is returned for all combinations except the first
  5593.            expression being true and the second false >
  5594.  
  5595.       The Easy Base logical operators are primarily designed for use
  5596.       within the "If" function and in "If..Then..Else" constructions
  5597.       where their actual value is not relevant. If you wish to use
  5598.       the value of "false" in formulae then it is represented by 0.
  5599.       True can be represented by any value other than 0 and should
  5600.       not be used.
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.  
  5614.                                 - 95 -
  5615. ................................................................................
  5616.       OPTIONS                    UTILITY                      OPTIONS
  5617.  
  5618.       The "Options" utility, in Configuration, allows you to select
  5619.       your preferred date format (European or North American).
  5620.  
  5621.       You can also enable or disable screen saving. If enabled the
  5622.       screen saver operates after three minutes without a keypress
  5623.       during record entry, procedure screen entry or if a menu is
  5624.       being displayed. The screensaver is never invoked while a
  5625.       procedure is running or while reformatting or re-indexing is
  5626.       taking place.
  5627.  
  5628.       The third option allows you to select the border style you
  5629.       require around menus and message boxes.
  5630.  
  5631.       Option four selects the COM port which will be used during
  5632.       Auto-dialling.
  5633.  
  5634.  
  5635.  
  5636.  
  5637.  
  5638.  
  5639.  
  5640.  
  5641.  
  5642.  
  5643.  
  5644.  
  5645.  
  5646.  
  5647.  
  5648.  
  5649.  
  5650.  
  5651.  
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.                                 - 96 -
  5672. ................................................................................
  5673.       OUTPUT                   SYSTEM VALUE                    OUTPUT
  5674.  
  5675.       When a user runs a procedure his choice of output, screen,
  5676.       printer or disk is stored in the system value "Output".
  5677.  
  5678.       By accessing the system value "Output" you can make your
  5679.       procedure do different things depending on where the output is
  5680.       to be sent.
  5681.  
  5682.       Ex.
  5683.  
  5684.       if output = "screen" then
  5685.          print heading1
  5686.       else
  5687.          print heading2
  5688.       end if
  5689.  
  5690.  
  5691.  
  5692.  
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.                                 - 97 -
  5729. ................................................................................
  5730.       Pack                   Procedure Command                   Pack
  5731.  
  5732.       Network Versions only.
  5733.  
  5734.       Form packing can be initiated within a procedure.
  5735.  
  5736.       Syntax: Pack formname
  5737.  
  5738.       Example:
  5739.  
  5740.       Lock Clients
  5741.       For Clients with name = input.name
  5742.          delete record
  5743.       next
  5744.       Pack Clients
  5745.       Unlock Clients
  5746.  
  5747.       The Pack command must not be executed within a for or do loop.
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.  
  5785.                                 - 98 -
  5786. ................................................................................
  5787.       PACK DATA FORMS            UTILITY              PACK DATA FORMS
  5788.  
  5789.       The process of actually removing a deleted record from a form
  5790.       is time consuming. What actually happens is that all the "Live"
  5791.       records are copied to a temporary file. The original file is
  5792.       then deleted and the temporary one re-named to the original
  5793.       name. Because of this it is actually quicker to remove fifty
  5794.       "Dead" records than it is to remove one. To save you time Easy
  5795.       base follows the traditional data-base custom of simply marking
  5796.       records for deletion when you delete them. They are only
  5797.       physically removed from the form during a "Pack" operation.
  5798.       When you "Pack" a data file Easy Base also re-writes all the
  5799.       index files for that form. You can pack individual forms with
  5800.       the "Pack Data Forms" utility accessed from the Utilities menu.
  5801.       You can also call the "Pack Data Forms" utility as a User menu
  5802.       function. In a finished application any necessary packing would
  5803.       normally be done from a batch execute menu which would run
  5804.       while the computer was unattended.
  5805.  
  5806.       Forms in which records are regularly deleted should be packed
  5807.       regularly. If packing is not done then not only will you be
  5808.       wasting disk space but search operations will become
  5809.       progressively slower as the percentage of "Dead" records
  5810.       increases.
  5811.  
  5812.       This is fairly obvious - however it is not so obvious that a
  5813.       forms index files can accumulate "Dead" records even though
  5814.       none have been deleted from the main file. An index file is
  5815.       simply the indexed fields contents and record number arranged
  5816.       in order. If, having filed a record you then alter the contents
  5817.       of an indexed field and update the record then the original
  5818.       record in the index file is deleted and a new one entered.
  5819.  
  5820.       Index files with "Dead records" also waste disk space and slow
  5821.       search operations. You should therefore regularly pack any
  5822.       forms which are regularly updated.
  5823.  
  5824.       If you are unsure which forms need to be packed you can use the
  5825.       "Auto-Pack" utility which tests each form and each forms index
  5826.       files for "Dead" records. The form is packed if it or any of
  5827.       its index files is found to have more then 100 total or 10 per
  5828.       cent "Dead" records.
  5829.  
  5830.       Although "Auto-Pack" may seem the easy answer, an application
  5831.       will almost certainly have several forms with "Core" data which
  5832.       remain unchanged and therefore never require packing. If you
  5833.       can identify the forms which do need to be packed and do them
  5834.       individually or from a batch execute menu this will be less
  5835.       time consuming than always using the "Auto-Pack" facility.
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.                                 - 99 -
  5843. ................................................................................
  5844.       PAGE NUMBER              SYSTEM VALUE               PAGE NUMBER
  5845.  
  5846.       Whenever Easy Base is processing a procedure with an output it
  5847.       keeps track of the current page number (Even if you have not
  5848.       included Page Feed commands). You can use the system value
  5849.       "Page Number" to number the pages of your output. To use the
  5850.       "Page Number" value just include "Page Number" in your output
  5851.       field declarations.
  5852.  
  5853.       Declare output fields
  5854.          Customers.name : Customers.ACNO : Page Number
  5855.       end
  5856.  
  5857.       You can then use the "Page Number" field in the Page Header or
  5858.       Page Footer section of your output format.
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.  
  5891.  
  5892.  
  5893.  
  5894.  
  5895.  
  5896.  
  5897.  
  5898.  
  5899.                                 - 100 -
  5900. ................................................................................
  5901.       PAUSE ON/OFF           PROCEDURE COMMAND           PAUSE ON/OFF
  5902.  
  5903.       When an Easy Base procedure has an output to the screen, the
  5904.       output, by default scrolls continuously until the procedure is
  5905.       complete. You can allow the user to pause the output with the
  5906.       "Pause On" and "AutoPause On" commands.
  5907.  
  5908.       If a procedure performs several tasks then the pause facility
  5909.       can be selectively enabled and disabled at any point.
  5910.  
  5911.       Ex.
  5912.  
  5913.       for employees alias types with type in order unique
  5914.          pause off:escape off
  5915.          for employees alias group with type = types.type
  5916.             subindex surname
  5917.          next
  5918.          pause on
  5919.          for employees with subindex in order
  5920.             print list items
  5921.          next
  5922.       next
  5923.  
  5924.       The above code fragment prints employees details in type groups
  5925.       with surname in alphabetic order. During the procedure the user
  5926.       can pause the report while it is listing the output but not
  5927.       while it is subindexing the group.
  5928.  
  5929.       If you set pausing with "Pause On" then the user can pause the
  5930.       output at any point by pressing the return key. If you set
  5931.       pausing with "Autopause On" then the output stops after each
  5932.       screen page of output.
  5933.  
  5934.       If you set "Autopause On" and "Escape On" then the first press
  5935.       of the Escape key cancels the autopausing and the second press
  5936.       terminates the output.
  5937.  
  5938.       "Pause Off" cancels either.
  5939.  
  5940.       If a procedure has pausing set by "Autopause On" and its output
  5941.       is directed to the printer, Easy Base automatically switches to
  5942.       "Pause On"
  5943.  
  5944.       See also: Escape On/Off
  5945.  
  5946.  
  5947.  
  5948.  
  5949.  
  5950.  
  5951.  
  5952.  
  5953.  
  5954.  
  5955.  
  5956.                                 - 101 -
  5957. ................................................................................
  5958.       PI                       SYSTEM VALUE                        PI
  5959.  
  5960.       You can use the value of π anywhere in field derivations or
  5961.       procedure code by quoting "Pi".
  5962.  
  5963.       Ex     circlearea = Pi / 4 diam^2
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989.  
  5990.  
  5991.  
  5992.  
  5993.  
  5994.  
  5995.  
  5996.  
  5997.  
  5998.  
  5999.  
  6000.  
  6001.  
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.                                 - 102 -
  6014. ................................................................................
  6015.       PRESELECT              PROCEDURE COMMAND              PRESELECT
  6016.  
  6017.       The "Preselect" command sets highlighting of the next user menu
  6018.       when the procedure terminates.  If a procedure is normally
  6019.       followed by a particular selection from the menu then you can
  6020.       save the user the trouble of choosing it by issuing the
  6021.       "Preselect" command within the procedure.
  6022.  
  6023.       for currentcustomer
  6024.          currentcustomer.acno = input.acno
  6025.          update record
  6026.       next
  6027.       preselect 4
  6028.  
  6029.       The parameter cannot be supplied as a variable.
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.                                 - 103 -
  6071. ................................................................................
  6072.       PRINT                  PROCEDURE COMMAND                  PRINT
  6073.  
  6074.       In Easy Base procedures, all output to the screen or printer is
  6075.       initiated with the "Print" command. The "Print" command prints
  6076.       sections from the procedures output format.
  6077.  
  6078.       Ex.
  6079.  
  6080.       '......................procedure code....
  6081.       Print report header
  6082.       for customers
  6083.          print list items
  6084.       next
  6085.       print report footer
  6086.       '......................Output Format.......
  6087.       .Report Header
  6088.             ════════════════════════════════════════════════
  6089.                           Customer List
  6090.             ════════════════════════════════════════════════
  6091.       .List Items
  6092.             {customers.name field}  {customers.phone field}
  6093.       .Report Footer
  6094.             ════════════════════════════════════════════════
  6095.       .end
  6096.  
  6097.       The format sections are marked with a full stop in the margin
  6098.       followed by the section name. When you type a full stop in the
  6099.       margin of the "Format editor" Easy Base will offer you a
  6100.       selection of section names. You do not have to use these - they
  6101.       are just some common names that can save you time. To enter
  6102.       your own section names just press escape and type in any name
  6103.       you wish.
  6104.  
  6105.       The ".end" section is not strictly necessary but it is easy to
  6106.       accidentally insert blank lines at the end of your format. By
  6107.       inserting ".end" at the end of the last section you will
  6108.       prevent these from being printed.
  6109.  
  6110.       See Also: For..Next with "Selected in browse" qualification.
  6111.  
  6112.  
  6113.  
  6114.  
  6115.  
  6116.  
  6117.  
  6118.  
  6119.  
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.                                 - 104 -
  6128. ................................................................................
  6129.       PRINTER CONTROL        PROCEDURE COMMAND        PRINTER CONTROL
  6130.  
  6131.       When you send a procedure output to the printer Easy Base will
  6132.       initialize your printer at ten characters per inch, six lines
  6133.       per inch in draft mode.
  6134.  
  6135.       You can alter the printer mode anywhere within a procedure with
  6136.       the following printer controls.
  6137.  
  6138.       Bold On            Bold Off
  6139.       Underline On       Underline Off  (Underlines field contents)
  6140.       Italic On          Italic Off
  6141.       NLQ On             NLQ Off
  6142.  
  6143.       8 lpi      Sets printing to eight lines per inch
  6144.       6 lpi      Sets printing to six lines per inch
  6145.       10 cpi     Sets printing to ten characters per inch
  6146.       12 cpi     Sets printing to twelve characters per inch
  6147.       17 cpi     sets printing to either 15 or 17 depending on
  6148.                  printer
  6149.       Line Feed  Advances the print head one line
  6150.       Page Feed  Ejects the current page.
  6151.       Landscape  Prints in landscape ( HP DeskJet/LaserJet only )
  6152.  
  6153.       Ex.
  6154.       NLQ On
  6155.       Bold on
  6156.       Print report header
  6157.       Bold Off
  6158.       12 CPI
  6159.       For customers
  6160.          print list items
  6161.          if bottom margin < 1.5 then
  6162.             Line feed : Bold On : 10 CPI
  6163.             Print Page footer
  6164.             Page feed
  6165.             Print Page header
  6166.             Bold Off : 12 CPI
  6167.          end if
  6168.       next
  6169.       Bold on:Italic On :10 CPI
  6170.       print report footer
  6171.  
  6172.  
  6173.       The above example turns Near Letter Quality printing on for the
  6174.       entire report. It prints page headers and footers in bold at 10
  6175.       characters per inch, list items at 12 characters per inch and
  6176.       the report footer in bold italics.
  6177.  
  6178.       See Also:  For..Next with "Selected in Browse" qualification.
  6179.  
  6180.  
  6181.  
  6182.  
  6183.  
  6184.                                 - 105 -
  6185. ................................................................................
  6186.       Prog_Dir                 System Value                  Prog_Dir
  6187.  
  6188.       Whenever you run a procedure in Easy Base the drive and
  6189.       directory of the program files is available in the system value
  6190.       Prog_Dir.
  6191.  
  6192.       If you write applications for resale on the Easy Base Runtime
  6193.       module then you will not necessarily know the name of the
  6194.       directory to which the end user has installed your application.
  6195.       If your application opens external files you can ensure that
  6196.       they are in the Application directory by using Prog_Dir.
  6197.  
  6198.  
  6199.       declare variables
  6200.          pathfile as text
  6201.       end
  6202.       pathfile = jointext(Prog_Dir,"\NAMES.TXT")
  6203.       open pathfile
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.  
  6237.  
  6238.  
  6239.  
  6240.  
  6241.                                 - 106 -
  6242. ................................................................................
  6243.       PROPER                     FUNCTION                      PROPER
  6244.  
  6245.       This function returns the parameter with the first letter of
  6246.       each word in upper case and the rest in lower case. If you wish
  6247.       to enter initials in a field derived as proper and keep them in
  6248.       upper case then there must either be a space or a full stop
  6249.       between them.
  6250.  
  6251.       Ex.     Proper(Address)
  6252.  
  6253.       Ex.
  6254.  
  6255.       labelname = upper(company.name)
  6256.       insetname = proper(company.name)
  6257.  
  6258.  
  6259.       Acceptable parameters:
  6260.  
  6261.       Quoted text
  6262.       Text field/variable
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.  
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.  
  6278.  
  6279.  
  6280.  
  6281.  
  6282.  
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.  
  6295.  
  6296.  
  6297.  
  6298.                                 - 107 -
  6299. ................................................................................
  6300.       RANDOM                     FUNCTION                      RANDOM
  6301.  
  6302.       This function returns a random number between the upper and
  6303.       lower parameters.
  6304.  
  6305.       Ex.  Random(1,100)
  6306.          <Returns a random number between 1 and 100>
  6307.  
  6308.       Ex.  The two fields No and card simulate the random cutting of
  6309.       a deck of cards each time the No field is cleared.
  6310.  
  6311.       No field derivation:-
  6312.           if(no <> blank,no,random(1,52))
  6313.  
  6314.       Card field derivation:-
  6315.  
  6316.           jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  6317.       mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  6318.       " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  6319.       ,"Spades"))
  6320.  
  6321.  
  6322.       Acceptable parameters
  6323.  
  6324.       Numeric Value
  6325.       Numeric expression
  6326.       Numeric field/variable
  6327.       Any other function which returns a numeric value
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.  
  6346.  
  6347.  
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353.  
  6354.  
  6355.                                 - 108 -
  6356. ................................................................................
  6357.       Read                     File Command                      Read
  6358.  
  6359.       The "Read" command reads data from a non Easy Base file which
  6360.       has been opened with the "Open" command.
  6361.  
  6362.       The syntax is:
  6363.       Read (Length) to (Field or variable)
  6364.  
  6365.       Length can be absolute, a variable or field or the keyword
  6366.       "Line".
  6367.  
  6368.       Ex.
  6369.  
  6370.       Read 45 to Keyvar
  6371.       Read GetLen to customers.name
  6372.       Read Line to Linestring
  6373.  
  6374.       In the "Line" example Easy Base reads from the current File_pos
  6375.       to the end of the current ASCII line.
  6376.  
  6377.       See also: Open, Close, Seek, Write, Find, Erase
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385.  
  6386.  
  6387.  
  6388.  
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394.  
  6395.  
  6396.  
  6397.  
  6398.  
  6399.  
  6400.  
  6401.  
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.  
  6410.  
  6411.  
  6412.                                 - 109 -
  6413. ................................................................................
  6414.       REBUILD DIRECTORIES        UTILITY          REBUILD DIRECTORIES
  6415.  
  6416.       In Easy Base, all DOS file handling is taken care of for you in
  6417.       the background. To do this Easy Base maintains three
  6418.       "Directory" files in which the names which you give to forms,
  6419.       procedures and choice field lists are linked to the actual DOS
  6420.       filenames.
  6421.  
  6422.       The three files are :-
  6423.  
  6424.       BASE.DIR     The forms directory
  6425.       PROC.DIR     The procedures directory
  6426.       CHOICES.DIR  The choice list directory
  6427.  
  6428.       Because these are key files, Easy Base includes a utility which
  6429.       will rebuild them in the event of accidental erasure or
  6430.       corruption.
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.                                 - 110 -
  6470. ................................................................................
  6471.       Recall Input Screen    Procedure Command    Recall Input Screen
  6472.  
  6473.       The Recall Input Screen command, available in network versions
  6474.       only, is used to return to the input screen when an error is
  6475.       detected after a procedure starts. Such errors are invariably
  6476.       caused by multiple work stations running the same procedure at
  6477.       the same time. A typical example would be when a procedure
  6478.       enters a record to a form and one of the fields has to be
  6479.       unique. If two work stations enter the same value for the
  6480.       unique field on their input screens, the error cannot be
  6481.       detected until the procedure is run. The following procedure
  6482.       code illustrates how a procedure can test to see if another
  6483.       workstation has entered the same value in the name field of the
  6484.       parts form.
  6485.  
  6486.       Declare variables
  6487.          x as number
  6488.       end
  6489.       For parts new record
  6490.          For Parts alias check with name = input.name
  6491.             x = x + 1
  6492.          Next
  6493.          if x > 0 then
  6494.             Beep
  6495.             Display status "This Part Name Has just been taken !"
  6496.             Delay 2000
  6497.             Recall Input Screen
  6498.          end if
  6499.          copy all from input
  6500.       next
  6501.  
  6502.       The Recall Input Screen command automatically preserves all the
  6503.       field data that had been entered on the input screen irrelevant
  6504.       of the screen's F12 setting for "Clear Screen after Running".
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521.  
  6522.  
  6523.  
  6524.  
  6525.  
  6526.                                 - 111 -
  6527. ................................................................................
  6528.       RECORD NUMBER            SYSTEM VALUE             RECORD NUMBER
  6529.  
  6530.       If you derive a field with the formula "record number" it will
  6531.       be filled with the record number at the time of filing or
  6532.       reformatting.  Record number differs from "sequence" in the
  6533.       following way. Each time you derive a field with "sequence" you
  6534.       get the next sequencial number irrespective of whether the form
  6535.       has had records deleted and has been repacked. If a file has
  6536.       had at some time 500 records but now only has 20 the next
  6537.       derivation of "sequence" will be 501 and the next derivation of
  6538.       "record number" will be 21.
  6539.  
  6540.       The main use of "record number" is to renumber a set of records
  6541.       after deletions. To do this just add a new field to the form
  6542.       derived as record number. The field will be filled
  6543.       automatically during the data reformatting process.
  6544.  
  6545.       In procedures a records number is available as a pseudo field.
  6546.  
  6547.       Declare Output Fields
  6548.          Customers.Name
  6549.          Customers.Record number
  6550.       end
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.                                 - 112 -
  6584. ................................................................................
  6585.       REMARK                 PROCEDURE COMMAND                 REMARK
  6586.  
  6587.       You can place remarks anywhere within Easy base procedure code
  6588.       by prefixing them with an apostrophe.
  6589.  
  6590.       Ex.
  6591.  
  6592.       '.................This entire line is a remark.....
  6593.       for pupils with age > 9
  6594.          if grade = "g" then skip record   'exclude g's from count
  6595.          count = count + 1                 'These are remarks
  6596.       next
  6597.       '..............................................
  6598.  
  6599.       All text to the right of the apostrophe is ignored at run time.
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.  
  6624.  
  6625.  
  6626.  
  6627.  
  6628.  
  6629.  
  6630.  
  6631.  
  6632.  
  6633.  
  6634.  
  6635.  
  6636.  
  6637.  
  6638.  
  6639.  
  6640.                                 - 113 -
  6641. ................................................................................
  6642.       Reset Sequence         Procedure Command         Reset Sequence
  6643.  
  6644.       The reset sequence command (Network Versions only) can be used
  6645.       to reset the sequence number for any given form. The following
  6646.       code resets the sequence number for the customers form to 1000.
  6647.  
  6648.       For Customers
  6649.          Customers.Sequence = 1000
  6650.          Reset Sequence
  6651.          Exit For
  6652.       Next
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.  
  6682.  
  6683.  
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689.  
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.                                 - 114 -
  6698. ................................................................................
  6699.       RESTORE                    UTILITY                      RESTORE
  6700.  
  6701.       Easy Base will restore applications or data which it has backed
  6702.       up. You can only restore an application with the "Restore
  6703.       Application" utility called from the utilities menu and you can
  6704.       only restore data-only backups with the "Restore Data" utility
  6705.       called from a user menu.
  6706.  
  6707.  
  6708.       See Also:-  Backup
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.  
  6740.  
  6741.  
  6742.  
  6743.  
  6744.  
  6745.  
  6746.  
  6747.  
  6748.  
  6749.  
  6750.  
  6751.  
  6752.  
  6753.  
  6754.                                 - 115 -
  6755. ................................................................................
  6756.       RETAIL                     FUNCTION                      RETAIL
  6757.  
  6758.       The retail function returns the retail price given the
  6759.       wholesale price and the discount as a percentage of retail.
  6760.  
  6761.       Ex   Retail(cost,discount)
  6762.  
  6763.            < returns 125 if cost = 100 and discount = 20>
  6764.  
  6765.  
  6766.  
  6767.  
  6768.  
  6769.  
  6770.  
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.  
  6811.                                 - 116 -
  6812. ................................................................................
  6813.       RETEST                 DERIVATION PREFIX                 RETEST
  6814.  
  6815.       In Easy Base, fields are derived when a new record is started
  6816.       and when any other field which affects the derivation is
  6817.       changed. You can force a field to be rederived when F2 is
  6818.       pressed by prefixing the derivation with "retest".
  6819.  
  6820.       Suppose you have a field "degrees" in which the user must enter
  6821.       a number between 1 and 360.
  6822.  
  6823.       To prevent him entering an out of range number you could derive
  6824.       the field :-
  6825.  
  6826.       If(degrees<1 or degrees > 360,blank[beepInvalid number of
  6827.       degreesCursor degrees],degrees)
  6828.  
  6829.       The above derivation would prevent the user from filing a
  6830.       record with an out of range number. However, by the time he
  6831.       read the message, his entry would be blanked out. It would be
  6832.       better if the number he had typed could be left in the field so
  6833.       that he could see his error. To do this all you have to do is
  6834.       change "blank" to "degrees" in the above derivation.
  6835.  
  6836.       This however would allow the user ( Should he decide to ignore
  6837.       the message ) to then file the incorrect value. To leave the
  6838.       value in the field and still prevent the user from filing it,
  6839.       use the "retest" prefix.
  6840.  
  6841.       Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  6842.       of degreesCursor degrees],degrees)
  6843.  
  6844.  
  6845.       Note:-
  6846.  
  6847.       1. You can have more than one prefix on any one field
  6848.          derivation provided there is a space between each.
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.  
  6867.  
  6868.                                 - 117 -
  6869. ................................................................................
  6870.       REVERSE                    FUNCTION                     REVERSE
  6871.  
  6872.       The reverse function is used in the creation of compound index
  6873.       fields. What it actually does is alter the characters of the
  6874.       parameter in such a way that an alphabetic listing of a field
  6875.       after reversal will have the reverse order to that of the
  6876.       original characters before using the reverse function.
  6877.  
  6878.       In the example shown for the function "zeropad", had you wished
  6879.       to list the pupils in descending age order there would be no
  6880.       point in using the procedure code:
  6881.  
  6882.       for pupils with unifield in reverse order
  6883.  
  6884.       as this would not only reverse the age grouping but would also
  6885.       reverse the name order.
  6886.  
  6887.       To produce the desired printout use exactly the same procedure
  6888.       but derive "unifield" as:-
  6889.  
  6890.       Jointext(reverse(zeropad(age,2,0)),name)
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.                                 - 118 -
  6926. ................................................................................
  6927.       RIGHTTEXT                  FUNCTION                   RIGHTTEXT
  6928.  
  6929.       This function returns a specified number of characters from the
  6930.       end of a field or variable.
  6931.  
  6932.       Ex    Righttext(name,10)
  6933.  
  6934.  
  6935.       Ex.   Righttext(datetext(system date),4)
  6936.             < returns  1993 , 1994 Etc.>
  6937.  
  6938.  
  6939.       Acceptable parameters:
  6940.  
  6941.       Text field/variable
  6942.       Any function returning a text value
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.  
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979.  
  6980.  
  6981.  
  6982.                                 - 119 -
  6983. ................................................................................
  6984.       ROUND                      FUNCTION                       ROUND
  6985.  
  6986.       There are three rounding functions in Easy base:-
  6987.  
  6988.       Round
  6989.       Roundup
  6990.       Rounddown
  6991.  
  6992.       If a rounding function is called with a single parameter then
  6993.       the return value is the parameter rounded to the nearest
  6994.       integer value.
  6995.  
  6996.       Ex. Round(items/reps)
  6997.          < if items = 9 and reps = 4. 2 is returned >
  6998.  
  6999.       All rounding functions accept a second parameter indicating the
  7000.       number of decimal places (or powers of 10 if negative) to round
  7001.       to.
  7002.  
  7003.       Ex. Rounddown(vaton(net),2)
  7004.          < Rounds down the VAT on field "net" to the nearest penny.
  7005.  
  7006.       Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  7007.           )/100,"th Century")
  7008.  
  7009.         < Returns "20th Century" for all values of years 1900-1999 >
  7010.  
  7011.  
  7012.       Round Produces a default rounding system in which:-
  7013.  
  7014.          2.4 rounds to  2
  7015.          2.5 rounds to  3
  7016.         -2.4 rounds to -2
  7017.         -2.5 rounds to -3
  7018.  
  7019.       In the Roundup and Rounddown functions the direction is sign
  7020.       sensitive:-
  7021.  
  7022.          2.5 roundsup to  3      2.5 roundsdown to  2
  7023.         -2.5 roundsup to -2     -2.5 roundsdown to -3
  7024.  
  7025.       Acceptable parameters:
  7026.  
  7027.       Numeric value
  7028.       Numeric expression
  7029.       Numeric field/variable
  7030.       Any other function which returns a numeric value
  7031.  
  7032.  
  7033.  
  7034.  
  7035.  
  7036.  
  7037.  
  7038.  
  7039.                                 - 120 -
  7040. ................................................................................
  7041.       RUN                      FIELD CONTROL                      RUN
  7042.  
  7043.       The "run" control is used to initiate procedures with input
  7044.       screens without the user having to press F2.
  7045.  
  7046.       Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  7047.             name)[run])
  7048.  
  7049.       In the above example, a procedure which lists customers
  7050.       accounts has an input screen with a single field where the
  7051.       customers name is entered. When the user enters a name the
  7052.       above derivation will test whether or not the entered name is a
  7053.       customer. If the entered name does not exist in the customers
  7054.       file the field will be blanked out but if it does then the
  7055.       procedure will run without the user having to press F2.
  7056.  
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.  
  7070.  
  7071.  
  7072.  
  7073.  
  7074.  
  7075.  
  7076.  
  7077.  
  7078.  
  7079.  
  7080.  
  7081.  
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.                                 - 121 -
  7097. ................................................................................
  7098.       RUN                    PROCEDURE COMMAND                    RUN
  7099.  
  7100.       The "Run" command terminates the current procedure and starts
  7101.       another.
  7102.  
  7103.       The "Run" command can be used to chain procedures similar to
  7104.       placing them on a batch execute menu. Its main use, however, is
  7105.       to branch to other procedures depending on which function key
  7106.       was pressed from the input screen. Procedures can be initiated
  7107.       from their input screens by pressing any of the function keys
  7108.       F2, F4, F5, F7, F8, F9 or F10. The number of the function key
  7109.       which was pressed is returned in the system value "Fun_Key". If
  7110.       the procedure was initiated by the field control [Run] then the
  7111.       Fun_Key value returns 0.
  7112.  
  7113.       Example.
  7114.  
  7115.       If Fun_Key = 7 then Run Import1
  7116.       If Fun_Key = 8 then Run Import2
  7117.       If Fun_key = 2 then
  7118.          for customers with name = input.name
  7119.             print list items
  7120.          next
  7121.       end if
  7122.  
  7123.       If you press F1 after typing "Run" in the procedure code
  7124.       editor, Easy Base will list all your procedure names for you to
  7125.       pick from and ensure correct spelling.
  7126.  
  7127.       The Run command only transfers control to the next procedure
  7128.       when the main procedure is executed from a user menu. When you
  7129.       are developing your procedures in the procedure generator the
  7130.       called procedure cannot be loaded. If the code for a procedure
  7131.       being tested in the procedure generator reaches a "Run"
  7132.       command, the test ends with the message "Run call made to..OK"
  7133.       to let you know that the call will be made when the procedure
  7134.       is run live from a user menu.
  7135.  
  7136.       See also: Fun_Key Disable
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.  
  7151.  
  7152.  
  7153.                                 - 122 -
  7154. ................................................................................
  7155.       SCREEN COLOURS             UTILITY               SCREEN COLOURS
  7156.  
  7157.       The "Screen Colours" utility provides 14 pre defined colour
  7158.       sets including two for "Mono Graphics" cards together with a
  7159.       user defined setup. To change the colours of your system simply
  7160.       select "Screen Colours" from the Utilities menu and select the
  7161.       set you want.
  7162.  
  7163.       The "Screen Colours" utility can also be made available to end
  7164.       users by including Configuration on user menus.
  7165.  
  7166.  
  7167.  
  7168.  
  7169.  
  7170.  
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.  
  7181.  
  7182.  
  7183.  
  7184.  
  7185.  
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.  
  7210.                                 - 123 -
  7211. ................................................................................
  7212.       SECONDS                    FUNCTION                     SECONDS
  7213.  
  7214.       This function returns the seconds number from the time
  7215.       parameter.
  7216.  
  7217.       Ex.    seconds(system time)
  7218.  
  7219.  
  7220.       Acceptable parameters:
  7221.  
  7222.       System time
  7223.       Time field
  7224.       Maketime function
  7225.       Time expression
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.  
  7237.  
  7238.  
  7239.  
  7240.  
  7241.  
  7242.  
  7243.  
  7244.  
  7245.  
  7246.  
  7247.  
  7248.  
  7249.  
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.                                 - 124 -
  7268. ................................................................................
  7269.       Seek                     File Command                      Seek
  7270.  
  7271.       The "Seek" command moves the Read/Write pointer within a non
  7272.       Easy Base file which has been opened with the "Open" Command.
  7273.       The actual position of the pointer at any time is available in
  7274.       the system value File_Pos. The File_Pos value is the pointers
  7275.       current offset in bytes (Numbering the first byte as 1).
  7276.  
  7277.       The Seek Command accepts an actual offset, an offset relative
  7278.       to File_Pos or File_Len or an ASCII line movement.
  7279.  
  7280.       Examples.
  7281.  
  7282.       Seek 245
  7283.       Seek File_Pos + 35
  7284.       Seek File_Len - 20
  7285.       Seek Line_Forward
  7286.       Seek Line_Back
  7287.  
  7288.       You cannot combine an ASCII line movement with an offset -
  7289.       To read ten bytes starting at byte 30 on the next line you need
  7290.       two Seek commands.
  7291.  
  7292.       Seek Line_Forward
  7293.       Seek File_Pos + 29
  7294.       read 10 to Parts.No
  7295.  
  7296.       The line movement Line_Forward always positions the pointer at
  7297.       the start of the next line.
  7298.  
  7299.       The line movement Line_Back moves the pointer to the start of
  7300.       the current line if it is not already there and to the start of
  7301.       the previous line if it is.
  7302.  
  7303.       Some files (Eg. Email) have a non ASCII header followed by
  7304.       ASCII lines for the actual message. You can use Seek
  7305.       Line_Forward within a Do Loop to skip though the non ASCII
  7306.       part. If Line_Forward does not find a Carriage Return and Line
  7307.       Feed sequence within 255 bytes then it leaves the file pointer
  7308.       255 bytes ahead of its last position. There is no corresponding
  7309.       facility in Line_Back. If Line_Back does not find a line feed
  7310.       (or Start of File) within 255 bytes then the file pointer does
  7311.       not move.
  7312.  
  7313.       See also: Open, Close, Read, Write, Find, Erase
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.                                 - 125 -
  7325. ................................................................................
  7326.       SEQUENCE                 SYSTEM VALUE                  SEQUENCE
  7327.  
  7328.       When you create a new form a sequence value is updated each
  7329.       time a record is entered. The "sequence" value starts at 1 and
  7330.       continues to 2 billion irrespective of whether or not records
  7331.       have been deleted from the form. If you derive a field as
  7332.       "sequence" then each new record will have the next sequenced
  7333.       number. Sequence derivations are useful for such things as
  7334.       invoice numbers.
  7335.  
  7336.       A sequence field need not start at one however.
  7337.  
  7338.       Ex.  sequence + 1000 would number the first record 1001
  7339.  
  7340.       The sequence number for any form can be reset in procedure
  7341.       code.
  7342.  
  7343.       For Form
  7344.          Form.Sequence = 1
  7345.          Reset Sequence
  7346.          exit for
  7347.       next
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  
  7380.  
  7381.                                 - 126 -
  7382. ................................................................................
  7383.       SET PAPER LENGTH           UTILITY             SET PAPER LENGTH
  7384.  
  7385.       The "Set Paper Length" utility is accessed from the
  7386.       Configuration item and can also be called from a user menu.
  7387.  
  7388.       There are settings for A3, A4, A5, American Letter and
  7389.       American Legal in both portrait and landscape.
  7390.  
  7391.       When you change the paper length in use then you update
  7392.       pagination for all report outputs.
  7393.  
  7394.       The landscape options are for use in wide carriage printers
  7395.       where the paper can be fed in landscape orientation they do not
  7396.       produce "sideways" printing on narrow carriage printers.
  7397.  
  7398.       If the paper size you use is not one of those listed, select
  7399.       "Other" and you can enter the length and width of your paper
  7400.       manually.
  7401.  
  7402.       The Length is entered in "Lines" ( One Sixths of an inch ) and
  7403.       the width is entered in inches.
  7404.  
  7405.       For example, if your paper is 12 inches by 8.25 inches you
  7406.       would enter the length as 72 and the width as 8.25.
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.                                 - 127 -
  7439. ................................................................................
  7440.       Shell                    File Command                     Shell
  7441.  
  7442.       The "Shell" command executes a DOS command which you supply as
  7443.       the parameter.
  7444.  
  7445.       Shell "DIR C:\WP > C:\EB\DIR.TXT"
  7446.  
  7447.       This writes a directory listing of C:\WP to the file DIR.TXT
  7448.       which you can then open and read from.
  7449.  
  7450.       You can supply the parameter as quoted text, as a variable or
  7451.       field or with a function.
  7452.  
  7453.       Shell Jointext("copy C:\PROGS\",input.directory,"\*.* A:\")
  7454.  
  7455.       In this example a disk vendor can select programs by name on an
  7456.       input screen which looks up the directory in which the program
  7457.       is stored. The procedure then copies all files from that
  7458.       directory to the A: drive.
  7459.  
  7460.       Depending on the procedure you are running, Easy Base uses
  7461.       between 450K and 550K of base memory. You cannot therefore
  7462.       "Shell" to any major program. The main use of "Shell" is to use
  7463.       the DOS copy and Dir commands. You can also shell to a batch
  7464.       file of such commands if you have several tasks to perform.
  7465.  
  7466.       CAUTION
  7467.  
  7468.       The Easy Base Executable file expects to find its support files
  7469.       in the current default directory. If you change drive or
  7470.       directory while shelled out of Easy Base then you must change
  7471.       back before exiting the procedure.
  7472.  
  7473.       If you are writing an application for resale then remember that
  7474.       the end user might not have installed it to C:\EB. Change back
  7475.       to the correct drive and directory by using the system value
  7476.       "Prog_Dir".
  7477.  
  7478.       Declare variables
  7479.          Drive as text : Dir as text
  7480.       end
  7481.       drive = lefttext(prog_dir,2)
  7482.       dir = righttext(prog_dir,lengthtext(prog_dir)-3)
  7483.       shell "Job.Bat"
  7484.       shell drive
  7485.       shell jointext("CD\",dir)
  7486.  
  7487.       When you use "Shell" Easy Base clears the screen and pauses for
  7488.       any DOS error messages. If you know that the command you are
  7489.       about to shell to will not invoke a response from DOS you can
  7490.       add the keyword "Smooth" and Easy Base will not clear the
  7491.       screen or pause.
  7492.  
  7493.       Shell Smooth "DIR C:\FAX > C:\EB\DIR.TXT"
  7494.  
  7495.                                 - 128 -
  7496. ................................................................................
  7497.       Show PickList          PROCEDURE COMMAND          Show PickList
  7498.  
  7499.       In most instances where you select records for displaying,
  7500.       printing or further processing you will be able to select based
  7501.       on a group field or a range of field values. There will however
  7502.       be occasions where you need to select a set of records which
  7503.       are totally unrelated. To do this Easy Base includes a pre
  7504.       defined system form called "PickList". This form has two fields
  7505.       called "Item" and "Mark".  The PickList form is only accessible
  7506.       within procedures. You can process it just like one of your own
  7507.       forms (Except that you cannot "Create Temp as PickList") and
  7508.       you can display it at any point in a procedure with the command
  7509.       "Show PickList". The difference between PickList and any other
  7510.       form is that it displays as a table. The Item field is no entry
  7511.       and the Mark field is a choice field which is either Blank or
  7512.       ASCII 251 ( √ ). After displaying the form you can continue
  7513.       your processing based on the value of the "Mark" field.
  7514.  
  7515.       As an example of the use of the picklist form, suppose that you
  7516.       had a contacts form with names and addresses. There is also a
  7517.       group field which is either Customer, Supplier, or Employee
  7518.       You want to send a circular letter to your Customers - but not
  7519.       all of them - only the ones you know personally. There is no
  7520.       sub grouping for this - you need to actually "Tick off" the
  7521.       ones you require from a list.
  7522.       ..........................................
  7523.       Declare output fields
  7524.          Contacts.Name : Contacts.address : date
  7525.       End
  7526.       For Contacts with Group = "Customer"
  7527.          For PickList new record
  7528.             Picklist.Item = Contacts.Name
  7529.          Next
  7530.       Next
  7531.       Show PickList
  7532.       For Picklist with Mark = Chr$(251)
  7533.          For Contacts with name = Picklist.Item
  7534.             Print Letter
  7535.          Next
  7536.       Next
  7537.       Clear Records from PickList
  7538.       ............................................
  7539.       At the line "Show Picklist" Easy Base will display all your
  7540.       customers names in a table which you can scroll through
  7541.       marking or unmarking the customers to which you wish to print
  7542.       the circular. When you Escape from the PickList form,
  7543.       processing continues in the procedure code, printing the Letter
  7544.       only to those customers which you have "Ticked" ie with the
  7545.       "Mark" field = Chr$(251).
  7546.  
  7547.       PickList is not a temporary form. You can add or delete records
  7548.       in one procedure and show it in another. You must clear records
  7549.       from one usage before the next.
  7550.       Cont.
  7551.  
  7552.                                 - 129 -
  7553. ................................................................................
  7554.       Show PickList          PROCEDURE COMMAND          Show PickList
  7555.  
  7556.       The Item field in Picklist is a text field 80 characters in
  7557.       length. You can show from 1 to 65 characters of this field by
  7558.       stating the length after the command "Show PickList 20" If you
  7559.       do not enter a length the default is 35. There is no problem
  7560.       allocating numeric values to PickList.Item but you cannot show
  7561.       a Time field. You cannot show a date field directly but you can
  7562.       use Picklist for dates if you have a field with the date shown
  7563.       in text derived with the datetext function.
  7564.  
  7565.       For Events with Type = "Committee Meeting"
  7566.          For PickList new record
  7567.             Picklist.Item = Events.Dateastext
  7568.             PickList.Mark = Chr$(251)
  7569.          next
  7570.       Next
  7571.       Show PickList 18
  7572.  
  7573.       In the above example you will see that the "Mark" field is also
  7574.       pre filled. In this case, when the list displays, all the dates
  7575.       will be pre marked.
  7576.  
  7577.       The following keys are active when PickList is displayed.
  7578.  
  7579.       Up Down PgUp PgDn Home End
  7580.  
  7581.       Space     Marks or unmarks individual items
  7582.  
  7583.       F4        Marks or unmarks all items
  7584.  
  7585.       F5        Swaps marked for unmarked
  7586.  
  7587.       F10       Makes a shortlist of marked items only
  7588.  
  7589.       F2        Returns to the procedure code.
  7590.  
  7591.  
  7592.  
  7593.  
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.  
  7600.  
  7601.  
  7602.  
  7603.  
  7604.  
  7605.  
  7606.  
  7607.  
  7608.  
  7609.                                 - 130 -
  7610. ................................................................................
  7611.       SKIP GROUP             PROCEDURE COMMAND             SKIP GROUP
  7612.  
  7613.       The "Skip Group" command excludes an entire group of records
  7614.       from selection by a "For" loop.
  7615.  
  7616.       Ex.
  7617.  
  7618.       for employees with type in order
  7619.          if employees.type = "Part time" then skip group
  7620.          print list items
  7621.       next
  7622.  
  7623.       The "Skip Group" command is not the same as filtering with a
  7624.       "<>" condition.  You could achieve the same result with :-
  7625.  
  7626.       for employees with type in order
  7627.          if employees.type <> "Part time" then
  7628.             print list items
  7629.          end if
  7630.       next
  7631.  
  7632.       but the second procedure would take much longer to run as each
  7633.       part time employee's record would be loaded into memory only to
  7634.       be rejected by the "If" condition.  The first procedure on the
  7635.       other hand only loads a single part time employee's record then
  7636.       skips the entire group by advancing the index pointer in use
  7637.       for record selection.
  7638.  
  7639.       You can also use the "Skip Group" command to terminate
  7640.       selection of a group of records at a given point.
  7641.  
  7642.       declare variables
  7643.          count as number
  7644.       end
  7645.       for employees with type in order
  7646.          count = count + 1
  7647.          if count = 51 then
  7648.             count = 0
  7649.             skip group
  7650.          end if
  7651.          print list items
  7652.       next
  7653.  
  7654.       The above procedure prints the first fifty employees in each
  7655.       "type" group.
  7656.  
  7657.       The "Skip Group" command can be shortened to "Skipgrp"
  7658.  
  7659.       IMPORTANT: The condition for the Skip Group cannot be nested
  7660.       within another "If" condition or "DO LOOP" structure which is
  7661.       itself within the current "For" loop.
  7662.  
  7663.       :- See Skip Record for example.
  7664.  
  7665.  
  7666.                                 - 131 -
  7667. ................................................................................
  7668.       SKIP RECORD            PROCEDURE COMMAND            SKIP RECORD
  7669.  
  7670.       The "Skip Record" command is used to exclude individual records
  7671.       from selection in a "For" Loop.
  7672.  
  7673.       Ex.
  7674.  
  7675.       for employee with worksno in order
  7676.          if employees.worksno = 12 then skip record
  7677.          print list items
  7678.       next
  7679.  
  7680.       The "Skip Record" command has exactly the same effect as
  7681.       filtering with a "<>" condition but is much easier to write if
  7682.       there are many items to exclude
  7683.  
  7684.       for employees with worksno in order
  7685.          if employees.worksno = 12 or employees.worksno = 15 then
  7686.             skip record
  7687.          end if
  7688.          if employees.name = "smith" then skip record
  7689.          if employees.age > 50 then skip record
  7690.       next
  7691.  
  7692.       You can exclude groups of records from an inner loop by
  7693.       applying the "Skip Record" command to a "Unique" outer loop.
  7694.  
  7695.       for employees alias types with type in order unique
  7696.          if types.type = "director" then skip record
  7697.          if types.type = "part time" then skip record
  7698.          for employees with type = types.type
  7699.             print list items
  7700.          next
  7701.       next
  7702.  
  7703.       If you need to exclude groups of records from a single loop you
  7704.       must use the "Skip Group" command.
  7705.  
  7706.       The "Skip Record" command can be shortened to "Skiprec".
  7707.  
  7708.       IMPORTANT:
  7709.  
  7710.       The Skip Record command causes a direct jump to the start of
  7711.       the next iteration of the current "For" loop. The condition
  7712.       for the Skip Record must not be nested within another "If"
  7713.       condition or "Do Loop" structure which is itself within the
  7714.       current For loop.
  7715.  
  7716.       for form
  7717.          if (condition) then
  7718.             if form.type = "Part time" then skip record
  7719.          end if
  7720.       next
  7721.                    This will cause a system error.
  7722.  
  7723.                                 - 132 -
  7724. ................................................................................
  7725.       SPACEPAD                   FUNCTION                    SPACEPAD
  7726.  
  7727.       The Spacepad function pads a text variable to a given length
  7728.       with spaces.
  7729.  
  7730.       Ex.   Spacepad(name,10)
  7731.             < returns "Fred      " if name = "Fred"
  7732.  
  7733.       The spacepad function is used in the creation of compound index
  7734.       fields.
  7735.  
  7736.       For example:    A "Films" form has the fields "title" and
  7737.       "category". To list the films grouped by category in order and
  7738.       with the titles in each category in order create the field
  7739.       "groupindex" as text,long enough to hold both category and
  7740.       title fields and derived as :-
  7741.  
  7742.       Jointext(spacepad(category,15),title)
  7743.                       {15 is length of category field}
  7744.  
  7745.       You can then produce the required printout with the following
  7746.  
  7747.       procedure.
  7748.  
  7749.       ....................format.........................
  7750.  
  7751.       .Report header
  7752.         ═══════════════════════════════════════════════════════════
  7753.                        FILM LIST BY CATEGORY
  7754.         ═══════════════════════════════════════════════════════════
  7755.       .Group header
  7756.         Films in {category field}
  7757.       .List items
  7758.        {title field} Starring {Star field} Running time {length Fld}
  7759.       .end
  7760.  
  7761.       ......................procedure code.................
  7762.       declare output fields
  7763.          films.title:films.star:films.length:films.category
  7764.       end
  7765.       declare variables
  7766.          catcheck as text
  7767.       end
  7768.       '............
  7769.       bold on
  7770.       print report header
  7771.       for films with groupindex in order
  7772.          if films.category <> catcheck then
  7773.             bold on
  7774.             print group header
  7775.             bold off
  7776.          end if
  7777.          print list items
  7778.       next
  7779.  
  7780.                                 - 133 -
  7781. ................................................................................
  7782.       SPELLDAY                   FUNCTION                    SPELLDAY
  7783.  
  7784.       This function spells out the day of the number (1-7) parameter.
  7785.  
  7786.       Ex.   Spellday(dayofweek(system date))
  7787.  
  7788.  
  7789.       Acceptable parameters:
  7790.  
  7791.       Numeric value                              (1-7)
  7792.       Numeric expression evaluating to           (1-7)
  7793.       Numeric Field/variable holding value       (1-7)
  7794.       Any function returning a numeric value     (1-7)
  7795.  
  7796.  
  7797.  
  7798.  
  7799.  
  7800.  
  7801.  
  7802.  
  7803.  
  7804.  
  7805.  
  7806.  
  7807.  
  7808.  
  7809.  
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.  
  7819.  
  7820.  
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.                                 - 134 -
  7838. ................................................................................
  7839.       SPELLMONTH                 FUNCTION                  SPELLMONTH
  7840.  
  7841.       This function spells out the day of the number (1-12)
  7842.       parameter.
  7843.  
  7844.  
  7845.       Ex.   Spellmonth(month(system date))
  7846.  
  7847.       Ex.   Month = Spellmonth(month(invoices.date))
  7848.  
  7849.  
  7850.       Acceptable parameters:
  7851.  
  7852.       Numeric value                           (1-12)
  7853.       Numeric expression evaluating to        (1-12)
  7854.       Numeric Field/variable holding value    (1-12)
  7855.       Any function returning a numeric value  (1-12)
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.  
  7862.  
  7863.  
  7864.  
  7865.  
  7866.  
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.  
  7875.  
  7876.  
  7877.  
  7878.  
  7879.  
  7880.  
  7881.  
  7882.  
  7883.  
  7884.  
  7885.  
  7886.  
  7887.  
  7888.  
  7889.  
  7890.  
  7891.  
  7892.  
  7893.  
  7894.                                 - 135 -
  7895. ................................................................................
  7896.       START HERE             DERIVATION PREFIX             START HERE
  7897.  
  7898.       If, in a form or procedure input screen, you want the cursor to
  7899.       start in other than the top left field then derive the field in
  7900.       which you wish the cursor to start with "Start here" .
  7901.  
  7902.       If the field in which the cursor is to start already has a
  7903.       derivation then simply prefix the derivation with "Start here".
  7904.  
  7905.       Ex.
  7906.  
  7907.       start here Lookup(customers,name)
  7908.  
  7909.  
  7910.  
  7911.       1. You can have more than one prefix on any one field
  7912.          derivation provided there is a space between each.
  7913.  
  7914.  
  7915.  
  7916.  
  7917.  
  7918.  
  7919.  
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.  
  7931.  
  7932.  
  7933.  
  7934.  
  7935.  
  7936.  
  7937.  
  7938.  
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.                                 - 136 -
  7952. ................................................................................
  7953.       STRINGOF                   FUNCTION                    STRINGOF
  7954.  
  7955.       This function returns a string of characters.
  7956.  
  7957.       Ex.   Stringof(12,"-")
  7958.              < Returns "------------">
  7959.  
  7960.  
  7961.       Ex.  Stringof(5,chr$(240))
  7962.             < Returns "≡≡≡≡≡">
  7963.  
  7964.  
  7965.       One of the most useful applications of the "Stringof" function
  7966.       is to pad output fields in tabular reports with "." characters.
  7967.  
  7968.       Ex.
  7969.  
  7970.       Declare output fields
  7971.          stock.name : stock.price
  7972.       end
  7973.       for stock with name in order
  7974.          stock.name = jointext(stock.name,stringof(30-lengthtext(
  7975.                       stock.name),".")
  7976.          print list items
  7977.       next
  7978.  
  7979.  
  7980.       The printed output from the above report would be in the form:-
  7981.  
  7982.             Gizmo.........................  2.50
  7983.             Sprocket......................  9.95
  7984.             Widget........................  3.10
  7985.  
  7986.  
  7987.  
  7988.       Acceptable parameters:
  7989.  
  7990.       1   Any numeric field, variable, expression or function
  7991.       2   Single quoted character - Function returning a single
  7992.           character
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.  
  7999.  
  8000.  
  8001.  
  8002.  
  8003.  
  8004.  
  8005.  
  8006.  
  8007.  
  8008.                                 - 137 -
  8009. ................................................................................
  8010.       SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  8011.  
  8012.       The command Subindex is used to create an index file which
  8013.       contains only a subset of the records in a form.
  8014.  
  8015.       Subset indices are used in reports to output records in the
  8016.       order of one field when they have been selected using the index
  8017.       file on another field. For example, if you wish to list all the
  8018.       employees who work at the "Manchester" branch with their
  8019.       surnames in order you need to select the records using the
  8020.       index on the "Branch" field but you need to list them using an
  8021.       index on the "Surname" field. Since you can only use one index
  8022.       at a time you need to create an index on "Surname" which only
  8023.       contains the records which have "Manchester" as the branch.
  8024.  
  8025.       For Employees with branch = "Manchester"
  8026.          Subindex surname as #1
  8027.       next
  8028.       for Employees with subindex 1 in order
  8029.          print list items
  8030.       next
  8031.  
  8032.       You can have up to nine subset indices in any one procedure and
  8033.       you can select subsets from subsets. For example, if, in the
  8034.       employees list you only wished to list female employees whose
  8035.       salary was greater than 50,000 you would use:-
  8036.  
  8037.       For Employees with branch = "Manchester"
  8038.          Subindex sex as #1
  8039.       next
  8040.       For Employees with subindex 1 = "Female"
  8041.          Subindex salary as #2
  8042.       next
  8043.       For Employees with subindex 2 > 50000
  8044.          Subindex surname as #3
  8045.       next
  8046.       for Employees with subindex 3 in order
  8047.          Print List Items
  8048.       next
  8049.  
  8050.       Subset indices are temporary files. You cannot use a subset
  8051.       index in one procedure that was created in another.
  8052.  
  8053.       Within one procedure, however, you can use a subset index
  8054.       almost as if it were a form. You can add records to it as often
  8055.       as you wish before using it and you can erase its contents with
  8056.       the "Clear records from" command.
  8057.  
  8058.       Clear records from subindex 1
  8059.  
  8060.       This allows you to build subsets with multiple selections eg.
  8061.       Employees with branch = "Manchester" or branch = "Birmingham"
  8062.       and to reuse a subset index in a nested loop eg. Employees
  8063.       grouped by branch in surname order.
  8064.  
  8065.                                 - 138 -
  8066. ................................................................................
  8067.       SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  8068.  
  8069.       Example of multiple selections:
  8070.  
  8071.       For Employees with branch = "Manchester"
  8072.          Subindex surname as #1
  8073.       next
  8074.       For Employees with branch = "Birmingham"
  8075.          Subindex surname as #1
  8076.       next
  8077.       For Employees with subindex 1 in order
  8078.          Print List Items
  8079.       next
  8080.  
  8081.       Example of nested subset:
  8082.  
  8083.       For Branches with name in order
  8084.          Print group header
  8085.          For Employees with branch = branches.name
  8086.             Subindex surname as #1
  8087.          next
  8088.          For Employees with subindex 1 in order
  8089.             Print List Items
  8090.          next
  8091.          Print group footer
  8092.          Clear records from subindex 1
  8093.       next
  8094.  
  8095.       In the first example, the records with branch = "Birmingham"
  8096.       are added to those with branch = "Manchester" and both are
  8097.       listed as a single subset.
  8098.  
  8099.       In the second example each individual branch subset is printed
  8100.       and then erased ready for the next.
  8101.  
  8102.       Whenever Easy Base is writing to a subset index the "Running"
  8103.       flash on the upper status line is replaced with "Sorting".
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.  
  8117.  
  8118.  
  8119.  
  8120.  
  8121.  
  8122.                                 - 139 -
  8123. ................................................................................
  8124.       SYSTEM DATE              SYSTEM VALUE               SYSTEM DATE
  8125.  
  8126.       You can use your computers inbuilt date anywhere in field
  8127.       derivations or procedure code by simply quoting "system date".
  8128.  
  8129.       Ex.
  8130.  
  8131.       for diary with date = system date
  8132.          print list items
  8133.       next
  8134.  
  8135.  
  8136.  
  8137.  
  8138.  
  8139.  
  8140.  
  8141.  
  8142.  
  8143.  
  8144.  
  8145.  
  8146.  
  8147.  
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.  
  8154.  
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160.  
  8161.  
  8162.  
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179.                                 - 140 -
  8180. ................................................................................
  8181.       SYSTEM TIME              SYSTEM VALUE               SYSTEM TIME
  8182.  
  8183.       You can use your computers inbuilt time anywhere in field
  8184.       derivations or procedure code by simply quoting "system time".
  8185.  
  8186.       Ex.
  8187.  
  8188.       for stockitems with stockno = input.stockno
  8189.          lastcheckeddate = system date
  8190.          lastcheckedtime = system time
  8191.          update record
  8192.       next
  8193.  
  8194.  
  8195.  
  8196.  
  8197.  
  8198.  
  8199.  
  8200.  
  8201.  
  8202.  
  8203.  
  8204.  
  8205.  
  8206.  
  8207.  
  8208.  
  8209.  
  8210.  
  8211.  
  8212.  
  8213.  
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234.  
  8235.  
  8236.                                 - 141 -
  8237. ................................................................................
  8238.       TEXT                      FIELD TYPE                       TEXT
  8239.  
  8240.       The text field type can be up to 80 characters long.
  8241.  
  8242.       Cut copy and paste operations are available between all text,
  8243.       and textblock fields :
  8244.  
  8245.       Use Shift plus the arrow keys to mark the text you wish to cut
  8246.       or copy. When you release the keys the cut or copy choice will
  8247.       appear.
  8248.  
  8249.       To paste cut text position the cursor where you want it
  8250.       inserted and press Shift plus Ins.
  8251.  
  8252.       Spell Checking is also available in text fields -
  8253.          Press Ctrl + S
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.  
  8267.  
  8268.  
  8269.  
  8270.  
  8271.  
  8272.  
  8273.  
  8274.  
  8275.  
  8276.  
  8277.  
  8278.  
  8279.  
  8280.  
  8281.  
  8282.  
  8283.  
  8284.  
  8285.  
  8286.  
  8287.  
  8288.  
  8289.  
  8290.  
  8291.  
  8292.  
  8293.                                 - 142 -
  8294. ................................................................................
  8295.       TEXT BLOCK                FIELD TYPE                 TEXT BLOCK
  8296.  
  8297.       When you Define a field with the field type "Text Block" then
  8298.       instead of entering a field length you shade out the area which
  8299.       you wish the field to cover using the arrow keys.
  8300.  
  8301.       Textblock fields offer many of the facilities of a
  8302.       wordprocessor including cut and paste, wordwrap and spell
  8303.       checking.
  8304.  
  8305.       Useful widths for A4 and Letter size paper are 63 characters if
  8306.       you intend to print at 10 characters per inch and 75 characters
  8307.       if you intend to print at 12 characters per inch. This document
  8308.       for instance was created in 63 character wide text blocks.
  8309.  
  8310.       The maximum width of a text block field on screen is 80
  8311.       characters. You can however redefine it up to 230 characters
  8312.       wide in procedure printouts and Easy Base will reformat your
  8313.       paragraphs to the new width.
  8314.  
  8315.       A text block field is not a "memo" field. It can be indexed and
  8316.       derived.
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.  
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.  
  8350.                                 - 143 -
  8351. ................................................................................
  8352.       TIME                      FIELD TYPE                       TIME
  8353.  
  8354.       The Easy Base "time" field has the eight character format:-
  8355.  
  8356.       11:20:20    (Hours:Minutes:Seconds)
  8357.  
  8358.       You can record time data in any format you wish by using a
  8359.       "Formatted Text" field but you must use a "Time" field if you
  8360.       wish to perform addition and subtraction operations on time
  8361.       values.  (in seconds)
  8362.  
  8363.       Time fields are automatically checked for validity.
  8364.  
  8365.  
  8366.       See Also:-  Maketime
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381.  
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.  
  8390.  
  8391.  
  8392.  
  8393.  
  8394.  
  8395.  
  8396.  
  8397.  
  8398.  
  8399.  
  8400.  
  8401.  
  8402.  
  8403.  
  8404.  
  8405.  
  8406.  
  8407.                                 - 144 -
  8408. ................................................................................
  8409.       TIMEAMPM                   FUNCTION                    TIMEAMPM
  8410.  
  8411.       This function returns the hour ( 0 - 12) plus am. or pm. from
  8412.       the time field parameter.
  8413.  
  8414.       Ex. Timeampm(system time)
  8415.  
  8416.       Ex.
  8417.       -------------------------format----------------------------
  8418.       .Report header
  8419.                      Appointments for {Apps.Date Field}
  8420.       .List items
  8421.                 {Apps.Name Field      }   at  {Time Field}
  8422.       .End
  8423.       -------------------------code----------------------------
  8424.       declare output fields
  8425.          Apps.name
  8426.          Apps.date
  8427.          Time
  8428.       end
  8429.       print report header
  8430.       for apps with date = system date
  8431.          time = timeampm(apps.time)
  8432.          print list items
  8433.       next
  8434.  
  8435.  
  8436.       Acceptable parameters:
  8437.  
  8438.       System time
  8439.       Time field
  8440.       Maketime function
  8441.       Time expression
  8442.  
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.  
  8456.  
  8457.  
  8458.  
  8459.  
  8460.  
  8461.  
  8462.  
  8463.  
  8464.                                 - 145 -
  8465. ................................................................................
  8466.       TOTAL COPIES             SYSTEM VALUE              TOTAL COPIES
  8467.  
  8468.       Whenever a procedure enters a "FOR" loop qualified by "With
  8469.       fieldname = " the total number of records which match the
  8470.       qualification value is available in the system value
  8471.       "Total Copies"
  8472.  
  8473.       Total Copies is extracted directly from the index file and
  8474.       relieves you of a time consuming loop all the way through a
  8475.       form updating a counter.
  8476.  
  8477.       In other words:-
  8478.  
  8479.       for books with category = "fiction"
  8480.          count = count + 1
  8481.       next
  8482.  
  8483.       can be replaced with:-
  8484.  
  8485.       for books with category = "fiction"
  8486.          count = total copies
  8487.          exit for
  8488.       next
  8489.  
  8490.       Unlike "Total Records" the "Total Copies" value never includes
  8491.       records marked for deletion.
  8492.  
  8493.       NETWORK VERSIONS
  8494.  
  8495.       With the release of Network V1 the Total Copies system value
  8496.       has been replaced with a pseudo field Form.Total Copies.
  8497.  
  8498.  
  8499.  
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.  
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.  
  8520.  
  8521.                                 - 146 -
  8522. ................................................................................
  8523.       TOTAL RECORDS            SYSTEM VALUE             TOTAL RECORDS
  8524.  
  8525.       Whenever a procedure enters a "FOR" loop the total number of
  8526.       records in the form is available in the system value
  8527.       "Total records"
  8528.  
  8529.       Ex.
  8530.       The following code fragment updates a "Customer summary" form
  8531.       with the total number of customers in the "Customers" form.
  8532.  
  8533.       declare variables
  8534.         tot as number
  8535.       end
  8536.       for customers with acno = 1
  8537.          tot = total records
  8538.          exit for
  8539.       next
  8540.       for customersummary
  8541.          customersummary.totalcustomers = tot
  8542.          update record
  8543.       next
  8544.  
  8545.       Caution.
  8546.  
  8547.       Provided that the "For" loop is qualified by a "with" statement
  8548.       then the "Total Records" value is extracted directly from the
  8549.       open index file and is the total number of "Live Records".
  8550.  
  8551.       If you access the "Total records" value in an unqualified "For"
  8552.       loop then there is no index file open and the "Total Records"
  8553.       value is derived by dividing the forms file length by the
  8554.       record length. It therefore represents the total number of
  8555.       records in the form "Live" and "Deleted".
  8556.  
  8557.       NETWORK VERSIONS
  8558.  
  8559.       From the release of Network V1 the Total records value has been
  8560.       replaced by a pseudo field Form.Total Records.
  8561.  
  8562.       for customers with acno = 1
  8563.          for customersummary
  8564.             customersummary.totalcustomers = customers.total records
  8565.          next
  8566.          exit for
  8567.       next
  8568.  
  8569.  
  8570.  
  8571.  
  8572.  
  8573.  
  8574.  
  8575.  
  8576.  
  8577.  
  8578.                                 - 147 -
  8579. ................................................................................
  8580.       UPDATE RECORD          PROCEDURE COMMAND          UPDATE RECORD
  8581.  
  8582.       The "Update record" command is used to alter the contents of
  8583.       one or many records in a form.
  8584.  
  8585.       Ex.
  8586.  
  8587.       for stock with item = input.item
  8588.          stock.price = input.price
  8589.          stock.pricechangedate = system date
  8590.          update record
  8591.       next
  8592.  
  8593.       This example changes the price of a single "Stock" item.
  8594.  
  8595.  
  8596.       for employees with taxcode = input.oldtaxcode
  8597.          employees.taxcode = input.newtaxcode
  8598.          update record
  8599.       next
  8600.  
  8601.       This example changes the taxcode field of all the employees
  8602.       whose present taxcode is the same as the input screen
  8603.       "oldtaxcode" to the input screen "newtaxcode".
  8604.  
  8605.  
  8606.       for employees
  8607.          employees.taxcode = employees.taxcode + 60
  8608.          update record
  8609.       next
  8610.  
  8611.       This example increases the taxcode of all employees by sixty.
  8612.  
  8613.  
  8614.  
  8615.  
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.  
  8632.  
  8633.  
  8634.  
  8635.                                 - 148 -
  8636. ................................................................................
  8637.       UPPER                      FUNCTION                       UPPER
  8638.  
  8639.       Returns the Uppercase of a text field or variable.
  8640.  
  8641.       Ex.  Upper(postcode)
  8642.            < shows the postcode field in uppercase>
  8643.  
  8644.       Ex.
  8645.       '.......................
  8646.       declare output fields
  8647.          labelname
  8648.          labeladdress
  8649.          labelcode
  8650.       end
  8651.       for customers with maillist = "yes"
  8652.          Labelname = Upper(customers.name)
  8653.          Labeladdress = Upper(customers.address)
  8654.          Labelcode = customers.postcode
  8655.          print labels
  8656.       next
  8657.  
  8658.       Acceptable parameters:
  8659.  
  8660.       Quoted text
  8661.       Text field/variable
  8662.  
  8663.  
  8664.  
  8665.  
  8666.  
  8667.  
  8668.  
  8669.  
  8670.  
  8671.  
  8672.  
  8673.  
  8674.  
  8675.  
  8676.  
  8677.  
  8678.  
  8679.  
  8680.  
  8681.  
  8682.  
  8683.  
  8684.  
  8685.  
  8686.  
  8687.  
  8688.  
  8689.  
  8690.  
  8691.  
  8692.                                 - 149 -
  8693. ................................................................................
  8694.       V.A.T. FUNCTIONS           FUNCTION            V.A.T. FUNCTIONS
  8695.  
  8696.       Easy Base has a set of five VAT rates which can be altered from
  8697.       the utilities menu. There are four VAT functions:-
  8698.          VATin
  8699.          VATon
  8700.          PlusVAT
  8701.          MinusVAT
  8702.  
  8703.       Ex.   VATin(retailprice,2)
  8704.              < Returns the VAT content of "retailprice" at VAT rate 2
  8705.  
  8706.       Ex.   VATon(netprice,4)
  8707.             < Returns the VAT to be added to "netprice" at VAT rate 4
  8708.  
  8709.       Ex.   PlusVAT(netprice,3)
  8710.             < Returns the VAT inclusive price at VAT rate 3>
  8711.  
  8712.       Ex.   MinusVAT(retailprice,2)
  8713.             < Returns the net price of "retailprice" before VAT at
  8714.               VAT rate 2>
  8715.  
  8716.        (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  8717.  
  8718.       If the second parameter (rate) is omitted from any of the VAT
  8719.       functions then Rate 1 is assumed.
  8720.  
  8721.       Ex.   Gross = PlusVAT(input.net)
  8722.             < The variable "Gross" = the VAT inclusive of the input
  8723.              screen field "net" calculated at rate 1.>
  8724.  
  8725.       Although the VAT functions are primarily included for business
  8726.       applications, they can be used for any purpose where a
  8727.       percentage needs to be changed globally throughout an
  8728.       application without the need to alter each procedure or field
  8729.       derivation in which it is used.
  8730.  
  8731.       Acceptable parameters:
  8732.  
  8733.       1   Any numeric value, field, variable, expression or function
  8734.       2   As Parameter 1 but evaluating between 1 an 5
  8735.  
  8736.  
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.                                 - 150 -
  8750. ................................................................................
  8751.       Write                    File Command                     Write
  8752.  
  8753.       The "Write" command writes data to a non Easy Base file which
  8754.       has been opened with the "Open" command.
  8755.  
  8756.       The Syntax is:
  8757.  
  8758.       Write (Text, Variable, Field or Function) [Line_len (length)]
  8759.  
  8760.       The Line_Len keyword and parameter are not required.
  8761.  
  8762.       Ex.
  8763.  
  8764.       Write "Once upon a time"
  8765.       Write LineVar
  8766.       Write Customers.name
  8767.       Write Jointext(customers.forname," ",customers.surname)
  8768.       Write Customers.notes line_len 60
  8769.  
  8770.       Notes:-
  8771.  
  8772.       The contents of a text field is supplied without leading or
  8773.       trailing spaces. The contents of a text variable is supplied
  8774.       without trailing spaces. You can pad the output with either of
  8775.       the functions "Spacepad" or "stringof".
  8776.  
  8777.       The following code writes customers names and account Nos in
  8778.       two columns to an ASCII file.
  8779.  
  8780.       Open "C:\WP\NAMES.TXT"
  8781.       for customers with name in order
  8782.          write stringof(5,chr$(32))
  8783.          write spacepad(customers.name,30)
  8784.          write customers.acno
  8785.          write chr$(13)
  8786.          write chr$(10)
  8787.       next
  8788.  
  8789.       The contents of a text block field is supplied reformatable ie
  8790.       a single CHR$(13) is used to denote where a new line is to be
  8791.       forced. If you write a text block field without the Line_len
  8792.       keyword it will be written in this format.
  8793.  
  8794.       To write a text block field as ASCII Lines use the Line_Len
  8795.       keyword. The Line_Len value does not have to be the same as the
  8796.       width of the text block field. Easy Base will word wrap the
  8797.       contents to whatever Lin_Len value you supply.
  8798.  
  8799.       You cannot write quotation marks within quoted text.
  8800.       To write "Fred said "@*!" to Bill" you must replace the inner
  8801.       quotation marks with ASCII character 127. (Hold down the Alt
  8802.       key and type 127 on the numeric keypad)
  8803.  
  8804.       See also: Open, Close, Read, Seek, Find
  8805.  
  8806.                                 - 151 -
  8807. ................................................................................
  8808.       YEAR                       FUNCTION                        YEAR
  8809.  
  8810.       This function returns the year number from a date parameter.
  8811.  
  8812.       Ex.    Year(system date)
  8813.  
  8814.       Ex.
  8815.  
  8816.       Carage = jointext((year(system date)-year(registered))," Years
  8817.       old")
  8818.  
  8819.  
  8820.       Acceptable parameters:
  8821.  
  8822.       System date
  8823.       Date field
  8824.       Makedate function
  8825.       Date expression
  8826.  
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.  
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.  
  8850.  
  8851.  
  8852.  
  8853.  
  8854.  
  8855.  
  8856.  
  8857.  
  8858.  
  8859.  
  8860.  
  8861.  
  8862.  
  8863.                                 - 152 -
  8864. ................................................................................
  8865.       ZEROPAD                    FUNCTION                     ZEROPAD
  8866.  
  8867.       The Zeropad function pads an integer or fixed point field to a
  8868.       given number of places left and right of the decimal point.
  8869.  
  8870.       Ex.  Zeropad(price,3,2)
  8871.            <Returns "001.50" if price = 1.5>
  8872.  
  8873.       Ex.  Zeropad(acno,6,0)
  8874.            <Returns "004532" if acno = 4,532>
  8875.  
  8876.       The Zeropad function can be used as in the second example to
  8877.       return a fixed length numeric string from an integer field.
  8878.       It's main use, however, is in the creation of fields for
  8879.       compound indices where one of the fields to be compounded is a
  8880.       number.
  8881.  
  8882.       For example: A school has all pupils names and ages recorded on
  8883.       a form in fields "name" and "age". To create an index which
  8884.       will list pupils names alphabetically but grouped by age a
  8885.       compound field which is invisible and does not allow user entry
  8886.       is created as a text field derived with:-
  8887.       Jointext(zeropad(age,2,0),name)
  8888.  
  8889.       Because the compound field is text the index file will be
  8890.       sorted alphabetically. If you sort the numbers 8,9 and 12
  8891.       alphabetically you get 12,8,9 because the one in 12 comes
  8892.       before 8. If however you sort the numbers 08,09 and 12
  8893.       alphabetically you get the correct numeric order.
  8894.  
  8895.       By using the zeropad function in the above example and indexing
  8896.       the compound field,let's call it "unifield" you could then
  8897.       print out the pupils in age groups with the names in each group
  8898.       arranged alphabetically.
  8899.       .........................format.................
  8900.       .group header
  8901.        Pupils aged {pupils.age field}
  8902.       .list items
  8903.               {pupils.name field}
  8904.       .end
  8905.       .........................procedure code.........
  8906.       declare output fields
  8907.          pupils.name:pupils.age
  8908.       end
  8909.       declare variables
  8910.          agecheck as number
  8911.       end
  8912.       agecheck = 0
  8913.       for pupils with unifield in order
  8914.          if pupils.age <> agecheck then print group header
  8915.          agecheck = pupils.age
  8916.          print list items
  8917.       next
  8918.  
  8919.  
  8920.                                 - 153 -
  8921. ................................................................................
  8922.