home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / eb202.zip / PACK1.PRG / REFER.REP < prev    next >
Text File  |  1994-07-10  |  204KB  |  8,456 lines

  1.  
  2.  
  3.  
  4.        ════════════════════════════════════════════════════════════════
  5.                    EASY BASE PROGRAMMERS REFERENCE
  6.                                Contents
  7.        ────────────────────────────────────────────────────────────────
  8.  
  9.                    Procedure Commands            Page
  10.                    ──────────────────
  11.  
  12.                    Clear Records From             13
  13.                    Copy All From                  19
  14.                    Create Temp As                 21
  15.                    Declare                        33
  16.                    Delay                          36
  17.                    Delete Record                  38
  18.                    Derive Off                     39
  19.                    Display Status                 40
  20.                    Do..Loop                       41
  21.                    Escape On/Off                  43
  22.                    Exit Batch Menu                44
  23.                    Exit Procedure                 45
  24.                    For..Next                      48
  25.                    If Then Else                   62
  26.                    Index Off                      64
  27.                    List Variables                 75
  28.                    Multiple Lines                 89
  29.                    Odd/Even Page Print            90
  30.                    Pause On/Off                  100
  31.                    Preselect                     102
  32.                    Print                         103
  33.                    Printer Control               104
  34.                    Remark                        110
  35.                    Skip Group                    122
  36.                    Skip Record                   123
  37.                    Subindex                      129
  38.                    Update Record                 141
  39.  
  40.  
  41.                    System Values                 Page
  42.                    ─────────────
  43.  
  44.                    Blank.                          7
  45.                    Bottom Margin                   8
  46.                    Current Record                 23
  47.                    Global Number                  58
  48.                    Output                         97
  49.                    Page Number                    99
  50.                    Pi                            101
  51.                    Record Number                 109
  52.                    Sequence                      120
  53.                    System Date                   131
  54.                    System Time                   132
  55.                    Total Copies                  138
  56.                    Total Records                 139
  57. ................................................................................
  58.  
  59.  
  60.                    Functions                     Page
  61.                    ─────────
  62.  
  63.                    Abs                             1
  64.                    Chr$                           12
  65.                    Datetext                       29
  66.                    Dayofmonth                     30
  67.                    Dayofweek                      31
  68.                    Dayofyear                      32
  69.                    Default                        34
  70.                    Hours                          60
  71.                    If                             61
  72.                    Intext                         70
  73.                    Jointext                       71
  74.                    Lefttext                       72
  75.                    Lengthtext                     73
  76.                    Lookup                         76
  77.                    Lower                          77
  78.                    Makedate                       78
  79.                    Maketime                       79
  80.                    Maths                          80
  81.                    Midtext                        84
  82.                    Minutes                        85
  83.                    Mod                            86
  84.                    Month                          87
  85.                    Proper                        105
  86.                    Random                        107
  87.                    Retail                        112
  88.                    Reverse                       114
  89.                    Righttext                     115
  90.                    Round                         116
  91.                    Seconds                       119
  92.                    Spacepad                      124
  93.                    Spellday                      125
  94.                    Spellmonth                    126
  95.                    Stringof                      128
  96.                    Timeampm                      137
  97.                    Upper                         142
  98.                    V.A.T. Functions              143
  99.                    Year                          144
  100.                    Zeropad                       145
  101.  
  102.  
  103.                    Field Controls                Page
  104.                    ──────────────
  105.  
  106.                    Beep                            6
  107.                    Clearfields                    14
  108.                    Delay                          35
  109.                    Run                           117
  110. ................................................................................
  111.  
  112.  
  113.                    Field Types                   Page
  114.                    ───────────
  115.  
  116.                    Choice                         11
  117.                    Date                           28
  118.                    Fixed Point                    46
  119.                    Floating Point                 47
  120.                    Formatted Text                 56
  121.                    Integer                        69
  122.                    Text                          134
  123.                    Text Block                    135
  124.                    Time                          136
  125.  
  126.  
  127.                    Field Derivation Prefixes     Page
  128.                    ─────────────────────────
  129.  
  130.                    Current                        22
  131.                    Goto (Field) Next              59
  132.                    Retest                        113
  133.                    Start Here                    127
  134.  
  135.  
  136.                    Utilities                     Page
  137.                    ─────────
  138.  
  139.                    Alter Vat Rates                 4
  140.                    Backup Application              5
  141.                    Change Password                10
  142.                    Data Import                    25
  143.                    Delete Choice Lists            37
  144.                    Install Form                   66
  145.                    Install Printer                67
  146.                    Install Procedure              68
  147.                    List File Names                74
  148.                    Options                        96
  149.                    Pack Data Forms                98
  150.                    Rebuild Directories           108
  151.                    Restore                       111
  152.                    Screen Colours                118
  153.                    Set Paper Length              121
  154. ................................................................................
  155.  
  156.  
  157.                    User Menu Functions           Page
  158.                    ───────────────────
  159.  
  160.                    Menu Calls                     83
  161.  
  162.  
  163.                    Operators                     Page
  164.                    ─────────
  165.  
  166.                    Arithmetic                     93
  167.                    Logical                        95
  168.                    Relational                     94
  169.  
  170.  
  171.                    Methods                       Page
  172.                    ───────
  173.  
  174.                    Address Labels                  2
  175.                    Bypass Sign-on Sreen            9
  176.                    Compound Index                 15
  177.                    Compound Lookups               18
  178.                    Correcting Stats.              20
  179.                    Cyclic Procedures              24
  180.                    Data Type Conversion           27
  181.                    Duplicate Prevention           42
  182.                    Form Letters                   54
  183.                    Global Defaults                57
  184.                    Input Screen Format            65
  185.                    Maximizing Speed               81
  186.                    Multiple Columns               88
  187.                    Q And A Input Screen          106
  188.                    Tabulation                    133
  189.                    Totals & Sub Totals           140
  190. ................................................................................
  191.        ABS                        FUNCTION                         ABS
  192.  
  193.        This function returns the absolute (positive) value of a
  194.        number.
  195.  
  196.        Ex. abs(length - breadth)
  197.           This returns 6 if length = 12 and breadth = 6
  198.           or if length = 6 and breadth = 12
  199.  
  200.  
  201.        Acceptable parameters
  202.  
  203.        Numeric value
  204.        Numeric expression
  205.        Numeric field/variable
  206.        Any function which returns a numeric value
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  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.                                  - 1 -
  247. ................................................................................
  248.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  249.  
  250.        The following procedure prints two columns of address labels
  251.        from a "Addr" form.
  252.  
  253.        .......................Procedure code................
  254.  
  255.        Declare output fields
  256.           Addr.name : Addr.street : Addr.town : Addr.pcode
  257.           Lname : Lstreet : Ltown : Lpcode
  258.        end
  259.        for Addr
  260.           if Lname = blank then
  261.              Lname = Addr.name : Lstreet = Addrstreet
  262.              Ltown = Addr.town : Lpcode = Addrpcode
  263.           else
  264.              print list items
  265.              Lname = blank : Lstreet = blank
  266.              Ltown = Blank : Lpcode  = blank
  267.           end if
  268.        next
  269.        if Lname <> blank then print list items
  270.  
  271.        ....................Output Format........................
  272.  
  273.        .List Items
  274.  
  275.             {Lname field        }       {Addr.name field    }
  276.             {Lstreet field      }       {Addr.street field  }
  277.             {Ltown field        }       {Addr.town field    }
  278.             {Lpcode field       }       {Addr.pcode field   }
  279.  
  280.        .end
  281.  
  282.  
  283.        The field positioning and the distance between the .List Items
  284.        and .end can be adjusted to fit the label paper.
  285.  
  286.  
  287.        If your label paper has three columns then you could use the
  288.        following procedure.
  289.  
  290.        declare output fields
  291.           Addr.name : Addr.street : Addr.town : Addr.pcode
  292.           Mname : Mstreet : Mtown : Mpcode
  293.           Lname : Lstreet : Ltown : Lpcode
  294.        end
  295.        declare variables
  296.           x as number
  297.        end
  298.  
  299.        Continued.
  300.  
  301.  
  302.  
  303.                                  - 2 -
  304. ................................................................................
  305.        ADDRESS LABELS              METHOD               ADDRESS LABELS
  306.  
  307.        for addr
  308.           x = x + 1
  309.           if Mod(x,3) = 1 then
  310.              Lname = Addr.name : Lstreet = Addr.street
  311.              Ltown = Addr.town : Lpcode = Addr.pcode
  312.           end if
  313.           if Mod(x,3) = 2 then
  314.              Mname = Addr.name : Mstreet = Addr.street
  315.              Mtown = Addr.town : Mpcode = Addr.pcode
  316.           end if
  317.           if Mod(x,3) = 0 then
  318.              Print list items
  319.              Lname = Blank : Lstreet = blank
  320.              Ltown = blank : Lpcode = Blank
  321.              Mname = Blank : Mstreet = blank
  322.              Mtown = blank : Mpcode = Blank
  323.           end if
  324.        next
  325.        If Lname <> blank then print list items
  326.  
  327.  
  328.        .........................output format...................
  329.  
  330.  
  331.        .list items
  332.  
  333.           { Lname       }    { Mname       }   { Addr.name   }
  334.           { Lstreet     }    { Mstreet     }   { Addr.street }
  335.           { Ltown       }    { Mtown       }   { Addr.town   }
  336.           { Lpcode      }    { Mpcode      }   { Addr.pcode  }
  337.  
  338.        .end
  339.  
  340.  
  341.  
  342.        See Also:- Form Letters
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.                                  - 3 -
  361. ................................................................................
  362.        ALTER VAT RATES            UTILITY              ALTER VAT RATES
  363.  
  364.        The five VAT rates used by the VAT functions can be altered
  365.        either from the utilities menu or from a user menu function.
  366.        Just select "Alter VAT rates" - edit the percentages and press
  367.        F2 to save the new values.
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.                                  - 4 -
  418. ................................................................................
  419.        BACKUP APPLICATION         UTILITY           BACKUP APPLICATION
  420.  
  421.        Easy Base includes an inbuilt Backup system for your
  422.        applications and data.
  423.  
  424.        If you select "Backup Application" from the utilities menu then
  425.        Easy Base will backup your entire application - Choicelist
  426.        fields - Forms - Data and procedures. The backup system will
  427.        split large files across multiple disks automatically.
  428.  
  429.        When an application is finished and you have backup copies then
  430.        backing up choice lists and procedures is wasteful of time and
  431.        floppies. You can backup only the users data by calling "Backup
  432.        Data" from a user menu.
  433.  
  434.        Backup Principles.
  435.  
  436.        The reason for a backup is that in the event of a computer or
  437.        hard disk failure you will have your application or data to
  438.        restore on the new machine.
  439.  
  440.  
  441.        If you have no backup and your machine fails then you have lost
  442.        all your data. If you have only one backup and your machine
  443.        fails while doing a backup then you have lost all your data.
  444.  
  445.        The principle of safe backing up is to keep two sets of backup
  446.        disks in separate boxes marked "Latest" and "Previous".
  447.        Whenever you do a backup you use the disks from the "Previous"
  448.        box - move the disks from the "Latest" to the "Previous" and
  449.        put your new backups in the latest box when completed.
  450.  
  451.        This not only overcomes the problem of a failure during backup
  452.        but also provides a secondary set of disks if any of the
  453.        "Latest" disks turn out to be faulty when you come to restore.
  454.  
  455.        If you ever have to use a backup disk and find that it has
  456.        developed a bad sector then you can attempt a recovery with a
  457.        utility such as "Norton" Disk Test. Easy Base leaves
  458.        approximately 5K of unused disk space on all backup disks so
  459.        that such a utility has somewhere to move bad sectors to.
  460.  
  461.        To save disk space, Easy Base does not backup index files. If
  462.        you ever have to use a backup disk then the index files are
  463.        rebuilt after restoring the data.
  464.  
  465.  
  466.        See Also:-  Restore
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.                                  - 5 -
  475. ................................................................................
  476.        BEEP                     FIELD CONTROL                     BEEP
  477.  
  478.        The "beep" control is used in field derivations to alert the
  479.        user to input errors. In addition to sounding the beeper the
  480.        "beep" control has two optional additional parts - A message to
  481.        be sent to the message line and cursor redirection. This is
  482.        normally to the field in which the error has been made but can
  483.        be to any field.  Field controls are appended to field
  484.        derivations and are enclosed in square brackets.
  485.  
  486.        Ex.  If(partno < 0,blank[beepPart Numbers must not be
  487.        negativeCursor partno],partno)
  488.  
  489.        In this example, if the user enters a negative number in the
  490.        partno field the computer will beep,the number will be cleared
  491.        from the field, the message "Part Numbers must not be negative"
  492.        will be displayed on the message line and the cursor will
  493.        return to the "partno" field.
  494.  
  495.        Ex. If(paid = "no" and chequeno <> blank,paid[beepEither bill
  496.        has been paid or cheque number entered in errorCursor
  497.        paid],paid)
  498.  
  499.        In Easy Base, division by zero is not trapped as an error.
  500.        There is a very good reason for this.  When you start a new
  501.        record and all the fields are blank then any field which
  502.        provides a value for a division in another field would cause a
  503.        division by zero error before its value had been entered.
  504.  
  505.        Whenever Easy Base encounters a division by Zero it divides by
  506.        one instead.  This is perfectly acceptable in most business
  507.        applications.  However, if you need to be warned of a division
  508.        by zero in formulae then you can provide your own error trap
  509.        using the "Beep" control.
  510.  
  511.        Ex.
  512.  
  513.           If( T4 = 0,blank[beepDivision by Zero Value from Field T4],
  514.                        T4)
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                  - 6 -
  532. ................................................................................
  533.        BLANK.                   SYSTEM VALUE                    BLANK.
  534.  
  535.        In Easy Base the value of any field which does not contain
  536.        characters is represented by the word "Blank" irrelevant of
  537.        data type.
  538.  
  539.        A numeric field returns the value "Blank" only when the field
  540.        is empty. If it has a value of zero then it is NOT blank.  In
  541.        fact, the main advantage of recognizing "Blank" is that you can
  542.        distinguish between zero value and empty numeric fields.
  543.  
  544.        There is, however, one slight disadvantage.  If a text field
  545.        contains ONLY the word blank and you use its value in a
  546.        derivation then the word "Blank" from the field will disappear.
  547.  
  548.        The "Name" field at the top left hand side of this page is
  549.        derived by the formula Upper(Name).  You will notice that
  550.        "Blank" is followed by a full stop.  If it were not then the
  551.        upper function would return "                    ".
  552.  
  553.        You can also remove a fields contents by setting it equal to
  554.        blank.
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.                                  - 7 -
  589. ................................................................................
  590.        BOTTOM MARGIN            SYSTEM VALUE             BOTTOM MARGIN
  591.  
  592.        Throughout a procedure which has a printed output, Easy base
  593.        keeps track of the length of page remaining (in inches) in the
  594.        system value "Bottom Margin". The Bottom margin value is used
  595.        to control pagination in procedures which "Report" on data.
  596.  
  597.        The "Bottom Margin" value is based on the paper type entered
  598.        from the Utilities Menu. You must set the type of paper you are
  599.        using before using "Bottom Margin".
  600.  
  601.        Ex.
  602.        Line feed: Line feed: Line feed
  603.        For employees
  604.           print list items
  605.           if bottom margin < .5 then
  606.              page feed: line feed :line feed : line feed
  607.           else
  608.              line feed
  609.           end if
  610.        next
  611.  
  612.        In the above example the list items section is printed with a
  613.        blank line between each and with a half inch top and bottom
  614.        page margin.
  615.  
  616.        When you base decisions on the "Bottom margin" value you should
  617.        always do so with a "Greater Than" or "Less Than" operator. If
  618.        you used " If Bottom margin = .5 then Page feed" your page
  619.        would only be ejected if and when the "Bottom Margin" value was
  620.        exactly 0.5  As most printing is done at six lines to the inch
  621.        it is most unlikely that the "Bottom margin" value would ever
  622.        be half an inch.
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.                                  - 8 -
  646. ................................................................................
  647.        BYPASS SIGN-ON SREEN        METHOD         BYPASS SIGN-ON SREEN
  648.  
  649.        You can bypass the sign-on screen for both the developers
  650.        password and any User-menu password by adding the password to
  651.        the start up command line. This is particularly useful in
  652.        finished applications as the application can be called directly
  653.        from a hard disk menu system - the sign on screen will not
  654.        appear and the application will start as if it were a stand
  655.        alone program.
  656.  
  657.        You can use either:-
  658.  
  659.           EB/password  or
  660.           EB password
  661.  
  662.        as your command line to bypass the sign on screen.
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.                                  - 9 -
  703. ................................................................................
  704.        CHANGE PASSWORD            UTILITY              CHANGE PASSWORD
  705.  
  706.        You can change your developers access password with this item
  707.        on the utilities menu.
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.                                  - 10 -
  760. ................................................................................
  761.        CHOICE                    FIELD TYPE                     CHOICE
  762.  
  763.        If you define a field as the "Choice" type a window will open
  764.        into which you can type up to seventeen different choices.
  765.        When you have entered your choices you will be asked to give a
  766.        name to your choice list. Once a choice list has been saved it
  767.        can be used in any other choice field in any other form or
  768.        input screen.
  769.  
  770.        Once a choice list has been saved you can edit the contents but
  771.        not the field length. Editing a choice list in one form
  772.        automatically edits it for any other form.
  773.  
  774.        If you need to alter a list such that the field length will
  775.        change then you must create a new list. You can erase the old
  776.        one from the utilities menu.  If the list is used in more than
  777.        one form then you must redefine it in all the other forms in
  778.        which it is used
  779.  
  780.        When the cursor enters a choice field your choice list will be
  781.        displayed for the user to choose from. He cannot enter any
  782.        value other than one from the list.
  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.                                  - 11 -
  817. ................................................................................
  818.        CHR$                       FUNCTION                        CHR$
  819.  
  820.        The Chr$ function returns the character whose ASCII number is
  821.        supplied as the parameter.
  822.  
  823.        Ex.   Chr$(171)
  824.              < Returns "½">
  825.  
  826.        Ex.   Jointext(Chr$(227),"r",Chr$(253))
  827.              < Returns "πr²"
  828.  
  829.        In Easy Base, text fields are automatically justified left.
  830.        This is desirable in record entry as it prevents the user from
  831.        entering leading spaces in indexed fields and consequently
  832.        trashing alphabetic printouts. However, you may wish to right
  833.        justify or centre justify text in printouts. For example, the
  834.        righthand "Chr$" at the top of this page is right justified in
  835.        its field. You can use the ASCII character 255 to achieve right
  836.        or centre justification.
  837.  
  838.        Ex.
  839.  
  840.        Heading = jointext(stringof((30-lengthtext(name))/2,Chr$(255)),
  841.        name)
  842.            < This centres name in the 30 character field "heading">
  843.  
  844.        Ex.
  845.  
  846.        Heading =Jointext(stringof(40-lengthtext(name),Chr$(255)),name)
  847.  
  848.           < This right justifies name in a 40 character field
  849.             "Heading">
  850.  
  851.  
  852.        CAUTION:
  853.  
  854.        You can produce any ASCII character ( 0 - 255 ) with the Chr$
  855.        function. ASCII characters 0 to 31 are used as printer controls
  856.        and although you can use them freely on screen you should never
  857.        include them in a procedure output which will be sent to the
  858.        printer.
  859.  
  860.        Acceptable parameters:
  861.  
  862.        Numeric value, field, variable, expression or function
  863.        returning a number between 0 and 255
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.                                  - 12 -
  874. ................................................................................
  875.        CLEAR RECORDS FROM     PROCEDURE COMMAND     CLEAR RECORDS FROM
  876.  
  877.        The "Clear Records From" command clears all records from a form
  878.        by erasing its data and index files. If you need to erase all
  879.        records form a form always use the "Clear Records" command
  880.        rather than "Delete Record" command. It is much faster and does
  881.        not require the form to be re-packed afterward.
  882.  
  883.        Ex.
  884.  
  885.        If input.confirm = "yes" then clear records from invoices
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.                                  - 13 -
  931. ................................................................................
  932.        CLEARFIELDS              FIELD CONTROL              CLEARFIELDS
  933.  
  934.        The "Clearfields" control blanks out all other fields on a form
  935.        or procedure input screen whenever the field containing the
  936.        control is changed.
  937.  
  938.        The primary use for the "Clearfields" control is to force
  939.        default lookups to re-derive for procedures which edit data.
  940.  
  941.        For Example - If you wrote a procedure to alter customers
  942.        addresses and telephone numbers then you would have three
  943.        fields on the input screen.
  944.  
  945.        Accountno   derived   lookup(customers,accountno)
  946.  
  947.        address     derived   default(lookup(customers,address))
  948.  
  949.        Tel         derived   default(lookup(customers,tel))
  950.  
  951.        When you enter a customers account number, his old address and
  952.        telephone number will be looked up, but the "Default" function
  953.        will allow you to edit them. The procedure code would then
  954.        update the record with the new address and phone number.
  955.  
  956.        The problem is, that having entered an account number and
  957.        looked up the other fields, if you then realize you have
  958.        entered the wrong account number and change it, the other
  959.        fields will not re-derive because they now have a default
  960.        value.  To get them to lookup based on the new account number
  961.        you would have to take the cursor to each field and clear it
  962.        with the F6 key.
  963.  
  964.        you can automate this process by adding the "Clearfields"
  965.        control to the accountno derivation:-
  966.  
  967.        lookup(customers,accountno)[clearfields]
  968.  
  969.  
  970.        Note:  The "Clearfields" control will only work when appended
  971.        to a derivation which is already dependent on the value of the
  972.        field. If you want to clear fields based on a change to a field
  973.        which has no other derivation then you must derive the field
  974.        with its own name plus the "Clearfields" control.
  975.  
  976.        In a field "Number" the derivation - Number[clearfields] - will
  977.        clear all other fields when the "Number" field is edited but
  978.        the derivation [clearfields] will have no effect.
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.                                  - 14 -
  988. ................................................................................
  989.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  990.  
  991.        If you need to list records from a form in such a way that they
  992.        are grouped by one field but with each record in the group
  993.        ordered by another then you can either use a compound index
  994.        field or "Subindex" the group during the procedure.
  995.  
  996.        A compound index field is simply an additional field in which
  997.        the contents of two or more fields are compounded using the
  998.        "Jointext" function. The field is indexed and the index on that
  999.        field can then be used to select records with the desired group
  1000.        ordering.
  1001.  
  1002.        For example:- A "Videos" form has fields for "Title",
  1003.        "RentalPrice" and "Category".
  1004.  
  1005.        To list the records grouped by "Category" but with the "Titles"
  1006.        in each category in alphabetic order you add another field to
  1007.        the form which is Text, Indexed and long enough to hold the
  1008.        contents of both the "category" and "Title" fields. The field
  1009.        is derived by joining the text of the "Category" and "Title"
  1010.        fields.
  1011.  
  1012.        There are a couple of minor complications in creating compound
  1013.        index fields. Firstly the "Jointext" function by default strips
  1014.        any trailing space characters from the text it is joining. If a
  1015.        straight "Jointext" function was used and the first two videos
  1016.        entered were "A Bridge Too Far" and "Snow White" then the
  1017.        compound fields would derive as:-
  1018.  
  1019.        "WarA Bridge Too Far"  and
  1020.        "CartoonSnow White"
  1021.  
  1022.        When what you need is:-
  1023.  
  1024.        "War      A Bridge Too Far"  and
  1025.        "Cartoon  Snow White      "
  1026.  
  1027.        To produce the desired spacing in the compound field use the
  1028.        "Spacepad" function.
  1029.  
  1030.        If the length of the "Category" field is 15 then derive the
  1031.        compound field with - Jointext(spacepad(category,15),title)
  1032.  
  1033.        If you are compounding more than two fields then "spacepad" all
  1034.        the fields being joined to their own field's length except the
  1035.        last one.
  1036.  
  1037.        The maximum length of a text field in Easy Base is 80
  1038.        characters. If the fields you need to compound total more than
  1039.        80 then you must reduce the length of the field names. Compound
  1040.        indices in Text Block fields should not be used.
  1041.  
  1042.  
  1043.  
  1044.                                  - 15 -
  1045. ................................................................................
  1046.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1047.  
  1048.        Once you have created a compound field and checked that it
  1049.        derives correctly it is normal to define it as invisible and no
  1050.        entry anyway as it is not its contents that are of interest but
  1051.        the order which its index produces.
  1052.  
  1053.        Ex.   Assuming the compound field was called "catgroup"
  1054.  
  1055.        ..........................code..................
  1056.        for videos with catgroup in order
  1057.           print list items
  1058.        next
  1059.        ........................format.................
  1060.        .List Items
  1061.              {Videos.Category Field}     {Videos.Title Field}
  1062.        .End
  1063.  
  1064.  
  1065.        Ex.
  1066.  
  1067.  
  1068.        ...........................code....................
  1069.        declare variables
  1070.           catcheck as text
  1071.        end
  1072.        for videos with catgroup in order
  1073.           if catcheck <> videos,category then print group header
  1074.           catcheck = videos.category
  1075.           print list items
  1076.        next
  1077.        ..........................format...............
  1078.        .Group Header
  1079.           -------------------------------------
  1080.           Films categorized as {category field}
  1081.           -------------------------------------
  1082.        .List Items
  1083.                      {Title field}
  1084.        .End
  1085.  
  1086.        There is yet a further complication if one or more of the
  1087.        fields to be compounded is numeric. Easy Base index files are
  1088.        sorted alphabetically if the field is text and numerically if
  1089.        the field is numeric. A compound field is always text so if you
  1090.        need to compound a numeric field you have to ensure that it
  1091.        will sort alphabetically to the same order that it sorts
  1092.        numerically. The text of numeric values sort alphabetically to
  1093.        the same order as their values only if they all have the same
  1094.        number of digits either side of the decimal point.
  1095.  
  1096.        6  12 and 34 sort alphabetically as 12  34  6
  1097.        but
  1098.        06 12 and 34 sort alphabetically as 06  12  34
  1099.  
  1100.  
  1101.                                  - 16 -
  1102. ................................................................................
  1103.        COMPOUND INDEX              METHOD               COMPOUND INDEX
  1104.  
  1105.        Easy Base provides the function "Zeropad" to pad numbers to the
  1106.        same length for compounding.  The "Zeropad" function has three
  1107.        parameters - The number to be padded, the number of digits left
  1108.        of the decimal to pad to and the number of digits right of the
  1109.        decimal to pad to. All three parameters must be supplied. If
  1110.        the number is an integer then the third parameter is 0.
  1111.  
  1112.        Ex. To list the "Videos" records grouped by rental price with
  1113.        the titles in each price group in order you would create a
  1114.        compound field derived with:-
  1115.  
  1116.        Jointext(zeropad(rentalprice,2,2),title)
  1117.  
  1118.        Ex.
  1119.  
  1120.        A "Ships" form has fields for "Type" and "Displacement"
  1121.  
  1122.        To list the ships grouped by type with the Displacement in each
  1123.        group in order you would create a compound field derived with:-
  1124.  
  1125.        jointext(spacepad(type,15),zeropad(displacement,8,0))
  1126.  
  1127.        In many cases where you wish to compound a mixture of text and
  1128.        numeric fields you will require the numeric values to be listed
  1129.        in descending order while the text value is to be in alphabetic
  1130.        order.
  1131.  
  1132.        In the above example for ships, had you wished each group to
  1133.        be listed with "Displacement" in descending order you would
  1134.        derive the compound field as:-
  1135.  
  1136.        jointext(spacepad(type,15),reverse(zeropad(displacement,8,0)))
  1137.  
  1138.        The "Reverse" function simply inverts the ACSII number of each
  1139.        character in its parameter so that it will sort in reverse
  1140.        order in the index file.
  1141.  
  1142.        The "Reverse" function works equally well on text values
  1143.        although reverse alphabetic lists are seldom required.
  1144.  
  1145.        The "Zeropad" function will only pad out a number to the size
  1146.        required. It will not trim the number if it is already longer
  1147.        than one of the pad lengths. You should not therefore create
  1148.        compound fields with Floating Point numbers.
  1149.  
  1150.        If you compound a date or time field you should zeropad it to
  1151.        5,0 as the text which will be used is actually the date or time
  1152.        fields numeric value.
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.                                  - 17 -
  1159. ................................................................................
  1160.        COMPOUND LOOKUPS            METHOD             COMPOUND LOOKUPS
  1161.  
  1162.        Occasionally, in an input screen, you will wish to lookup
  1163.        details from a form whose unique field is a compound of two
  1164.        others.  As an example, if you wished to lookup details from
  1165.        the "Userlist" form, mentioned in the manual, then you would
  1166.        have to base the lookups on a relationship between a field on
  1167.        the input screen and the "UNI" field in "Userlist". The "UNI"
  1168.        field in userlist is a combination of the "Aircraft" forms
  1169.        "Knownas" field and the "Airlines" form "Name" field.
  1170.  
  1171.        Although you could simply use a field "UNI" on the input screen
  1172.        and derive it :- Lookup(userlist,uni) - this would mean that
  1173.        the end user would have to enter the whole of the aircraft
  1174.        Knownas part plus part of the airlines name part plus the "*"
  1175.        in order to get the lookup.
  1176.  
  1177.        This would not only be awkward to use but would also entail
  1178.        explaining compound fields to the end user.
  1179.  
  1180.        You can avoid this situation by providing two fields, one in
  1181.        which the user looks up the aircraft knownas field and one in
  1182.        which he looks up the airline name. These are based on separate
  1183.        relationships between the input screen and the "Aircraft" and
  1184.        "Airlines" forms.
  1185.  
  1186.        The input screen's "UNI" field can now be made invisible with
  1187.        no user entry and derived:- Jointext(knownas,name).
  1188.  
  1189.        A relationship is entered between the input screen and the
  1190.        "Userlist" form linking the "UNI" fields and all the required
  1191.        details can then be derived :- lookup(userlist,whatever).
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.                                  - 18 -
  1216. ................................................................................
  1217.        COPY ALL FROM          PROCEDURE COMMAND          COPY ALL FROM
  1218.  
  1219.        When you are transferring values from the fields of one form to
  1220.        the fields of another in preparation for a "New Record" or
  1221.        "Update Record"  you can use "Copy All From" to save time.
  1222.  
  1223.        Ex.
  1224.  
  1225.        for invoiceitems new record
  1226.           invoiceitems.item = input.item
  1227.           invoiceitems.price = input.price
  1228.           invoiceitems.quantity = input.quantity
  1229.           invoiceitems.vatrate = input.vatrate
  1230.        next
  1231.  
  1232.        can be replaced with:-
  1233.  
  1234.        for invoiceitems new record
  1235.           copy all from input
  1236.        next
  1237.  
  1238.        The data transfer in a "Copy All From" is based on the source
  1239.        and destination fields having the same name.
  1240.  
  1241.        If the source and destination fields have different data types
  1242.        Easy Base will attempt a conversion.
  1243.  
  1244.        The conversion will succeed between different numeric types and
  1245.        from numeric to text. It will fail from text to numeric and
  1246.        between any mismatch of date and time.
  1247.  
  1248.  
  1249.  
  1250.  
  1251.        See also:-  Derive Off, Duplicate Prevention
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.                                  - 19 -
  1273. ................................................................................
  1274.        CORRECTING STATS.           METHOD            CORRECTING STATS.
  1275.  
  1276.        If you write an application in which records are entered via
  1277.        procedures and "running" statistics are kept, you will have to
  1278.        provide procedures which allow the user to correct any mistakes
  1279.        he has made.
  1280.  
  1281.        For Example: - In a "Time Sheets" application the user enters a
  1282.        time and customer on the input screen of a procedure. The
  1283.        procedure then calculates the charge, writes the charge and
  1284.        customers name to the "Timesheet" form, adds the charge to the
  1285.        "Balance" field in the "Customers" form and also adds it to the
  1286.        "Total" field in the "Workinhand" form.
  1287.  
  1288.        If the operator makes an error then correcting the entry in the
  1289.        "Timesheet" form is simply a case of updating it but to correct
  1290.        the "Balance" and "Total" fields you must add the corrected
  1291.        value and subtract the old incorrect value.
  1292.  
  1293.        To get the two values together for your procedure, create an
  1294.        input screen where the operator enters the "line" ("line" is
  1295.        the unique sequenced field in "Timesheet").  Then create two
  1296.        fields for the values. The first, "oldval" is derived
  1297.        lookup(timesheet,charge) and the second, "newval" is derived
  1298.        default(lookup(timesheet,charge).
  1299.  
  1300.        The "Oldval" field can be invisible and has no user entry.
  1301.  
  1302.        You would also add two similarly derived fields "Oldcustomer"
  1303.        and "Newcustomer".
  1304.  
  1305.        When the user edits the "Newval" and/or "Newcustomer" field and
  1306.        presses F2 , all the required values are available to the
  1307.        procedure code:-
  1308.  
  1309.        pause off : escape off
  1310.        for timesheet with line = input.line
  1311.           timesheet.charge = input.newval
  1312.           timesheet.customer = input.newcustomer
  1313.           update record
  1314.        next
  1315.        for customers with name = input.oldcustomer
  1316.           customers.balance = customers.balance - input.oldval
  1317.           update record
  1318.        next
  1319.        for customers with name = input.newcustomer
  1320.           customers.balance = customers.balance + input.newval
  1321.           update record
  1322.        next
  1323.        for workinhand
  1324.          workinhand.total = workinhand.total+input.newval-input.oldval
  1325.          update record
  1326.        next
  1327.  
  1328.  
  1329.                                  - 20 -
  1330. ................................................................................
  1331.        CREATE TEMP AS         PROCEDURE COMMAND         CREATE TEMP AS
  1332.  
  1333.        The "Create Temp As" command makes a temporary form during a
  1334.        procedure. There are two main uses for the temporary form.
  1335.  
  1336.        1.  To physically sort the records in a form.
  1337.  
  1338.        Ex.
  1339.  
  1340.        create temp as addresses
  1341.        index off:pause off:escape off:derive off
  1342.        for addresses with surname in order
  1343.           for temp new record
  1344.              copy all from addresses
  1345.           next
  1346.        next
  1347.        rename temp as addresses
  1348.  
  1349.        The other main use for the temporary file is to save time when
  1350.        the majority of records in a form are to be deleted.
  1351.  
  1352.        Ex.
  1353.        A purchases ledger form is to be cleared down at the year end
  1354.        but any unreconciled payment entries are to be retained and
  1355.        flagged as last years. If there were 15000 records in the form
  1356.        of which only 50 were unreconciled then the procedure
  1357.  
  1358.        for purchases
  1359.           if purchases.reconciled = "yes" then
  1360.              delete record
  1361.           else
  1362.              purchases.lastyear = "yes"
  1363.              update record
  1364.           end if
  1365.        next
  1366.  
  1367.        would not only take a very long time to run but would leave the
  1368.        form full of deleted records and it would have to be re-packed.
  1369.  
  1370.        The same result can be achieved very quickly and without the
  1371.        need to re-pack with the following procedure.
  1372.  
  1373.        create temp as purchases
  1374.        for purchases with reconciled = "no"
  1375.           for temp new record
  1376.              copy all from purchases
  1377.              temp.lastyear = "yes"
  1378.           next
  1379.        next
  1380.        rename temp as purchases
  1381.  
  1382.        Do not use the "Clear Records" command to wipe the old file
  1383.        before using "Rename Temp As".  If you suffered a power failure
  1384.        after clearing and before renaming you would lose your data.
  1385.  
  1386.                                  - 21 -
  1387. ................................................................................
  1388.        CURRENT                DERIVATION PREFIX                CURRENT
  1389.  
  1390.        In Easy Base, fields are not normally derived when a previously
  1391.        entered record is viewed on screen. You can force a field to be
  1392.        rederived when viewed by prefixing the derivation with
  1393.        "current".
  1394.  
  1395.        Ex.  An invoice form has three fields Ivdate,Cdate and age.
  1396.  
  1397.        Ivdate is derived as   "system date"
  1398.        Cdate is derived as    "current system date"
  1399.        age is derived as      jointext(Cdate-Ivdate," Days old")
  1400.  
  1401.        Each time a record is viewed the Cdate field is rederived with
  1402.        the current system date and the age field shows the number of
  1403.        days since the record was filed.
  1404.  
  1405.        Ex.
  1406.  
  1407.        A form is used to price a certain job. It consists of fields
  1408.        for materials and their prices which are looked up from a
  1409.        "stock" form. If the primary lookup fields are prefixed with
  1410.        "current"   -  "current lookup(stock,item)"
  1411.  
  1412.        then each time a record is viewed it will reprice the job using
  1413.        the latest prices from the "stock" file.
  1414.  
  1415.        Please note that in the case of lookups, prefixing a secondary
  1416.        lookup has no effect. In the above example
  1417.  
  1418.          "current lookup(stock,price)"  would not work
  1419.  
  1420.        Provided that the primary lookup field is prefixed with
  1421.        "current" then any secondary lookups will also be rederived.
  1422.  
  1423.  
  1424.        The values of "Current" fields are also rederived whenever they
  1425.        are accessed in procedure code but they are NOT REDERIVED when
  1426.        they are accessed by a Lookup function.
  1427.  
  1428.  
  1429.        Note: You can only have one prefix on any one field derivation.
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.                                  - 22 -
  1444. ................................................................................
  1445.        CURRENT RECORD           SYSTEM VALUE            CURRENT RECORD
  1446.  
  1447.        Whenever a procedure is processing a "FOR" loop the number of
  1448.        the record being processed is available in the "Current Record"
  1449.        system value. The "Current Record" value is the records actual
  1450.        number in the form, not the number of records processed.
  1451.  
  1452.        Ex.
  1453.  
  1454.        for books with category = "fiction"
  1455.           count = count + 1
  1456.           Posn = current record
  1457.        next
  1458.  
  1459.        If the first book found with the category "fiction" is the
  1460.        fifteenth record in the file then count will return 1 and
  1461.        Posn will return 15.
  1462.  
  1463.  
  1464.        The "Current Record" value has no meaning in field derivations.
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  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.                                  - 23 -
  1501. ................................................................................
  1502.        CYCLIC PROCEDURES           METHOD            CYCLIC PROCEDURES
  1503.  
  1504.        In many applications you will come across the situation where
  1505.        you need a procedure which will perform the same actions on a
  1506.        given set of records. For example, in a payroll system the
  1507.        procedure which calculates the employees wage and deductions
  1508.        has to be repeated for each employee so that their hours can be
  1509.        entered. If you simply enter each employees Worksno and lookup
  1510.        his or her details then it will be easy to miss an employee or
  1511.        to do one twice.
  1512.  
  1513.        To avoid this you can create a procedure which will cycle each
  1514.        employee through the input screen and terminate when all
  1515.        employees have been processed.
  1516.  
  1517.        On the employees form, add a field "Cycled" which is a single
  1518.        character indexed field derived :- Default("N").
  1519.  
  1520.        On the procedure input screen add an invisible field "Cycled"
  1521.        which is derived "N"
  1522.  
  1523.        You now enter two relationships between the procedure and the
  1524.        employees form. The main relationship "Employees" links the
  1525.        fields "Worksno" and the second, lets call it "Cycled" links
  1526.        the "Cycled" fields.
  1527.  
  1528.        On the input screen you derive the "Worksno" field as
  1529.        Lookup(cycled,worksno) and all the other details as
  1530.        lookup(employees,Whatever).
  1531.  
  1532.        When you run the procedure, the first employees details will be
  1533.        loaded automatically and all you have to enter are his hours.
  1534.  
  1535.        To have the next employee loaded after you run the procedure,
  1536.        the procedure code simply includes the lines:-
  1537.  
  1538.        for employees with worksno = input.worksno
  1539.           employees.cycled = "Y"
  1540.           update record
  1541.        next
  1542.  
  1543.        When all employees have been processed the "Worksno" field will
  1544.        derive blank as there are no employees with "N" in the "Cycled"
  1545.        field. You can therefore pass a "finished" message by altering
  1546.        the derivation of "Worksno" to :-
  1547.  
  1548.          if(lookup(cycled,worksno)=blank,blank[beepAll Employees have
  1549.          now been processed],lookup(cycled,worksno))
  1550.  
  1551.        To reset cycling for the next payroll you write an additional
  1552.        procedure with the code:-
  1553.        for employees
  1554.           employees.cycled = "N" : update record
  1555.        next
  1556.  
  1557.                                  - 24 -
  1558. ................................................................................
  1559.        Data Import                UTILITY                  Data Import
  1560.  
  1561.        There are three Data Import routines in Easy Base. The first
  1562.        imports data from files which conform to the Xbase standard
  1563.        first introduced by Dbase. The second imports data from "Comma
  1564.        Delimited" files. This is the standard used by most sequencial
  1565.        access and non relational data systems. The third routine
  1566.        imports data from fixed length record text files. Although few
  1567.        systems actually store data as fixed length text, this is the
  1568.        format which is used by all systems to output data. You can
  1569.        therefore import data from virtually any other system by first
  1570.        reporting on it to a disk file and then importing it with the
  1571.        fixed length ASCII import routine.
  1572.  
  1573.        XBASE
  1574.  
  1575.        If the data you wish to import is in Xbase format, Easy Base
  1576.        will report the structure of the file. You can print this out
  1577.        by pressing F10. You now design a form to hold the imported
  1578.        data. The names that you give to the Easy Base fields do not
  1579.        have to be the same as the Xbase field names but they must be
  1580.        in the same order. If the Xbase fields are text then the Easy
  1581.        Base fields must be the same length. If the Xbase fields are
  1582.        numeric then the Easy Base fields must be numeric. It does not
  1583.        matter if they are different lengths and any of the three
  1584.        types, integer, fixed point or floating point can be used.
  1585.        If an Xbase field is a date field then it must be imported to
  1586.        an eight character text field in Easy Base. You can reformat it
  1587.        to an Easy Base date field after importation (See the Method -
  1588.        Data Type Conversion).  Easy Base does not support "Memo" data.
  1589.        If the Xbase file has a memo field you can still import from it
  1590.        but the memo field itself will be skipped by the import
  1591.        routine.
  1592.  
  1593.        COMMA DELIMITED
  1594.  
  1595.        To import data from comma delimited files all you have to do is
  1596.        design a form with the same number of fields as there are in
  1597.        the file to be imported. Numeric fields can be any of the three
  1598.        types and text fields should be long enough to hold the longest
  1599.        data expected in the incoming field. If any of the fields to be
  1600.        imported holds a date then it must be imported to a text field.
  1601.        You can convert it to a date later.
  1602.  
  1603.        FIXED LENGTH ASCII
  1604.  
  1605.        To import data from fixed length ASCII files you must design a
  1606.        form in which all fields are text and are exactly the same
  1607.        length and in the same order as the fields in the file to be
  1608.        imported. If the file to be imported has a header you can allow
  1609.        for this by entering the header length in bytes.
  1610.  
  1611.        If you are using the fixed length import routine to import data
  1612.        which you have output as a report from another system then
  1613.  
  1614.                                  - 25 -
  1615. ................................................................................
  1616.        Data Import                UTILITY                  Data Import
  1617.  
  1618.        please note the following points.
  1619.  
  1620.        The output report from the original system should have no
  1621.        headers, footers or left margin and there should be no spaces
  1622.        between fields.
  1623.  
  1624.        When the original system outputs the data it will add a
  1625.        carriage return and line feed sequence to the end of each
  1626.        record. When you design the form to import this data to, you
  1627.        must have a final two character text field to trap this
  1628.        sequence and maintain the same record length.  This field can
  1629.        be deleted after importation.
  1630.  
  1631.        All fields are imported as text. If any of them contain numeric
  1632.        values which you wish to convert to numeric fields you must do
  1633.        this after importation. (See Method Data Type Conversion)
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  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.                                  - 26 -
  1672. ................................................................................
  1673.        Data Type Conversion        METHOD         Data Type Conversion
  1674.  
  1675.        In Easy Base, modifying the structure of a data file after it
  1676.        contains data is very easy and flexible. If you select Modify
  1677.        Existing Form from the Forms menu you can add fields, delete
  1678.        fields, change field order, change field lengths and Easy Base
  1679.        will reformat your existing data automatically.
  1680.  
  1681.        You can NOT however change data types simply by changing the
  1682.        field type. If you change a field type and save the form you
  1683.        will almost certainly lose the data that was in that field.
  1684.        (Other than changing from one numeric type to another)
  1685.  
  1686.        If you work entirely within Easy Base there is no reason why
  1687.        you should ever need to change a field type. However, if you
  1688.        have imported data from Dbase or Fixed Length ASCII you may
  1689.        find yourself with numeric or date values held in text fields.
  1690.  
  1691.        The procedure for converting data from one type to another is
  1692.        as follows:-
  1693.  
  1694.        1.   Select Modify Existing Form
  1695.  
  1696.        2.   Add a new field of the desired type with a derivation
  1697.             formula such that it will derive its value from the field
  1698.             of the old type.
  1699.  
  1700.        3.   Save the form.
  1701.  
  1702.        4.   Select Modify the form again.
  1703.  
  1704.        5.   Cancel the derivation formula in the new field and delete
  1705.             the old field.
  1706.  
  1707.        6.   Re save the form.
  1708.  
  1709.  
  1710.        To derive a numeric field from a text field the derivation
  1711.        formula is simply the text field name.
  1712.  
  1713.        To derive a date field from a Dbase imported date in a text
  1714.        field called DT the formula is:-
  1715.  
  1716.        Makedate(midtext(DT,5,2),midtext(DT,7,2),midtext(DT,3,2))
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.                                  - 27 -
  1729. ................................................................................
  1730.        DATE                      FIELD TYPE                       DATE
  1731.  
  1732.        Date fields hold dates in the eight character format 11/11/94
  1733.  
  1734.        The assumed century runs from the first of January 1981 to the
  1735.        31st of december 2080.
  1736.  
  1737.        You can select whether you wish your dates to be displayed as
  1738.        day/month/year (European) or month/day/year (North American)
  1739.        from the "options" item on the utilities menu.
  1740.  
  1741.        You can perform addition and subtraction operations on date
  1742.        values in days.
  1743.  
  1744.        Ex.  System date + 30
  1745.  
  1746.        Arithmetic operations are only correct for the assumed century.
  1747.  
  1748.        Date fields are automatically checked for validity by the
  1749.        system.
  1750.  
  1751.        Easy base does not provide a ready made ten character date
  1752.        field but you can define one with the "Formatted Text" field
  1753.        type.
  1754.  
  1755.  
  1756.        See Also:-   Makedate
  1757.  
  1758.  
  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.                                  - 28 -
  1786. ................................................................................
  1787.        DATETEXT                   FUNCTION                    DATETEXT
  1788.  
  1789.        This function returns the date parameter in the form:-
  1790.  
  1791.        14th October 1994  or
  1792.        October 14th 1994  depending on the date format selected in
  1793.                           the utilities menu.
  1794.  
  1795.  
  1796.        Ex.    datetext(system date)
  1797.  
  1798.        Ex.    datetext(invoicedate + 30)
  1799.  
  1800.        Acceptable parameters:
  1801.  
  1802.        System date
  1803.        Date field
  1804.        Makedate function
  1805.        Date expression
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  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.                                  - 29 -
  1843. ................................................................................
  1844.        DAYOFMONTH                 FUNCTION                  DAYOFMONTH
  1845.  
  1846.        This function returns the day no.(1-31) of the date parameter.
  1847.  
  1848.        Ex. dayofmonth(system date)
  1849.  
  1850.        Ex  dayofmonth(registered)
  1851.  
  1852.        Ex.
  1853.  
  1854.        if dayofmonth(system date) = 28 then
  1855.           for statements with settled = "No"
  1856.              statements.overdue = "Yes"
  1857.              update record
  1858.           next
  1859.        end if
  1860.  
  1861.        Acceptable parameters:
  1862.  
  1863.        System date
  1864.        Date field
  1865.        Makedate function
  1866.        Date expression
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.                                  - 30 -
  1900. ................................................................................
  1901.        DAYOFWEEK                  FUNCTION                   DAYOFWEEK
  1902.  
  1903.        This function returns the day no.(1-7) of the date parameter.
  1904.  
  1905.        Ex.  dayofweek(system date)
  1906.  
  1907.        Ex.  day = spellday(dayofweek(diary.date))
  1908.  
  1909.        Ex.  The following procedure, if called from a batch execute
  1910.        menu will only run on a Monday.
  1911.  
  1912.        declare output fields
  1913.           takings.date
  1914.           takings.dailytotal
  1915.        end
  1916.        if dayofweek(system date) = 1 then
  1917.           for takings with date in reverse order
  1918.              print list items
  1919.              if system date - takings.date > 7 then exit for
  1920.           next
  1921.        end if
  1922.  
  1923.        Acceptable parameters:
  1924.  
  1925.        System date
  1926.        Date field
  1927.        Makedate function
  1928.        Date expression
  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.                                  - 31 -
  1957. ................................................................................
  1958.        DAYOFYEAR                  FUNCTION                   DAYOFYEAR
  1959.  
  1960.        This function returns the day no.(1-365) of the date parameter.
  1961.  
  1962.        Ex.   dayofyear(system date)
  1963.  
  1964.        Ex.   days = dayofyear(events.date)
  1965.  
  1966.        Acceptable parameters:
  1967.  
  1968.        System date
  1969.        Date field
  1970.        Makedate function
  1971.        Date expression
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.                                  - 32 -
  2014. ................................................................................
  2015.        DECLARE                PROCEDURE COMMAND                DECLARE
  2016.  
  2017.        If you write a procedure which outputs information to the
  2018.        screen, printer or a disk file you must start it by declaring
  2019.        the output fields.
  2020.  
  2021.        Ex.
  2022.        Declare output fields
  2023.           Input.name
  2024.           Customers.name:customers.address:customers.acno
  2025.           countofinvoices
  2026.        end
  2027.  
  2028.        If fields you intend to print exist in a form then declare them
  2029.        as Formname.Fieldname.  Fields from the procedures Input Screen
  2030.        are declared as Input.fieldname. Easy Base will then use the
  2031.        field definitions from the form as defaults when you create the
  2032.        Output Format for the procedure.
  2033.  
  2034.        If a field which you intend to print is to be derived during
  2035.        the procedure and does not exist in a form as "countofinvoices"
  2036.        you can give it any name you wish up to forty characters but
  2037.        the name must not contain a ".". Once you have declared fields
  2038.        you can create the Output Format.
  2039.  
  2040.        If you declare an "Ad Hoc" field such as "countovinvoices" then
  2041.        you must include it in the format in order to define its type
  2042.        and length.
  2043.  
  2044.        If you require variables to store values during a procedure but
  2045.        you will not be out-putting their values then declare them as
  2046.        variables not fields.
  2047.  
  2048.        Ex.
  2049.  
  2050.        declare variables
  2051.           count as number
  2052.           lasttype as text
  2053.        end
  2054.  
  2055.        Unprinted variables can only have one of the two types "Number"
  2056.        or "Text".
  2057.  
  2058.        Field declarations must precede Variable declarations and both
  2059.        must precede executable code.
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.                                  - 33 -
  2071. ................................................................................
  2072.        DEFAULT                    FUNCTION                     DEFAULT
  2073.  
  2074.        This function returns the parameter if not overridden by user
  2075.        entry.
  2076.  
  2077.  
  2078.        Ex.    Default(5)
  2079.  
  2080.        Ex.    Default(system date)
  2081.  
  2082.        Ex.    Default(lookup(stock,price))
  2083.  
  2084.        The Default function is only used in form and input screen
  2085.        field derivations - It has no meaning in procedure code.
  2086.  
  2087.        Acceptable parameters
  2088.  
  2089.        Any value, expression, field, variable or nested function of
  2090.        the same type as the field in which it is used.
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.                                  - 34 -
  2128. ................................................................................
  2129.        DELAY                    FIELD CONTROL                    DELAY
  2130.  
  2131.        The "delay" control suspends processing for a given number of
  2132.        milliseconds.
  2133.  
  2134.        Ex.
  2135.  
  2136.        A procedure screen is used from a startup Batch execute menu as
  2137.        an opening screen to an application and has the following field
  2138.        derivations
  2139.  
  2140.        1.  "Welcome to this wonderful program" [delay 1000]
  2141.  
  2142.        2.  "Copyright Fred blogs"[delay 1000]
  2143.  
  2144.        3.  "Press F2 to start"
  2145.  
  2146.        If the field colours are "text" ,"alt1" or "alt2" then the
  2147.        three fields will "Popup" with a one second delay between each.
  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.                                  - 35 -
  2185. ................................................................................
  2186.        DELAY                  PROCEDURE COMMAND                  DELAY
  2187.  
  2188.        The "Delay" command suspends processing for a given number of
  2189.        milliseconds (1 - 5000).
  2190.  
  2191.        Ex.
  2192.  
  2193.        declare variables
  2194.           x as number : total as number
  2195.        end
  2196.        for customers
  2197.           total = 0
  2198.           for invoices with acno = customers.acno
  2199.              display status "Totalling invoices for" + Customers.name
  2200.              delay 200
  2201.              customers.balance = total
  2202.              update record
  2203.           next
  2204.        next
  2205.  
  2206.        In the above example, wherever a customer only has one or two
  2207.        invoices to total, the status display would change very
  2208.        quickly.  By including a 200 millisecond delay you can ensure
  2209.        that each customers name is on screen at least long enough to
  2210.        be read.
  2211.  
  2212.        Delay values outside of 1 - 5000 are ignored.
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                                  - 36 -
  2242. ................................................................................
  2243.        DELETE CHOICE LISTS        UTILITY          DELETE CHOICE LISTS
  2244.  
  2245.        If you have Choice lists for choice fields that are no longer
  2246.        required you can delete them with this utility.
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.                                  - 37 -
  2299. ................................................................................
  2300.        DELETE RECORD          PROCEDURE COMMAND          DELETE RECORD
  2301.  
  2302.        The "Delete Record" command is used for the selective deletion
  2303.        of records in a form.
  2304.  
  2305.        Ex.
  2306.  
  2307.        for books with title = input.title
  2308.           delete record
  2309.        next
  2310.  
  2311.        This deletes the single book whose title is that entered on the
  2312.        input screen.
  2313.  
  2314.        for books with author = input.author
  2315.           delete record
  2316.        next
  2317.  
  2318.        This deletes the records of all books by the author entered on
  2319.        the input screen.
  2320.  
  2321.        When you use the "Delete Record" command it has the same effect
  2322.        as deleting a record in data entry. In other words the record
  2323.        is marked for deletion but will not actually be removed from
  2324.        the form until the next re-pack.
  2325.  
  2326.        If you use the "Delete Record" command to delete large numbers
  2327.        of records then you should pack the form afterward.
  2328.  
  2329.        If you wish to delete all records in a form use the "Clear
  2330.        records" command not the "Delete Record" command.
  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.                                  - 38 -
  2356. ................................................................................
  2357.        DERIVE OFF             PROCEDURE COMMAND             DERIVE OFF
  2358.  
  2359.        Whenever an Easy Base procedure adds or updates a record then
  2360.        by default it checks the derivations of all fields during an
  2361.        add operation and any fields that are affected by an update
  2362.        operation. In other words, if you update the netprice field in
  2363.        a stock form and that form has derived fields for VAT and
  2364.        grossprice then those fields will also be updated.
  2365.  
  2366.        If the procedure adds or updates all fields then this process
  2367.        is superfluous and simply slows the procedure. You can disable
  2368.        form derivation checking with the "Derive Off" command.
  2369.  
  2370.        derive off
  2371.        for stock with item = input.item
  2372.           copy all from input
  2373.           update record
  2374.        next
  2375.  
  2376.        In the above example a stock form has several derived fields
  2377.        but the input screen also does the same derivations. There is
  2378.        therefore no need to re-check them when the record is updated.
  2379.  
  2380.        As a general rule, in procedures which add or update records
  2381.        from an input screen, you should derive all fields on the input
  2382.        screen rather than during the update process. The user will not
  2383.        notice the time taken to derive fields while he is filling them
  2384.        in but he will notice the time taken to derive them after he
  2385.        has pressed F2
  2386.  
  2387.        There is no corresponding "Derive On" command. Derivation
  2388.        checking is automatically turned back on at the end of the
  2389.        loop to which is prefixed by the "Derive Off" command. If you
  2390.        require derivation checking to be off for more than one loop in
  2391.        a procedure then you must issue the command before each loop.
  2392.  
  2393.  
  2394.        Note:-
  2395.  
  2396.        If the "Derive Off" command is not issued before a loop then
  2397.        form level derivations override procedure derivations. This is
  2398.        not normally a problem, but can be if you try to change the
  2399.        case of a field for printing.
  2400.  
  2401.        For customers
  2402.           customers.name = proper(customers.name)
  2403.           print list items
  2404.        next
  2405.  
  2406.        If the "Name" field on the "Customers" form is derived as
  2407.        Upper(name) then the procedure will print the customers names
  2408.        in upper case.  You can overcome the problem either by
  2409.        cancelling the field derivation or by transferring the
  2410.        customers name to a variable and converting that to proper.
  2411.  
  2412.                                  - 39 -
  2413. ................................................................................
  2414.        DISPLAY STATUS         PROCEDURE COMMAND         DISPLAY STATUS
  2415.  
  2416.        If you write a procedure which has no output then Easy Base
  2417.        will display a "Running" flash at the top right hand side of
  2418.        the screen. For procedures which only take a few seconds to run
  2419.        this is sufficient to let the operator know that something is
  2420.        happening. For procedures that take some time to complete you
  2421.        should include a status display showing the progress of the
  2422.        procedure. A status display not only allays the nagging
  2423.        suspicion that the system has hung up but also allows the
  2424.        operator to estimate how long it will take.
  2425.  
  2426.        To create a status display just issue the command "Display
  2427.        Status" followed by a message composed of text in quotation
  2428.        marks and fields or variables concatenated by the + sign.
  2429.  
  2430.        Ex.
  2431.  
  2432.  
  2433.        declare variables
  2434.           x as number : y as number
  2435.        end
  2436.        for employees with taxcode = input.oldtaxcode
  2437.           y = total copies :exit for    'get copies to y for display
  2438.        next
  2439.        for employees with taxcode = input.oldtaxcode
  2440.           x = x + 1
  2441.           display status "Updating Record" + x + "of" + y
  2442.           employees.taxcode = input.newtaxcode
  2443.           update record
  2444.        next
  2445.  
  2446.        The status line is displayed centrally in a small window when
  2447.        the procedure runs. A Status line can have a maximum of 68
  2448.        characters. If you create a status line of more than 68
  2449.        characters then it will be cut short to that length.
  2450.  
  2451.        If you need to display counters in two nested loops then write
  2452.        the full display line in the outer loop and "display status"
  2453.        with no parameters in the inner loop.
  2454.  
  2455.        for customers
  2456.           x = x + 1
  2457.           - loop statements -
  2458.           display status "Checking Invoice" + y + "of customer" + x
  2459.           for invoices with customer = customers.name
  2460.              y = y + 1
  2461.              - Loop Statements -
  2462.              display status
  2463.           next
  2464.        next
  2465.  
  2466.  
  2467.  
  2468.  
  2469.                                  - 40 -
  2470. ................................................................................
  2471.        DO..LOOP               PROCEDURE COMMAND               DO..LOOP
  2472.  
  2473.        The "Do" loop structure is used in the Easy Base Procedure code
  2474.        to repeat a series of commands or statements. Whenever a
  2475.        procedure reaches a "Do" command it repeats all the statements
  2476.        between the "Do" and the "Loop" statements until the loop is
  2477.        broken by an "Exit Do" command.
  2478.  
  2479.        Ex.
  2480.  
  2481.        The following code fragment prints 10 copies of the top fifty
  2482.        best selling items in a "stock" form.
  2483.  
  2484.  
  2485.        .........................code............................
  2486.        declare output fields
  2487.           stock.item : stock.sales : today
  2488.        end
  2489.        Declare variables
  2490.           copies as number : items as number
  2491.        end
  2492.        today = system date
  2493.        do
  2494.           copies = copies + 1 :items = 0
  2495.           if copies = 11 then exit do
  2496.           bold on
  2497.           print report header
  2498.           bold off
  2499.           for stock with sales in reverse order
  2500.              items = items + 1
  2501.              if items = 51 then exit for
  2502.              print list items
  2503.           next
  2504.           bold on : print report footer : bold off
  2505.           page feed
  2506.        loop
  2507.        ............................format.....................
  2508.        .Report Header
  2509.           ═════════════════════════════════════════════════════
  2510.           Top 50 Best Selling Items               {today field}
  2511.           ═════════════════════════════════════════════════════
  2512.        .list items
  2513.              {stock.item field}        {stock.sales field}
  2514.        .Report Footer
  2515.           ═════════════════════════════════════════════════════
  2516.        .end
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.                                  - 41 -
  2527. ................................................................................
  2528.        DUPLICATE PREVENTION        METHOD         DUPLICATE PREVENTION
  2529.  
  2530.        1.  Where "Blank" values are acceptable.
  2531.  
  2532.        Quite often you will come across a situation where a field must
  2533.        not have duplicate entries but can still be left blank. You
  2534.        cannot define this field as unique because that would prevent
  2535.        more than one blank entry.  A good example of such a situation
  2536.        is in the "Menus Form" of Easy Base. The definition and unique
  2537.        field is the "Menu Title" but no two records may have the same
  2538.        entry in the sign on "Password" field.
  2539.  
  2540.        To prevent duplicate entries other than blanks you must enter a
  2541.        relationship between the form and itself with the field to be
  2542.        tested as the related field in both primary and secondary
  2543.        forms.
  2544.  
  2545.        The field is then derived as :-
  2546.  
  2547.        If(lookup(menus,password) <> blank,blank[beepDuplicate Password
  2548.                 !],password)
  2549.  
  2550.        2.   When entering records via procedures.
  2551.  
  2552.        When you use a procedure to enter a new record to a form it is
  2553.        not automatically checked as "Unique".   To ensure that
  2554.        duplicate entries are not entered via procedures you must check
  2555.        that the data entered on the procedures input screen is unique
  2556.        to the form you are about to enter it to before running the
  2557.        procedure.  For example: If you were about to enter a record to
  2558.        the "Manufacturers" form in which the "Name" field was unique
  2559.        then the "Name" field on the input screen would be derived:-
  2560.  
  2561.           if(lookup(manufacturers,name) <> blank,blank[beepDuplicate
  2562.                      Name !cursor name],name)
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.                                  - 42 -
  2584. ................................................................................
  2585.        ESCAPE ON/OFF          PROCEDURE COMMAND          ESCAPE ON/OFF
  2586.  
  2587.        When a procedure is running in Easy Base, it cannot, by
  2588.        default, be interrupted. If your procedure simply lists data to
  2589.        the screen then the end user may not need to see the entire
  2590.        output. You can allow the user to terminate a procedure
  2591.        prematurely with the "Escape On" command.
  2592.  
  2593.        If a procedure performs several tasks, you can selectively
  2594.        enable and disable the Escape Key with the commands "Escape On"
  2595.        and "Escape" Off"
  2596.  
  2597.        Ex.
  2598.  
  2599.        For newpayscales
  2600.           print list items
  2601.        next
  2602.        escape off
  2603.        for newpayscales
  2604.           for employees with scale = newpayscales.scale
  2605.              employees.rate = newpayscales.rate
  2606.              update record
  2607.           next
  2608.        next
  2609.        escape on
  2610.        for employees
  2611.           print newpay
  2612.        next
  2613.  
  2614.        In the above example a procedure lists new pay scales, updates
  2615.        the "Employees" form with the new pay rate and then lists the
  2616.        employees with their new rates.
  2617.  
  2618.        While the procedure is running the operator can terminate it
  2619.        during either of the lists but he cannot terminate it during
  2620.        the process of updating the "Employees" form.
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.                                  - 43 -
  2641. ................................................................................
  2642.        EXIT BATCH MENU        PROCEDURE COMMAND        EXIT BATCH MENU
  2643.  
  2644.        The "Exit Batch Menu" command terminates a current Batch Menu
  2645.        and returns control to the menu which called it.
  2646.  
  2647.        Ex.
  2648.  
  2649.        An application starts with a batch menu which calls a second
  2650.        batch menu which performs regular daily tasks. It then calls
  2651.        the main user menu. If the application is exited after the
  2652.        daily tasks batch menu has been completed then you will not
  2653.        wish to re-run the daily tasks when the application is
  2654.        restarted on the same day. To prevent this create a form
  2655.        "tasksdone" with a single field "date" and enter a single
  2656.        record with yesterdays date.
  2657.  
  2658.        The first procedure on the daily tasks batch menu would then be
  2659.  
  2660.        for tasksdone
  2661.           if tasksdone.date = system date then
  2662.              exit batch menu
  2663.           else
  2664.              tasksdone.date = system date
  2665.              update record
  2666.           end if
  2667.        next
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.                                  - 44 -
  2698. ................................................................................
  2699.        EXIT PROCEDURE         PROCEDURE COMMAND         EXIT PROCEDURE
  2700.  
  2701.        The "Exit Procedure" command terminates a procedure.
  2702.  
  2703.        Ex.
  2704.  
  2705.        if input.codeword <> "fred" then exit procedure
  2706.        for staffconfidential with name = input.name
  2707.           print list items
  2708.        next
  2709.  
  2710.  
  2711.        If the procedure has a repeating input screen then this is
  2712.        cancelled by the "Exit Procedure" command.
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.                                  - 45 -
  2755. ................................................................................
  2756.        FIXED POINT               FIELD TYPE                FIXED POINT
  2757.  
  2758.        Fixed point fields can display up to 14 digits. They use the
  2759.        comma for thousands separation and the full stop for decimal
  2760.        separation.
  2761.  
  2762.        There are no rounding errors with fixed point fields.
  2763.  
  2764.        See - Operators arithmetic
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  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.                                  - 46 -
  2812. ................................................................................
  2813.        FLOATING POINT            FIELD TYPE             FLOATING POINT
  2814.  
  2815.        Floating point fields can display up to 14 digits. They do not
  2816.        have a thousands separator. They are left justified.
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  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.                                  - 47 -
  2869. ................................................................................
  2870.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2871.  
  2872.        The "For" command initiates loops which load records from forms
  2873.        for processing. All statements between the "For" and the "Next"
  2874.        commands are repeated for each record selected.
  2875.  
  2876.        Ex.
  2877.  
  2878.        For Videos
  2879.           If Videos.price = 2.00 then Videos.price = 2.50
  2880.           update record
  2881.        next
  2882.  
  2883.        In the above example each record in the "Videos" form is loaded
  2884.        into memory - the price field is checked and if it is 2.00 then
  2885.        it is altered to 2.50 - the record is then updated on disk.
  2886.  
  2887.        "For" loops can be nested to any depth.
  2888.  
  2889.        Ex.
  2890.  
  2891.        for videoprices
  2892.           for videos
  2893.              if videos.price = videoprices.price then
  2894.                 print list items
  2895.              end if
  2896.           next
  2897.        next
  2898.  
  2899.        In the above example the outer loop loads each record from the
  2900.        "Videoprices" form.  While each of these is in memory it then
  2901.        loads each record from the "Videos" form, tests to see if the
  2902.        price field in "Videos" is the same as the price field in
  2903.        "Videoprices" and if so prints the list items section of the
  2904.        report format (containing the video title field) thus grouping
  2905.        all video titles by price.
  2906.  
  2907.        If a "For" loop is unqualified as above then every record is
  2908.        processed starting at one and advancing in sequence. "For"
  2909.        loops can be qualified in several ways in order to select
  2910.        records in other orders or groups. The following qualifications
  2911.        are available:-
  2912.  
  2913.        For (form) with (fieldname) in order
  2914.        For (form) with (fieldname) in reverse order
  2915.        For (form) with (fieldname) =  (value)
  2916.        For (form) with (fieldname) >  (value)
  2917.        For (form) with (fieldname) <  (value)
  2918.        For (form) with (fieldname) >= (value)
  2919.        For (form) with (fieldname) <= (value)
  2920.        For (form) new record
  2921.  
  2922.        With the exception of the "New Record" qualification, all
  2923.        accept the suffix "Unique" and an "Alias" for the form name.
  2924.  
  2925.                                  - 48 -
  2926. ................................................................................
  2927.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2928.  
  2929.        If a "For" loop is qualified by "in order" or "in reverse
  2930.        order" then the records are selected in alphabetical or reverse
  2931.        alphabetical order if the selection field is text, and in
  2932.        numeric or reverse numeric order if the selection field is
  2933.        numeric.
  2934.  
  2935.        Ex.
  2936.  
  2937.        for books with title in order
  2938.           print list items
  2939.        next
  2940.  
  2941.        Ex.
  2942.  
  2943.        for salesmen with monthlysales in reverse order
  2944.           print list items
  2945.        next
  2946.  
  2947.        If a "For" loop is qualified by "in order unique" or "in
  2948.        reverse order unique" then records will be selected in order or
  2949.        in reverse order as above. However, where there are multiple
  2950.        occurrence of the same field value a "unique" loop will only
  2951.        select the first occurrence of each value if the loop is in
  2952.        order or the last occurrence if the loop is in reverse order.
  2953.  
  2954.        Ex.
  2955.  
  2956.        for books with category in order unique
  2957.           count = count + 1
  2958.           print list items
  2959.        next
  2960.        print categorycount
  2961.  
  2962.        This example prints and counts the different categories in the
  2963.        "books" form.
  2964.  
  2965.        Ex.
  2966.  
  2967.        for theatreseats with price in reverse order unique
  2968.           for seatprices new record
  2969.              seatprices.price = theatreseats.price
  2970.           next
  2971.        next
  2972.  
  2973.        The above example selects one example only of each seat price
  2974.        in an existing "theatreseats" form in descending price order
  2975.        and enters a new record in the new "seatprices" form.
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.                                  - 49 -
  2983. ................................................................................
  2984.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  2985.  
  2986.        If a "For" loop is qualified by a "Fieldname = " condition then
  2987.        only the record or records where the field contents match the
  2988.        condition will be selected.
  2989.  
  2990.        Ex.
  2991.  
  2992.        for books with category = "fiction"
  2993.           print list items
  2994.        next
  2995.  
  2996.        This example prints all books which have the category "fiction"
  2997.  
  2998.        Ex.
  2999.  
  3000.        For customers with acno = input.acno
  3001.           creditlimit = input.creditlimit
  3002.           update record
  3003.        next
  3004.  
  3005.        In this example the procedure has an input screen where the
  3006.        operator enters a customers account number and new credit
  3007.        limit. On pressing F2 the procedure finds the single record in
  3008.        the "Customers" form which has the input account number and
  3009.        updates the "creditlimit" field.
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                  - 50 -
  3040. ................................................................................
  3041.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3042.  
  3043.        If a "For" loop is qualified by a "with (fieldname) > " or
  3044.        "with (fieldname) >= " condition then records are selected in
  3045.        order like the "with (fieldname) in order" qualification but
  3046.        starting with the first record where the field contents match
  3047.        the condition value rather than the first record.
  3048.  
  3049.        Similarly the qualifications "with (fieldname) < " and "with
  3050.        (fieldname) <= " select records in reverse order but starting
  3051.        with the last record to match the condition value.
  3052.  
  3053.        In case you are new to progamming it should be pointed out that
  3054.        the relational operators >, <, >= and <= can be applied to text
  3055.        as well as to numbers. When they are applied to text they
  3056.        relate to the text's alphabetical order.
  3057.  
  3058.        These four qualifications provide the means to select any
  3059.        subset of records which has a range of values in a particular
  3060.        field.
  3061.  
  3062.        Ex.
  3063.  
  3064.        for pupils with age > 6
  3065.           if pupils.age = 12 then exit for
  3066.           print list items
  3067.        next
  3068.  
  3069.        This example prints the names of all pupils between the ages of
  3070.        seven and eleven. The "For" qualification starts selection in
  3071.        numeric order of age starting at seven and the "Exit for"
  3072.        command terminates the loop when the first pupil aged twelve is
  3073.        loaded.
  3074.  
  3075.        Ex.
  3076.  
  3077.        A "Videos" form has a compound index field called "catorder"
  3078.        which is derived by joining the text of the "category" and
  3079.        "title" fields. The following procedure selects all the videos
  3080.        which have the category entered on the input screen and lists
  3081.        them with the title in alphabetic order.
  3082.  
  3083.        for videos with catorder >= input.category
  3084.           if videos.category > input.category then exit for
  3085.           print list items
  3086.        next
  3087.  
  3088.        Ex.
  3089.  
  3090.        for vehicles with seats > 4 unique
  3091.           count = count + 1
  3092.        next
  3093.  
  3094.        "count" returns the number of different seat capacities > 4
  3095.  
  3096.                                  - 51 -
  3097. ................................................................................
  3098.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3099.  
  3100.        If a "For" loop is qualified by "new record" then no records
  3101.        are selected from the form. Instead, a new blank record is
  3102.        created at the "For" command, all statements between the "For"
  3103.        and "Next" commands apply to this new record and it is entered
  3104.        to the form at the "Next" command.
  3105.  
  3106.        Ex.
  3107.  
  3108.        for books new record
  3109.           books.dateinstock = system date
  3110.           copy all from input
  3111.        next
  3112.  
  3113.        This example enters a new record to the "Books" form making the
  3114.        "dateinstock" field equal the system date and copying all other
  3115.        fields from the procedures input screen.
  3116.  
  3117.        Ex.
  3118.  
  3119.        declare variables
  3120.          hourcount as number
  3121.        end
  3122.        '..............clear last wages
  3123.        clear records from wagelist
  3124.        '..........count employees hours from timesheet...
  3125.        for employees
  3126.           hourcount = 0
  3127.           for timesheet with worksno = employees.worksno
  3128.              hourcount = hourcount + timesheet.hours
  3129.           next
  3130.           for wagelist new record
  3131.              wagelist.worksno = employees.worksno
  3132.              wagelist.name = employees.name
  3133.              wagelist.hours = hourcount
  3134.              wagelist.grosswage = employees.wagerate * hourcount
  3135.           next
  3136.        next
  3137.        '.................print the wages list
  3138.        for wagelist with worksno in order
  3139.           print list items
  3140.        next
  3141.  
  3142.        This procedure starts by erasing the present contents of the
  3143.        "wagelist" form. It then selects each record from the
  3144.        "employees" form, counts all entries in the "timesheet" form
  3145.        for the employee and enters a new record in the "wagelist"
  3146.        form. Finally it prints the new wage list.
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.                                  - 52 -
  3154. ................................................................................
  3155.        FOR..NEXT              PROCEDURE COMMAND              FOR..NEXT
  3156.  
  3157.        Occasionally you may need to nest a "For" loop of a form within
  3158.        another "For" loop of the same form. If you do this, then in
  3159.        order to differentiate between the fields in the outer and
  3160.        inner loops you must allocate an "alias" name to the form in
  3161.        one of the loops. When you allocate an alias to a form name
  3162.        then all the fields of the form can also be referenced by the
  3163.        alias name.
  3164.  
  3165.        Ex.
  3166.        .......................procedure code...........
  3167.        declare output fields
  3168.           males : females : pupils.age
  3169.        end
  3170.        for pupils with age in order unique
  3171.           males = 0 : females = 0
  3172.           for pupils alias agegroups with age = pupils.age
  3173.              if agegroups.sex = "male" then
  3174.                 males = males + 1
  3175.              else
  3176.                 females = females + 1
  3177.              end if
  3178.           next
  3179.           print list items
  3180.        next
  3181.        ....................output format......................
  3182.        .list items
  3183.        There are {males} males and {females} females aged {pupils.age}
  3184.        .end
  3185.  
  3186.  
  3187.        This example counts and prints the number of male and female
  3188.        pupils in each age group.
  3189.  
  3190.        If you intend to print fields from one of the nested loops as
  3191.        the "Age" field above then you should give the alias name to
  3192.        the other loop. You can only declare an output field with the
  3193.        real form name. If you have to print fields from both loops
  3194.        then you must declare an "Ad Hoc" field and pass the alias
  3195.        fields contents to it for printing.
  3196.  
  3197.        If you need to exclude individual or groups of records from
  3198.        selection just use the "Skip Record" or "Skip Group" command.
  3199.  
  3200.        Ex.
  3201.  
  3202.        for videos with category in order
  3203.           if videos.category = "Cartoon" then skip group
  3204.           print list items
  3205.        next
  3206.  
  3207.  
  3208.  
  3209.  
  3210.                                  - 53 -
  3211. ................................................................................
  3212.        FORM LETTERS                METHOD                 FORM LETTERS
  3213.  
  3214.        To print form letters (circulars) with a different address and
  3215.        salutation for each entry in an address form simply type the
  3216.        entire letter between the .List Items and .End of the output
  3217.        format.
  3218.  
  3219.        .........................procedure code........
  3220.        Declare output fields
  3221.           Addr.name : Addr.street : Addr.town
  3222.           Addr.salutation
  3223.           date
  3224.        end
  3225.        date = datetext(system date)
  3226.        for addr
  3227.           print list items
  3228.           page feed
  3229.        next
  3230.  
  3231.        .........................output format........
  3232.        .List Items
  3233.                                               My street
  3234.                                               My county
  3235.                                               {date field  }
  3236.  
  3237.  
  3238.        {Addr.name field    }
  3239.        {Addr.street field  }
  3240.        {Addr.town field    }
  3241.  
  3242.  
  3243.        Dear {Addr.salutation},
  3244.  
  3245.            You are invited................................
  3246.        ...................................................
  3247.        ...................................................
  3248.        ..........................................
  3249.  
  3250.        Yours faithfully,
  3251.  
  3252.  
  3253.  
  3254.        Fred A Blogs
  3255.        .End
  3256.  
  3257.        Although this is the fastest way to produce a short form
  3258.        letter, the Format Editor is not the nicest place to write
  3259.        text. If you want the benefits of word wrap and spell checking
  3260.        then you can create a form in which to write the letter. Create
  3261.        text block fields to hold a page of text and a name field so
  3262.        that you can store many different letters and print them with
  3263.        the same procedure. If your letters are to be more than one
  3264.        page long then put the same name on each page.
  3265.  
  3266.  
  3267.                                  - 54 -
  3268. ................................................................................
  3269.        FORM LETTERS                METHOD                 FORM LETTERS
  3270.  
  3271.        To print the form letters from the "Letters" form your
  3272.        procedure must now have an input screen which looks up the name
  3273.        of the letter to be printed.
  3274.  
  3275.        '............................CODE.....................
  3276.        declare output fields
  3277.           addr.name : addr.street : addr.town :addr.salutation
  3278.           date :letters.block1 :letters.block2 :letters.block3
  3279.        end
  3280.        declare variables
  3281.           page as number
  3282.        end
  3283.        date = datetext(system date)
  3284.        for addr
  3285.           page = 0
  3286.           for letters with name = input.name
  3287.              page = page + 1
  3288.              if page = 1 then print list items
  3289.              if page > 1 then print extra
  3290.              page feed
  3291.           next
  3292.        next
  3293.  
  3294.        The output format is similar to that shown on the previous page
  3295.        but the text in the .list items section is replaced by the text
  3296.        block fields Letters.block1 ,letters.block2 and letters.block3
  3297.        and an additional section .extra is added which has the same
  3298.        text block fields but no address or salutation.
  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.                                  - 55 -
  3325. ................................................................................
  3326.        FORMATTED TEXT            FIELD TYPE             FORMATTED TEXT
  3327.  
  3328.        If you define a field with the type "formatted text" a window
  3329.        opens up in which you enter the formatting characters. The
  3330.        characters which are to be entered by the user are shown as
  3331.        question marks. Any other characters which you enter become
  3332.        permanent fixtures in the field. The "formatted text" field can
  3333.        be up to twenty characters long and can be used for dates,
  3334.        national insurance numbers etc.
  3335.  
  3336.        Formatted text fields should not be derived.
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.                                  - 56 -
  3382. ................................................................................
  3383.        GLOBAL DEFAULTS             METHOD              GLOBAL DEFAULTS
  3384.  
  3385.        In many instances, an application will use the same default
  3386.        values in many procedures and field derivations. If you
  3387.        "hardwire" these as constants into your procedures and code
  3388.        then they will all have to be changed when the default value
  3389.        changes.
  3390.  
  3391.        Easy Base is supplied with a single global defaults form for
  3392.        VAT rates but you can create your own for any particular
  3393.        application.
  3394.  
  3395.        For instance, should you write a payroll system you would wish
  3396.        to be able to update the tax rates and bands globally
  3397.        throughout your application when they change.
  3398.  
  3399.        To do this, create a form to hold all the global defaults. In
  3400.        addition to the default fields add a single character text
  3401.        field derived "X" and index it. You then enter a single record
  3402.        with all the default values. The "X" field is there to create
  3403.        an artificial relationship between any input screen and the
  3404.        defaults form in order to lookup defaults.
  3405.  
  3406.        Wherever you need one or more global defaults in an input
  3407.        screen you simply add an invisible "x" field and enter a
  3408.        relationship between the procedure and the defaults form
  3409.        linking the "x" fields.
  3410.  
  3411.        The field "Tax" can now be derived:-
  3412.  
  3413.           taxablepay * lookup(defaults,taxrate)
  3414.  
  3415.        Similarly, you can pre load variables in procedure code for the
  3416.        default values:-
  3417.  
  3418.        Declare variables
  3419.          Taxrate1 as number:Taxrate2 as number
  3420.          Taxband1 as number:Taxband2 as number
  3421.        end
  3422.        for defaults
  3423.          Taxrate1 = defaults.taxrate1 :Taxrate2 = defaults.taxrate2
  3424.          Taxband1 = defaults.taxband1 :Taxband2 = defaults.taxband2
  3425.        next
  3426.  
  3427.        When the taxrates change you only have to alter them once in
  3428.        the Defaults form.
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.                                  - 57 -
  3439. ................................................................................
  3440.        GLOBAL NUMBER            SYSTEM VALUE             GLOBAL NUMBER
  3441.  
  3442.        The variables you create in Easy Base procedures are local
  3443.        variables - they cease to exist when the procedure ends. So
  3444.        that you can pass messages between procedures Easy base
  3445.        provides a single global variable "Global Number".  Once you
  3446.        allocate a value to "Global Number" that value remains
  3447.        unchanged (even if your computer has been turned off) until you
  3448.        allocate another value to it. You can of course pass many
  3449.        messages between procedures simply by entering records in forms
  3450.        and re-reading them but using "Global Number" is much quicker.
  3451.  
  3452.        The following example uses "Global Number" to make access to a
  3453.        user menu restricted by password.
  3454.  
  3455.        Two procedures are defined. The first, "getpassword" has a
  3456.        password field on its input screen and the following code:-
  3457.  
  3458.        if input.password = "gingerbread" then
  3459.           global number = 1
  3460.        else
  3461.           global number = 0
  3462.        end if
  3463.  
  3464.        The second procedure "checkpassword" has the following code:-
  3465.  
  3466.        if global number <> 1 then exit batch menu
  3467.        global number = 0
  3468.  
  3469.        The open access menu system has an item for the restricted menu
  3470.        but instead of calling it direct it calls the menu "Password"
  3471.        which is a batch execute menu with the items
  3472.  
  3473.        run procedure ----  getpassword
  3474.        run procedure ----  checkpassword
  3475.        user menu     ----  restricted
  3476.  
  3477.        If the password "gingerbread" has not been entered in the
  3478.        "getpassword" input screen then "checkpassword" will return
  3479.        control to the original menu.
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.                                  - 58 -
  3496. ................................................................................
  3497.        GOTO (FIELD) NEXT      DERIVATION PREFIX      GOTO (FIELD) NEXT
  3498.  
  3499.        In an Easy Base form or procedure input screen the cursor moves
  3500.        from field to field in the default order top left to bottom
  3501.        right when you press the Return key. You can alter this default
  3502.        order by deriving any field with "Goto (fieldname) next". If
  3503.        the field from which you wish to redirect the cursor already
  3504.        has a derivation formula you simply add the "Goto - Next" as a
  3505.        prefix.
  3506.  
  3507.        Ex.
  3508.  
  3509.        goto price next
  3510.  
  3511.        goto item next default(lookup(stock,name))
  3512.  
  3513.        Cursor redirection with the "Goto - next" derivation only
  3514.        occurs when the Return key is pressed it is not activated if
  3515.        you move the cursor with the directional arrow keys.
  3516.  
  3517.  
  3518.        Note: You can only have one prefix on any one field derivation.
  3519.  
  3520.  
  3521.  
  3522.  
  3523.  
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.                                  - 59 -
  3553. ................................................................................
  3554.        HOURS                      FUNCTION                       HOURS
  3555.  
  3556.        This function returns the hour ( 1 to 23) of the time parameter
  3557.  
  3558.        Ex.  Hour(system time)
  3559.  
  3560.        Ex.
  3561.  
  3562.        Labourcharge = (hours(endtime)-hours(starttime))* rate
  3563.  
  3564.  
  3565.        Acceptable parameters:
  3566.  
  3567.        System time
  3568.        Time field
  3569.        Maketime function
  3570.        Time expression
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  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.                                  - 60 -
  3610. ................................................................................
  3611.        IF                         FUNCTION                          IF
  3612.  
  3613.        Ex.  if(num >= 0,"Positive","negative")
  3614.  
  3615.        The first parameter of the "if" function is an expression, the
  3616.        second is the value to be returned if the expression is true
  3617.        and the third is the value to be returned if the expression is
  3618.        false.
  3619.  
  3620.        If the third parameter is omitted and the expression is false
  3621.        then the field or variable retains any value it had before the
  3622.        function was called.
  3623.  
  3624.        The "if" function can be extended to a full "case" function
  3625.        simply by adding more expressions and return values.
  3626.  
  3627.        Ex.  if(num > 0,"Positive",num = 0,"Zero","Negative")
  3628.  
  3629.        There is no limit to the number of expressions and return
  3630.        values. If more than one expression is true the value returned
  3631.        is that for the first true expression. If none are true then
  3632.        the trailing value is returned as the "case else".
  3633.  
  3634.        Acceptable Parameters:
  3635.  
  3636.        Numeric expressions
  3637.        Quoted text
  3638.        Fields and variables
  3639.        Other nested functions
  3640.        System Values
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.                                  - 61 -
  3667. ................................................................................
  3668.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3669.  
  3670.        Easy Base recognizes the following "If Then Else"
  3671.        constructions.
  3672.  
  3673.        1.    if (condition) then (action)
  3674.              ------------------------------------------
  3675.        2.    if (condition) then (action) else (action)
  3676.              ------------------------------------------
  3677.        3.    if (condition) then
  3678.                 (action)
  3679.                 (action)
  3680.                 (action)
  3681.              end if
  3682.              -----------------------------------------
  3683.        4.    if (condition) then
  3684.                 (action)
  3685.                 (action)
  3686.              else
  3687.                 (action)
  3688.                 (action)
  3689.              end if
  3690.  
  3691.        If then constructions can be nested to any depth.
  3692.  
  3693.        if (condition) and (condition) then
  3694.           (action)
  3695.           if (condition) or (condition) then
  3696.              (action)
  3697.              (action)
  3698.           else
  3699.              (action)
  3700.              if (condition) eqv (condition) then (action)
  3701.              (action)
  3702.           end if
  3703.           if (condition) then (action)
  3704.        else
  3705.           (action)
  3706.        end if
  3707.  
  3708.        Easy base does not interpret "Else if" constructions.
  3709.  
  3710.        Easy base does not interpret two "if" conditions on one line.
  3711.  
  3712.  
  3713.        In the above examples "action" applies to any Easy base command
  3714.        or full "Do Loop" or full "For Next" structure.
  3715.  
  3716.        You cannot split a "Do Loop" structure and you can only split a
  3717.        "For Next" structure by a simple "If then" and "End if" with no
  3718.        "else" command.
  3719.  
  3720.        Ex. on next page.
  3721.  
  3722.  
  3723.                                  - 62 -
  3724. ................................................................................
  3725.        IF THEN ELSE           PROCEDURE COMMAND           IF THEN ELSE
  3726.  
  3727.        In the following example the procedure has an input screen with
  3728.        a field "type". "type" is a choice field with the choices "In
  3729.        age order", "In alphabetic order" and "By sex". The procedure
  3730.        code selects one of three listings from the "Pupils" form by
  3731.        splitting "For Next" structures by "If Then" structures.
  3732.  
  3733.        if input.type = "in age order" then
  3734.           for pupils with age in order
  3735.        end if
  3736.        if input.type = "in alphabetic order" then
  3737.           for pupils with name in order
  3738.        end if
  3739.        if input.type = "by sex" then
  3740.           for pupils with sex in order
  3741.        end if
  3742.           print list items
  3743.        next
  3744.        next
  3745.        next
  3746.  
  3747.        The structure above is the only one in which "For Next"
  3748.        structures can be split. There must be a separate "If Then"
  3749.        followed by "End If" for each "For". There must be a "Next for
  3750.        each "For"  and there cannot be an "Else" anywhere in the
  3751.        construction.
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.                                  - 63 -
  3781. ................................................................................
  3782.        INDEX OFF              PROCEDURE COMMAND              INDEX OFF
  3783.  
  3784.        When an Easy Base procedure adds, updates or deletes a record
  3785.        then by default it updates any affected index files. As the
  3786.        majority of transaction procedures act on a single record this
  3787.        is the fastest method of processing. It does of course require
  3788.        that the form is periodically re-packed.  If, however, a
  3789.        procedure is to add, update or delete many records then
  3790.        updating each affected index file on each iteration of the
  3791.        "For" loop can be much slower than ignoring the indices during
  3792.        the loop and re-writing them from scratch afterward.
  3793.  
  3794.        You can take the "re-write" option by issuing the command
  3795.        "Index off" before the "For" loop.
  3796.  
  3797.        index off
  3798.        for employees
  3799.          for wagelist new record
  3800.             wagelist.worksno = employees.worksno
  3801.             wagelist.taxcode = employees.taxcode
  3802.          next
  3803.        next
  3804.  
  3805.        Obviously re-writing an entire index file when only one or two
  3806.        records are affected would be slower than simply updating the
  3807.        indices. The actual point at which "Index Off" becomes faster
  3808.        can only be determined by trial but as a general rule the two
  3809.        systems take equal time when between 12 and 15 percent of the
  3810.        records of a file are affected and the advantage of "Index Off"
  3811.        becomes greater the bigger this percentage.
  3812.  
  3813.        There is no corresponding "Index On" command. Indexing is
  3814.        turned back on automatically and the index files are re-written
  3815.        at the end of the loop to which the command applies. If you
  3816.        require indexing off during more than one loop you must issue
  3817.        the command before each.
  3818.  
  3819.        index off
  3820.        for invoices with date < makedate(05,04,93)
  3821.           delete records
  3822.        next
  3823.        index off
  3824.        for invoices with customer = "john smith"
  3825.           invoices.customer = "John Smith Ltd"
  3826.           update record
  3827.        next
  3828.  
  3829.        If you prefix a loop which deletes records from a form then the
  3830.        form is packed at the end of the loop.
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.                                  - 64 -
  3838. ................................................................................
  3839.        Input Screen Format         METHOD          Input Screen Format
  3840.  
  3841.        All form and input screens can be presented either mounted in a
  3842.        window against a mottled background or exactly as drawn in form
  3843.        design. The windowing effect is done automatically if you leave
  3844.        a clear border around all text and fields. If you place fields
  3845.        or text anywhere against the edge of the screen (even invisible
  3846.        fields) then the window effect will not be invoked.
  3847.  
  3848.        If you do not want the window effect but you still wish to
  3849.        leave a clear border then you should place the invisible text
  3850.        character (ASCII 255) in the top left hand corner of the
  3851.        screen to disable it. To produce the invisible character hold
  3852.        down the Alt Key and type 255 on the numeric keypad.
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  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.                                  - 65 -
  3895. ................................................................................
  3896.        INSTALL FORM               UTILITY                 INSTALL FORM
  3897.  
  3898.        The "Install Form" utility is accessed from the Utilities menu.
  3899.        If you wish to include a form in one application which you
  3900.        designed in another then you cannot simply copy the files to
  3901.        the new applications directory as there will be no entry in the
  3902.        "Forms Directory" file.
  3903.  
  3904.        To install a form from another application - first get the
  3905.        forms DOS filename from that application then select "Install
  3906.        Form" from the utilities menu. You will be asked to supply the
  3907.        forms name and the full path and filename from where it is to
  3908.        be copied. Easy Base will then copy the forms definition file
  3909.        and make the appropriate entry in the "Forms Directory". It
  3910.        will then ask whether or not you wish the data to be copied
  3911.        from the original application.
  3912.  
  3913.        If you install a form from another application and it has
  3914.        "lookup" derivations or Choice List fields then you will have
  3915.        to create the relationships and choice lists in the new
  3916.        application. They are not automatically reproduced.
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922.  
  3923.  
  3924.  
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.                                  - 66 -
  3952. ................................................................................
  3953.        INSTALL PRINTER            UTILITY              INSTALL PRINTER
  3954.  
  3955.        The "Install printer" utility is accessed from the Utilities
  3956.        menu. It can also be included in a user menu so that end users
  3957.        of finished applications can install their printer without
  3958.        access to the system menus.
  3959.  
  3960.        When you select "Install Printer" you are offered a choice of
  3961.        ten printer drivers - five for named printers and five generic
  3962.        drivers. The drivers supplied cover virtually all printers
  3963.        except daisy wheels.
  3964.  
  3965.        When you have chosen your printer driver Easy Base then asks
  3966.        for the parallel port number to which printer output is to be
  3967.        sent - one or two. Easy Base does not have a built in serial
  3968.        port printer output. If your printer only has a serial input
  3969.        then you must redirect a parallel port with the DOS "Mode"
  3970.        command.
  3971.  
  3972.        Easy Base then asks how much paper wastage there is at the top
  3973.        of the page. This is quite important as it is used in
  3974.        conjunction with the paper size in use to determine the
  3975.        "Bottom Margin" value, used for pagination in printed reports.
  3976.  
  3977.        You are then asked for the wastage at the left margin. This
  3978.        information is used in the format editor to display the right
  3979.        edge of the paper at the different print sizes. There are only
  3980.        two settings for wastage at the left margin - zero and ¼ inch.
  3981.        If you have a cartridge fed printer such as a Laser or Bubble
  3982.        Jet then it will almost certainly be ¼ inch. If you have a
  3983.        traction or manual feed then you will be able to adjust the
  3984.        left margin and you should set it to zero.
  3985.  
  3986.        Finally you are asked for the top margin required in printed
  3987.        reports. This can only be between the value set as the printers
  3988.        inherent wastage and one inch.  The value you set here will be
  3989.        the default top margin for all printouts. If you need a larger
  3990.        top margin for certain printouts then you must include blank
  3991.        lines in the page header of the procedures output format.
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.                                  - 67 -
  4009. ................................................................................
  4010.        INSTALL PROCEDURE          UTILITY            INSTALL PROCEDURE
  4011.  
  4012.        The "Install procedure" utility is accessed from the
  4013.        Utilities menu and allows you to install procedures which you
  4014.        designed in another application. It is used exactly like the
  4015.        "Install Form" utility previously described.
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  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.                                  - 68 -
  4066. ................................................................................
  4067.        INTEGER                   FIELD TYPE                    INTEGER
  4068.  
  4069.        Integer fields can have up to 14 digits and use a comma as the
  4070.        thousands separator.
  4071.  
  4072.        Although integer fields display integers they store the result
  4073.        of any division correct to 15 significant figures.
  4074.  
  4075.        See - Operators Arithmetic
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.  
  4101.  
  4102.  
  4103.  
  4104.  
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.                                  - 69 -
  4123. ................................................................................
  4124.        INTEXT                     FUNCTION                      INTEXT
  4125.  
  4126.        This function returns the starting character number of one
  4127.        length of text within another.
  4128.  
  4129.        Ex.    Intext(companyname," and ")
  4130.               < Returns 7 if companyname = "Turner and Smith"
  4131.  
  4132.        The intext function returns 0 if the second parameter is not
  4133.        found in the first.
  4134.  
  4135.        Ex.
  4136.  
  4137.        If intext(customers.companyname," Ltd") <> 0 then
  4138.           customers.Ltd  = "yes"
  4139.           update record
  4140.        end if
  4141.  
  4142.        Acceptable parameters:
  4143.  
  4144.        Text field/variable
  4145.        Any function returning a text value
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.                                  - 70 -
  4180. ................................................................................
  4181.        JOINTEXT                   FUNCTION                    JOINTEXT
  4182.  
  4183.        Ex.  Jointext(forename,surname)
  4184.  
  4185.        The jointext function takes any number of parameters.
  4186.  
  4187.        Ex.  Jointext("Mr ",forename," ",surname," Esq.")
  4188.        Ex.  Jointext(if(sex=male,"Mr ","Ms "),surname)
  4189.  
  4190.        The "jointext" function will also perform any arithmetic
  4191.        operations required for a text output.
  4192.  
  4193.        Ex. Jointext("The Gross price is ",netprice *120/100)
  4194.  
  4195.        The "jointext" function is also used for creating compound
  4196.        index fields.
  4197.  
  4198.        Ex. Jointext(reverse(zeropad(price,4,2)),stockitem)
  4199.  
  4200.        This creates a field whose index allows a stock file to be
  4201.        listed with stockitem in alphabetical order but grouped by
  4202.        price in reverse order.
  4203.  
  4204.        If you "Jointext" a date or time field you will get the date or
  4205.        time's numeric value not the date or time's string
  4206.        representation. (See Compound Index)
  4207.  
  4208.        By default the "Jointext" function strips trailing blank space
  4209.        characters from the texts being joined. If you wish to join
  4210.        text in a Text Block field so that the second text starts on a
  4211.        new line then you can force this by including Chr$(13) which
  4212.        Easy base uses as a "New Line" flag.
  4213.  
  4214.        Ex.
  4215.  
  4216.            Jointext(block1,chr$(13),block2)
  4217.  
  4218.            <The text from block2 will start on a new line>
  4219.  
  4220.        Ex.
  4221.  
  4222.            Jointext(block1,chr$(13),chr$(13),block2)
  4223.  
  4224.           <There will be a blank line between block1 and block2>
  4225.  
  4226.        Acceptable Parameters:
  4227.  
  4228.        Numeric expressions
  4229.        Quoted text
  4230.        Fields and variables
  4231.        Other nested functions
  4232.        System Values
  4233.  
  4234.  
  4235.  
  4236.                                  - 71 -
  4237. ................................................................................
  4238.        LEFTTEXT                   FUNCTION                    LEFTTEXT
  4239.  
  4240.        This function returns a specified number of characters from the
  4241.        start of a field or variable.
  4242.  
  4243.        Ex.   Lefttext(salutation,2)
  4244.              < returns "Mr" from "Mr Smith" or "Ms" from "Ms Smith"
  4245.  
  4246.        Ex.   Lefttext(datetext(system date),4)
  4247.              < Returns 12th , 20th Etc.>   (European date format)
  4248.  
  4249.  
  4250.  
  4251.  
  4252.        Acceptable parameters:
  4253.  
  4254.        Text field/variable
  4255.        Any function returning a text value
  4256.  
  4257.  
  4258.  
  4259.  
  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.                                  - 72 -
  4294. ................................................................................
  4295.        LENGTHTEXT                 FUNCTION                  LENGTHTEXT
  4296.  
  4297.        This function returns the length of text in a field or variable
  4298.  
  4299.        Ex.   lengthtext(name)
  4300.              < Returns 4 if name = "Bill"  10 if name = "Bill Smith"
  4301.  
  4302.  
  4303.        Acceptable parameters:
  4304.  
  4305.        Text field/variable
  4306.        Any function returning a text value
  4307.  
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  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.                                  - 73 -
  4351. ................................................................................
  4352.        LIST FILE NAMES            UTILITY              LIST FILE NAMES
  4353.  
  4354.        When you give a name to a Form or Procedure in Easy Base it is
  4355.        not the actual DOS file name used. A Form has separate DOS
  4356.        files for its definition, its data and its indices. Similarly a
  4357.        procedure can have one or two files depending on whether or not
  4358.        it has an input screen. Within an application you never need to
  4359.        know the DOS filenames as Easy Base takes care of all disk
  4360.        activity in the background.
  4361.  
  4362.        You may however need to know the DOS filenames if you intend to
  4363.        export data to another program or copy a Form or Procedure from
  4364.        one application to another.
  4365.  
  4366.        You can list the DOS filenames for Forms and reports with the
  4367.        "List File Names" utility.
  4368.  
  4369.        The "List File Names" utility can also be called from a user
  4370.        menu without accessing the system.
  4371.  
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  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.                                  - 74 -
  4408. ................................................................................
  4409.        LIST VARIABLES         PROCEDURE COMMAND         LIST VARIABLES
  4410.  
  4411.        The "List Variables" command is a de-bugging facility for
  4412.        developers. If a procedure is not producing the expected
  4413.        results you can interrupt it at any point and view the contents
  4414.        of all fields and variables in memory at that point.
  4415.  
  4416.        Ex.
  4417.  
  4418.        for authors with surname in order
  4419.           if authors.surname = "kippling" then list variables
  4420.           for books with author = authors.surname
  4421.              print list items
  4422.           next
  4423.        next
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.                                  - 75 -
  4465. ................................................................................
  4466.        LOOKUP                     FUNCTION                      LOOKUP
  4467.  
  4468.        Ex. Lookup(customers,name)
  4469.  
  4470.        The first parameter is the name of a relationship defined in
  4471.        the relationships form. The second parameter is the name of the
  4472.        field in the secondary file whose value is to be looked up. The
  4473.        parameters are absolute. You cannot supply them as variables
  4474.        fields or the results of other functions.
  4475.  
  4476.        Unlike other functions, "lookup" can only be used in a field
  4477.        derivation, entry conditions and mandatory conditions. It has
  4478.        no meaning in the procedure language.
  4479.  
  4480.        A full description of how to use the Lookup function is given
  4481.        in the users manual
  4482.  
  4483.        Acceptable parameters
  4484.  
  4485.        1.   Relationship name
  4486.        2.   Field Name
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.  
  4513.  
  4514.  
  4515.  
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.                                  - 76 -
  4522. ................................................................................
  4523.        LOWER                      FUNCTION                       LOWER
  4524.  
  4525.        Returns the lower case of the parameter.
  4526.  
  4527.        Ex. lower(partname)
  4528.  
  4529.  
  4530.        Ex.
  4531.  
  4532.        Heading = Jointext("List of parts supplied by ",lower(makers.
  4533.        name))
  4534.  
  4535.  
  4536.        Acceptable parameters:
  4537.  
  4538.        Quoted text
  4539.        Text Field/variable
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  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.                                  - 77 -
  4579. ................................................................................
  4580.        MAKEDATE                   FUNCTION                    MAKEDATE
  4581.  
  4582.        The Easy base Date field is a six digit field which covers the
  4583.        century from 1 Jan 1981 to 31 Dec 2080 and upon which you can
  4584.        perform addition and subtraction operations in days.
  4585.  
  4586.        Ex. Duedate = Invoicedate + 30
  4587.  
  4588.        In order to provide this facility the date is held as a numeric
  4589.        value. You can only type a date directly into a date field.
  4590.  
  4591.        If you need to enter a date in a derivation or in a procedure
  4592.        code you must use the "makedate" function.
  4593.  
  4594.        Ex.  Makedate(5,11,95)
  4595.            < Returns 05/11/95 >
  4596.  
  4597.        Ex.  Nextmonth = month(system date)+1
  4598.             if nextmonth = 13 then nextmonth = 1
  4599.             Nextdelivery = makedate(1,nextmonth,year(system date))
  4600.             < Returns the date of the first of next month >
  4601.  
  4602.        Acceptable parameters
  4603.  
  4604.        Numeric value
  4605.        Numeric expression
  4606.        Numeric field/variable
  4607.        Any other function which returns a numeric value
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.  
  4634.  
  4635.                                  - 78 -
  4636. ................................................................................
  4637.        MAKETIME                   FUNCTION                    MAKETIME
  4638.  
  4639.        The value of a time field in Easy base is held as a numeric
  4640.        value representing the number of seconds past midnight. This
  4641.        allows you to perform addition and subtraction operations in
  4642.        seconds.
  4643.  
  4644.        Ex. Timetaken = Round(Endtime - Starttime / 60)
  4645.            < This returns the time taken in minutes >
  4646.  
  4647.        You can only enter a time directly into a time field.
  4648.  
  4649.        If you need to enter a time in a field derivation or in a
  4650.        procedure code you must use the "Maketime" function.
  4651.  
  4652.        Ex. Time = Maketime(20,20,00)
  4653.             <  returns 20:20:00  >
  4654.  
  4655.  
  4656.        Acceptable parameters:
  4657.  
  4658.        Numeric value
  4659.        Numeric expression
  4660.        Numeric field/variable
  4661.        Any other function which returns a numeric value
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.                                  - 79 -
  4693. ................................................................................
  4694.        MATHS                      FUNCTION                       MATHS
  4695.  
  4696.        The following maths functions can be used anywhere in Easy Base
  4697.        code or field derivations.
  4698.  
  4699.        Log()
  4700.        Log10()
  4701.        Sqrt()
  4702.        Sin()
  4703.        Cos()
  4704.        Tan()
  4705.        Atan()
  4706.        Deg-rad()     converts degrees to radians
  4707.        Rad-deg()     converts radians to degrees
  4708.        Exp()         Raises e (the base of natural logarithms) to the
  4709.                      power of the parameter
  4710.  
  4711.  
  4712.        Acceptable parameters:
  4713.  
  4714.        Numeric value
  4715.        Numeric expression
  4716.        Numeric field/variable
  4717.        Any function returning a numeric value
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  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.                                  - 80 -
  4750. ................................................................................
  4751.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4752.  
  4753.        Because the procedures you create in Easy Base have to be
  4754.        interpreted each time they are run they will tend to be slower
  4755.        than similar routines created in a compiled system. This is the
  4756.        unavoidable cost of ease of use. You can increase speed vastly
  4757.        by having the best DOS environment and by the way in which you
  4758.        write procedure code.
  4759.  
  4760.        DOS Environment.
  4761.  
  4762.        1.   Do not use a disk compression system.
  4763.  
  4764.        2.   Always load "Fastopen"  - The default settings are fine -
  4765.             just add the line "fastopen C:" to your AUTOEXEC.BAT file.
  4766.  
  4767.        3.   Use a Disk Cacheing system - The more memory you can
  4768.             allocate to it the better. Easy Software recommends
  4769.             PC-Cache from Centre Point with 2 Megabytes of expanded
  4770.             memory allocated. Smartdrive (Version supplied with
  4771.             Windows 3.1) was slightly faster but caused widespread
  4772.             disk corruptions during test "Power Failures".
  4773.        4.   Do not run any TSR programs (Especially Virus Checkers).
  4774.  
  4775.        Procedure Code.
  4776.  
  4777.        Avoid making calculations and derivations within "For" loops in
  4778.        procedures.
  4779.  
  4780.        If, for example, you had a form in which was recorded the
  4781.        length, breadth and depth of various blocks and you knew that
  4782.        at some point you would write a procedure which listed their
  4783.        volume. Add a field for volume to the form and derive it from
  4784.        the other fields. When you write the procedure you will simply
  4785.        list this field. If the field had not been added to the form
  4786.        then you would have to calculate its value on each iteration of
  4787.        the "For" loop.
  4788.  
  4789.        The time taken to derive each individual "Volume" field during
  4790.        record entry will not be noticeable but the time taken to
  4791.        derive the volume for every record during the procedure will.
  4792.  
  4793.        Keep "Running statistics".  If your program requires statistics
  4794.        derived from many hundreds or even thousands of records then
  4795.        having to wait for a procedure which calculates them each time
  4796.        you want up to date figures is a real pain.
  4797.  
  4798.        To keep "running statistics" create a form with a field for
  4799.        each statistic you require and enter a single record with zero
  4800.        values in each field. Make all entries, modifications and
  4801.        deletions to your data via procedures and you can update your
  4802.        statistics each time a record is added, modified or deleted.
  4803.  
  4804.        Example on next page.
  4805.  
  4806.                                  - 81 -
  4807. ................................................................................
  4808.        MAXIMIZING SPEED            METHOD             MAXIMIZING SPEED
  4809.  
  4810.        The following procedure code enters a record (collected via the
  4811.        input screen) to a purchases ledger and updates statistics used
  4812.        in the profit and loss account. It also updates the balance for
  4813.        the suppliers account.
  4814.  
  4815.        pause off : Escape off
  4816.        for purchases new record
  4817.           copy all from input
  4818.        next
  4819.        for stats
  4820.           if input.type = "Invoice" then
  4821.              stats.creditors = stats.creditors + input.amount
  4822.           end if
  4823.           if input.type = "CreditNote" then
  4824.              stats.creditors = stats.creditors - input.amount
  4825.           end if
  4826.           if input.type = "Payment" then
  4827.              stats.creditors = stats.creditors - input.amount
  4828.              if input.paidby = "cash" then
  4829.                 stats.cashbalance = stats.cashbalance - input.amount
  4830.              else
  4831.                 stats.bankbalance = stats.bankbalance - input.amount
  4832.              end if
  4833.           end if
  4834.        next
  4835.        for ACbalances with supplier = input supplier
  4836.           if input.type = "Invoice" then
  4837.              ACbalances.balance = ACbalances.balance + input.amount
  4838.           else
  4839.              ACbalances.balance = ACbalances.balance - input.amount
  4840.           end if
  4841.        next
  4842.  
  4843.        Whenever you need to know statistics for "Debtors", "Cash
  4844.        Balance" etc you can produce them instantly with a procedure
  4845.        which simply lists data from the statistics forms.
  4846.  
  4847.        Whenever you use running statistics in this way you should also
  4848.        create a procedure which does calculate them from the raw data.
  4849.        If you ever, for one reason or another, have to edit data
  4850.        directly in "Data entry" then your "running statistics" will no
  4851.        longer be accurate. You can run this procedure to correct them.
  4852.  
  4853.  
  4854.  
  4855.  
  4856.  
  4857.  
  4858.  
  4859.  
  4860.  
  4861.  
  4862.  
  4863.                                  - 82 -
  4864. ................................................................................
  4865.        MENU CALLS               MENU FUNCTION               MENU CALLS
  4866.  
  4867.        In addition to the utilities which can be called from user
  4868.        menus the following calls can also be made.
  4869.  
  4870.        Run Procedure :   Runs a pre-defined procedure
  4871.  
  4872.        Last Output   :   Recalls the output from a procedure
  4873.  
  4874.        Data Entry    :   Allows direct access to a form
  4875.  
  4876.        User Menu     :   Calls another user menu
  4877.  
  4878.        System Menus  :   Calls the Easy Base System menus
  4879.  
  4880.        Run external program :  Shells to another program - You cannot
  4881.        run another major program from within Easy Base - there is very
  4882.        little spare memory - this call is however useful for calling
  4883.        batch files which export data to other programs for later use.
  4884.  
  4885.  
  4886.  
  4887.  
  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.                                  - 83 -
  4921. ................................................................................
  4922.        MIDTEXT                    FUNCTION                     MIDTEXT
  4923.  
  4924.        This function returns a given number of characters from a given
  4925.        starting point in a field or variable.
  4926.  
  4927.        Ex.   Midtext(fileref,4,4)
  4928.              < Returns "Bill" from "TR/Bill/1243"
  4929.  
  4930.  
  4931.        Acceptable parameters:
  4932.  
  4933.        Text field/variable
  4934.        Any function returning a text value
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  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.                                  - 84 -
  4978. ................................................................................
  4979.        MINUTES                    FUNCTION                     MINUTES
  4980.  
  4981.        This function returns the minutes number from the time field
  4982.        parameter.
  4983.  
  4984.        Ex.    minutes(system time)
  4985.  
  4986.        Ex.
  4987.  
  4988.        Unitsperhour = rounddown(60/(minutes(endtime)-
  4989.        minutes(starttime)))
  4990.  
  4991.        Acceptable parameters:
  4992.  
  4993.        System time
  4994.        Time field
  4995.        Maketime function
  4996.        Time expression
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.  
  5027.  
  5028.  
  5029.  
  5030.  
  5031.  
  5032.  
  5033.  
  5034.                                  - 85 -
  5035. ................................................................................
  5036.        MOD                        FUNCTION                         MOD
  5037.  
  5038.        The Mod function returns the remainder of an integer division
  5039.  
  5040.        Ex. surplus rounds = mod(bullets,soldiers * ammoissue)
  5041.  
  5042.  
  5043.        Ex.
  5044.  
  5045.        for Historydates
  5046.           historydates.leapyear = "No"
  5047.           if mod(historydates.year,4) = 0 then
  5048.              historydates.leapyear = "Yes"
  5049.              update record
  5050.           end if
  5051.        next
  5052.        < This example fills a new field "leapyear" which has been
  5053.        added to the "Historydates" form after data has been entered>
  5054.  
  5055.        Acceptable parameters:
  5056.  
  5057.        Numeric value
  5058.        Numeric expression
  5059.        Numeric field/variable
  5060.        Any other function which returns a numeric value
  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.                                  - 86 -
  5092. ................................................................................
  5093.        MONTH                      FUNCTION                       MONTH
  5094.  
  5095.        This function returns the month number from a date parameter.
  5096.  
  5097.        Ex.    Month(system date)
  5098.  
  5099.        Ex.    Month(birthdate)
  5100.  
  5101.  
  5102.        Acceptable parameters
  5103.  
  5104.        System date
  5105.        Date field
  5106.        Makedate function
  5107.        Date expression
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  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.                                  - 87 -
  5149. ................................................................................
  5150.        MULTIPLE COLUMNS            METHOD             MULTIPLE COLUMNS
  5151.  
  5152.        You may occasionally need to list data in order but in more
  5153.        than one column. Indexes for technical manuals are a common
  5154.        example. It would be nice if you could send the printer head
  5155.        back to the top of the page for each column but you can't. You
  5156.        must therefore get all the data for each horizontal line into
  5157.        memory at the same time and then print it.
  5158.  
  5159.        The following example prints the "Title" field from a "Films"
  5160.        form in alphabetic order in two columns with fifty lines on
  5161.        each page. To do this a field "No" is added to the form. This
  5162.        is an integer field and it is indexed.
  5163.  
  5164.        declare output fields
  5165.           films.title : righttitle
  5166.        end
  5167.        declare variables
  5168.           x as number  : y as number : lasttitle as text
  5169.        end
  5170.        '................UPDATE THE No FIELD......
  5171.        for films with title in order
  5172.           y = total records
  5173.           x = x + 1
  5174.           display status "Updating No field record" + x + "of" + y
  5175.           films.No = x
  5176.           update record
  5177.        next
  5178.        '.................PRINT IN TWO COLUMNS.................
  5179.        x = 0                        'reuse x as counter
  5180.        do
  5181.           for films with title > lasttitle
  5182.              x = x + 1
  5183.              for films alias col2 with No = films.No + 50
  5184.                righttitle = col2.title
  5185.              next
  5186.              print list items
  5187.              lasttitle = righttitle : righttitle = blank
  5188.              if mod(x,50) = 0 then
  5189.                 page feed : Exit for
  5190.              end if
  5191.           next
  5192.           if lasttitle = blank then exit do
  5193.        loop
  5194.  
  5195.        ........................Format..................
  5196.  
  5197.        .list items
  5198.              { Films.title field  }      {  Righttitle Field  }
  5199.        .end
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.                                  - 88 -
  5206. ................................................................................
  5207.        MULTIPLE LINES         PROCEDURE COMMAND         MULTIPLE LINES
  5208.  
  5209.        You can place multiple code instructions on a single line of
  5210.        the code editor by separating them with a colon.
  5211.  
  5212.        Ex.
  5213.  
  5214.        for ledger with lineno = input.lineno
  5215.           ledger.net = input.net:ledger.vat = input.vat
  5216.           ledger.acno = input.acno:ledger.gross = input.gross
  5217.           update record
  5218.        next
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.  
  5228.  
  5229.  
  5230.  
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.  
  5240.  
  5241.  
  5242.  
  5243.  
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.                                  - 89 -
  5263. ................................................................................
  5264.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5265.  
  5266.        If you want to print procedure output on both sides of the
  5267.        paper then, unless you have a VERY expensive printer, the only
  5268.        way to achieve this is to print the odd pages, turn your paper
  5269.        over and print the even pages.  For a short report you can do
  5270.        this by setting paper feed to "Manual" from the utilities menu
  5271.        and turning each sheet over individually. If, however, you have
  5272.        a cut sheet feeder or a cartridge fed printer it is much
  5273.        quicker to print all the odd pages, turn them all over and then
  5274.        print all the even pages.
  5275.  
  5276.        To do this in Easy Base, issue the command "Odd Page Print"
  5277.        immediately before the print output and "Even Page Print"
  5278.        immediately after it.
  5279.  
  5280.        declare output fields
  5281.           customers.name : customers.phone
  5282.        end
  5283.        odd page print
  5284.        for customers with surname in order
  5285.           if bottom margin < .75 then page feed
  5286.           print list items
  5287.        next
  5288.        even page print    '(Easy Base pauses here till you are ready)
  5289.  
  5290.        If you will be binding your printed report down the left hand
  5291.        edge then you will need a larger left margin on the odd pages
  5292.        than on the even. If you start odd page printing with the
  5293.        command "Odd Page Print for Binding" then Easy Base will add
  5294.        half an inch to the format left margin when it prints the odd
  5295.        pages. You cannot alter the fixed value of half an inch but if
  5296.        you create your output format with a left margin of half an
  5297.        inch(suitable for the even pages) and print for binding, you
  5298.        will find that the resulting output suits most office binding
  5299.        systems.
  5300.  
  5301.        If you use Odd/Even page printing then it is important that you
  5302.        realize it is achieved by running the portion of your procedure
  5303.        between the "Odd Page Print" and "Even Page Print" twice -
  5304.        simply cancelling output to the printer at the appropriate
  5305.        times.  You must not, therefore include any commands which add,
  5306.        update or delete records between the commands. If you do they
  5307.        will be performed twice. Similarly if you are running a loop
  5308.        counter during the print process then it will have double the
  5309.        expected value after the "Even Page Print" command.
  5310.  
  5311.        The system value "Page Number" is reset to one at the "Even
  5312.        Page Print" command. If you include two separate sets of odd
  5313.        and even printing in a single procedure then you cannot use
  5314.        "Page Number" to number the second printout. You can of course
  5315.        use an ad hoc field. Just remember to reset it to one
  5316.        immediately before the "Even Page Print" command.
  5317.  
  5318.  
  5319.                                  - 90 -
  5320. ................................................................................
  5321.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5322.  
  5323.        This document was written in an Easy Base form "Ref" which has
  5324.        fields "Name", "Type", "Pageno" "Topicpage" and three text
  5325.        block fields "T1", "T2" and "T3". Each record holds one page of
  5326.        the reference manual and the pages were entered in no
  5327.        particular order. The following procedure was used to number,
  5328.        sort, index and print the manual.
  5329.  
  5330.        declare output fields
  5331.           ref.name : ref.type :ref.pageno
  5332.           ref.t1 : ref.t2 : ref.t3 : type : name
  5333.        end
  5334.        declare variables
  5335.           x as number : y as number
  5336.           namelen as number : typelen as number
  5337.        end
  5338.        '.....................NUMBER REFERENCE PAGES....
  5339.        for ref with name in order
  5340.           y = total records
  5341.           x = x + 1
  5342.           display status "Numbering page" + x + "of" + y
  5343.           ref.pageno = x : update record
  5344.        next
  5345.        odd page print for binding
  5346.        '...............PRINT COMMANDS INDEX........
  5347.        bold on : print commandheader : bold off
  5348.        for ref with type = "procedure command"
  5349.           subindex name
  5350.        next
  5351.        for ref with subindex in order
  5352.           if topicpage > 1 then skiprec  'only first page
  5353.           ref.name = proper(ref.name)    'of each topic listed
  5354.           print commands
  5355.        next
  5356.        '..............PRINT SYSTEM VALUES INDEX...
  5357.        bold on : print valuesheader : bold off
  5358.        for ref with type = "system value"
  5359.           subindex name
  5360.        next
  5361.        for ref with subindex in order
  5362.           if topicpage > 1  then skiprec
  5363.           ref.name = proper(ref.name)
  5364.           print values
  5365.        next
  5366.        page feed       '... eject first index page
  5367.  
  5368.        '......... subsequent index pages are produced with exactly
  5369.        '........ the sane code as above and are omitted for clarity.
  5370.  
  5371.        '......................MAIN REFERENCE.............
  5372.        page feed
  5373.        for ref with name in order
  5374.           namelen = lengthtext(ref.name)
  5375.  
  5376.                                  - 91 -
  5377. ................................................................................
  5378.        ODD/EVEN PAGE PRINT    PROCEDURE COMMAND    ODD/EVEN PAGE PRINT
  5379.  
  5380.           typelen = lengthtext(ref.type)
  5381.           '....centre justify type
  5382.           type = jointext(stringof((20-typelen)/2,chr$(255)),ref.type)
  5383.           '....right justify name
  5384.           name = jointext(stringof(20-namelen,chr$(255)),ref.name)
  5385.           bold on : print refheader : bold off  'type and names fields
  5386.           print list items                      't1, t2, t3
  5387.           bold on print reffoot                 'pageno
  5388.           page feed
  5389.        next
  5390.        even page print
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.                                  - 92 -
  5434. ................................................................................
  5435.        OPERATORS                 ARITHMETIC                  OPERATORS
  5436.  
  5437.        The arithmetic operators used in Easy Base are:-
  5438.  
  5439.        +   (addition)
  5440.  
  5441.        -   (subtraction and negation)
  5442.  
  5443.        *   (multiplication)
  5444.  
  5445.        /   (division)
  5446.  
  5447.        ^   (exponentiation)
  5448.  
  5449.        Where there are multiple operators in a derivation they are
  5450.        processed with the following precedence:-
  5451.  
  5452.        1.   Exponentiation
  5453.        2.   Negation
  5454.        3.   Multiplication and Division
  5455.        4.   Addition and Subtraction
  5456.  
  5457.        The default precedence can be altered by the use of
  5458.        parenthesis.
  5459.  
  5460.             Easy base does not perform Integer Arithmetic.
  5461.  
  5462.        When a numeric field shows the result of a division the
  5463.        "displayed" number is "truncated" to an integer in Integer
  5464.        fields and has the last digit rounded in Fixed Point and
  5465.        Floating Point fields.  The "Stored" value which is used in any
  5466.        further calculations, however, is always correct to 15
  5467.        significant figures irrelevant of field type.  For Example: If
  5468.        three fields x,y and z are defined as integers, y is derived as
  5469.        x/4 and z is derived as y*4 then when 9 is entered in x, y will
  5470.        derive as 2 but z will derive as 9 because it multiplies the
  5471.        "stored value" of 2.25 by 4 not the displayed value of 2.
  5472.  
  5473.        Handling arithmetic in this way means that, by default there
  5474.        are no rounding errors. This has several advantages not least
  5475.        that currency values need only ever be defined to two decimal
  5476.        places.
  5477.  
  5478.        It does mean, however, that should you require rounding errors
  5479.        to be carried forward you must use one of the Easy Base
  5480.        rounding functions on the result of any intermediate division.
  5481.  
  5482.        In the above example, had y been derived as "round(x/4)" then z
  5483.        would derive as 8.
  5484.  
  5485.        If a fourth field had the formula:- if(y = 2,5,10) it would
  5486.        only derive as 5 if y had been rounded or if 8 had been entered
  5487.        in x.
  5488.  
  5489.  
  5490.                                  - 93 -
  5491. ................................................................................
  5492.        OPERATORS                 RELATIONAL                  OPERATORS
  5493.  
  5494.        Easy base uses the following relational operators:-
  5495.  
  5496.        =    (equals)
  5497.        <>   (not equals)
  5498.        >    (greater than)
  5499.        <    (less than)
  5500.        >=   (greater than or equal to)
  5501.        <=   (less than or equal to)
  5502.  
  5503.  
  5504.        Where relational operators and arithmetic operators are both
  5505.        used in a derivation. Relational operations are performed after
  5506.        arithmetic operations.
  5507.  
  5508.        Text values are not case sensitive when compared with
  5509.        relational operators.
  5510.  
  5511.        When you compare two fields or variables, the comparison is
  5512.        numeric if both are numeric and alphabetic if both are
  5513.        alphabetic.  If you compare a numeric field with a text field
  5514.        then Easy Base will test to see if the text field contains a
  5515.        number.  If it does then the comparison will be numeric and if
  5516.        it does not then the comparison will be alphabetic.
  5517.  
  5518.        WARNING
  5519.  
  5520.        If you compare the result of a division in an integer or fixed
  5521.        point field using the = or the <> operators, then the value
  5522.        used for comparison will be the (accurate) stored value and not
  5523.        the "Truncated" number shown in the field.
  5524.  
  5525.        See Operators Arithmetic
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.                                  - 94 -
  5548. ................................................................................
  5549.        OPERATORS                  LOGICAL                    OPERATORS
  5550.  
  5551.        Easy Base uses the following logical operators:-
  5552.  
  5553.        1.  and
  5554.        2.  or
  5555.        3.  xor     (or exclusive)
  5556.        4.  eqv     (equivalence)
  5557.        5.  imp     (implication)
  5558.  
  5559.        Logical operations are performed last after arithmetic and
  5560.        relational.
  5561.  
  5562.        Logical operators return a boolean (true or false) value from
  5563.        two other boolean expressions.
  5564.  
  5565.        Ex.
  5566.  
  5567.        If(x = y and a = b,"Yes","No")
  5568.           < Yes is returned if both expressions are true >
  5569.  
  5570.        If(x = y or a = b,"Yes","No")
  5571.           < Yes is returned if either or both expressions are true >
  5572.  
  5573.        If(x = y xor a = b,"Yes","No")
  5574.           < Yes is returned if either one but not both are true >
  5575.  
  5576.        If(x = y eqv a = b,"Yes","No")
  5577.           < Yes is returned if both expressions are true or if both
  5578.             expressions are false >
  5579.  
  5580.        If(x = y imp a = b,"Yes","No")
  5581.  
  5582.           < Yes is returned for all combinations except the first
  5583.             expression being true and the second false >
  5584.  
  5585.        The Easy Base logical operators are primarily designed for use
  5586.        within the "If" function and in "If..Then..Else" constructions
  5587.        where their actual value is not relevant. If you wish to use
  5588.        the value of "false" in formulae then it is represented by 0.
  5589.        True can be represented by any value other than 0 and should
  5590.        not be used.
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.                                  - 95 -
  5605. ................................................................................
  5606.        OPTIONS                    UTILITY                      OPTIONS
  5607.  
  5608.        The "Options" utility allows you to select your preferred date
  5609.        format (European or North American).
  5610.  
  5611.        You can also enable or disable screen saving. If enabled the
  5612.        screen saver operates after three minutes without a keypress
  5613.        during record entry, procedure screen entry or if a menu is
  5614.        being displayed. The screensaver is never invoked while a
  5615.        procedure is running or while reformatting or re-indexing is
  5616.        taking place.
  5617.  
  5618.        The third option allows you to select the border style you
  5619.        require around menus and message boxes.
  5620.  
  5621.        Option four selects whether or not screen clearing will be done
  5622.        with the curtain effect.
  5623.  
  5624.        The options utility can be called as a user menu function so
  5625.        that an end user can access the facilities without access to
  5626.        the system menus.
  5627.  
  5628.  
  5629.  
  5630.  
  5631.  
  5632.  
  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.                                  - 96 -
  5662. ................................................................................
  5663.        OUTPUT                   SYSTEM VALUE                    OUTPUT
  5664.  
  5665.        When a user runs a procedure his choice of output, screen,
  5666.        printer or disk is stored in the system value "Output".
  5667.  
  5668.        By accessing the system value "Output" you can make your
  5669.        procedure do different things depending on where the output is
  5670.        to be sent.
  5671.  
  5672.        Ex.
  5673.  
  5674.        if output = "screen" then
  5675.           print heading1
  5676.        else
  5677.           print heading2
  5678.        end if
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.  
  5688.  
  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.                                  - 97 -
  5719. ................................................................................
  5720.        PACK DATA FORMS            UTILITY              PACK DATA FORMS
  5721.  
  5722.        The process of actually removing a deleted record from a form
  5723.        is time consuming. What actually happens is that all the "Live"
  5724.        records are copied to a temporary file. The original file is
  5725.        then deleted and the temporary one re-named to the original
  5726.        name. Because of this it is actually quicker to remove fifty
  5727.        "Dead" records than it is to remove one. To save you time Easy
  5728.        base follows the traditional data-base custom of simply marking
  5729.        records for deletion when you delete them. They are only
  5730.        physically removed from the form during a "Pack" operation.
  5731.        When you "Pack" a data file Easy Base also re-writes all the
  5732.        index files for that form. You can pack individual forms with
  5733.        the "Pack Data Forms" utility accessed from the Utilities menu.
  5734.        You can also call the "Pack Data Forms" utility as a User menu
  5735.        function. In a finished application any necessary packing would
  5736.        normally be done from a batch execute menu which would run
  5737.        while the computer was unattended.
  5738.  
  5739.        Forms in which records are regularly deleted should be packed
  5740.        regularly. If packing is not done then not only will you be
  5741.        wasting disk space but search operations will become
  5742.        progressively slower as the percentage of "Dead" records
  5743.        increases.
  5744.  
  5745.        This is fairly obvious - however it is not so obvious that a
  5746.        forms index files can accumulate "Dead" records even though
  5747.        none have been deleted from the main file. An index file is
  5748.        simply the indexed fields contents and record number arranged
  5749.        in order. If, having filed a record you then alter the contents
  5750.        of an indexed field and update the record then the original
  5751.        record in the index file is deleted and a new one entered.
  5752.  
  5753.        Index files with "Dead records" also waste disk space and slow
  5754.        search operations. You should therefore regularly pack any
  5755.        forms which are regularly updated.
  5756.  
  5757.        If you are unsure which forms need to be packed you can use the
  5758.        "Auto-Pack" utility which tests each form and each forms index
  5759.        files for "Dead" records. The form is packed if it or any of
  5760.        its index files is found to have more then 100 total or 10 per
  5761.        cent "Dead" records.
  5762.  
  5763.        Although "Auto-Pack" may seem the easy answer, an application
  5764.        will almost certainly have several forms with "Core" data which
  5765.        remain unchanged and therefore never require packing. If you
  5766.        can identify the forms which do need to be packed and do them
  5767.        individually or from a batch execute menu this will be less
  5768.        time consuming than always using the "Auto-Pack" facility.
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.                                  - 98 -
  5776. ................................................................................
  5777.        PAGE NUMBER              SYSTEM VALUE               PAGE NUMBER
  5778.  
  5779.        Whenever Easy Base is processing a procedure with an output it
  5780.        keeps track of the current page number (Even if you have not
  5781.        included Page Feed commands). You can use the system value
  5782.        "Page Number" to number the pages of your output. To use the
  5783.        "Page Number" value just include "Page Number" in your output
  5784.        field declarations.
  5785.  
  5786.        Declare output fields
  5787.           Customers.name : Customers.ACNO : Page Number
  5788.        end
  5789.  
  5790.        You can then use the "Page Number" field in the Page Header or
  5791.        Page Footer section of your output format.
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.                                  - 99 -
  5833. ................................................................................
  5834.        PAUSE ON/OFF           PROCEDURE COMMAND           PAUSE ON/OFF
  5835.  
  5836.        When an Easy Base procedure has an output to the screen, the
  5837.        output, by default scrolls continuously until the procedure is
  5838.        complete. You can allow the user to pause the output with the
  5839.        "Pause On" command.
  5840.  
  5841.        If a procedure performs several tasks then the pause facility
  5842.        can be selectively enabled and disabled at any point.
  5843.  
  5844.        Ex.
  5845.  
  5846.        for employees alias types with type in order unique
  5847.           pause off:escape off
  5848.           for employees alias group with type = types.type
  5849.              subindex surname
  5850.           next
  5851.           pause on
  5852.           for employees with subindex in order
  5853.              print list items
  5854.           next
  5855.        next
  5856.  
  5857.        The above code fragment prints employees details in type groups
  5858.        with surname in alphabetic order. During the procedure the user
  5859.        can pause the report while it is listing the output but not
  5860.        while it is subindexing the group.
  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.                                  - 100 -
  5890. ................................................................................
  5891.        PI                       SYSTEM VALUE                        PI
  5892.  
  5893.        You can use the value of π anywhere in field derivations or
  5894.        procedure code by quoting "Pi".
  5895.  
  5896.        Ex     circlearea = Pi / 4 diam^2
  5897.  
  5898.  
  5899.  
  5900.  
  5901.  
  5902.  
  5903.  
  5904.  
  5905.  
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.                                  - 101 -
  5947. ................................................................................
  5948.        PRESELECT              PROCEDURE COMMAND              PRESELECT
  5949.  
  5950.        The "Preselect" command sets highlighting of the next user menu
  5951.        when the procedure terminates.  If a procedure is normally
  5952.        followed by a particular selection from the menu then you can
  5953.        save the user the trouble of choosing it by issuing the
  5954.        "Preselect" command within the procedure.
  5955.  
  5956.        for currentcustomer
  5957.           currentcustomer.acno = input.acno
  5958.           update record
  5959.        next
  5960.        preselect 4
  5961.  
  5962.  
  5963.  
  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.                                  - 102 -
  6004. ................................................................................
  6005.        PRINT                  PROCEDURE COMMAND                  PRINT
  6006.  
  6007.        In Easy Base procedures, all output to the screen or printer is
  6008.        initiated with the "Print" command. The "Print" command prints
  6009.        sections from the procedures output format.
  6010.  
  6011.        Ex.
  6012.  
  6013.        '......................procedure code....
  6014.        Print report header
  6015.        for customers
  6016.           print list items
  6017.        next
  6018.        print report footer
  6019.        '......................Output Format.......
  6020.        .Report Header
  6021.              ════════════════════════════════════════════════
  6022.                            Customer List
  6023.              ════════════════════════════════════════════════
  6024.        .List Items
  6025.              {customers.name field}  {customers.phone field}
  6026.        .Report Footer
  6027.              ════════════════════════════════════════════════
  6028.        .end
  6029.  
  6030.        The format sections are marked with a full stop in the margin
  6031.        followed by the section name. When you type a full stop in the
  6032.        margin of the "Format editor" Easy Base will offer you a
  6033.        selection of section names. You do not have to use these - they
  6034.        are just some common names that can save you time. To enter
  6035.        your own section names just press escape and type in any name
  6036.        you wish.
  6037.  
  6038.        The ".end" section is not strictly necessary but it is easy to
  6039.        accidentally insert blank lines at the end of your format. By
  6040.        inserting ".end" at the end of the last section you will
  6041.        prevent these from being printed.
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.                                  - 103 -
  6061. ................................................................................
  6062.        PRINTER CONTROL        PROCEDURE COMMAND        PRINTER CONTROL
  6063.  
  6064.        When you send a procedure output to the printer Easy Base will
  6065.        initialize your printer at ten characters per inch, six lines
  6066.        per inch in draft mode.
  6067.  
  6068.        You can alter the printer mode anywhere within a procedure with
  6069.        the following printer controls.
  6070.  
  6071.        Bold On            Bold Off
  6072.        Underline On       Underline Off
  6073.        Italic On          Italic Off
  6074.        NLQ On             NLQ Off
  6075.  
  6076.        8 lpi      Sets printing to eight lines per inch
  6077.        6 lpi      Sets printing to six lines per inch
  6078.        10 cpi     Sets printing to ten characters per inch
  6079.        12 cpi     Sets printing to twelve characters per inch
  6080.        17 cpi     sets printing to either 15 or 17 depending on
  6081.                   printer
  6082.        Line Feed  Advances the print head one line
  6083.        Page Feed  Ejects the current page.
  6084.  
  6085.        Ex.
  6086.        NLQ On
  6087.        Bold on
  6088.        Print report header
  6089.        Bold Off
  6090.        12 CPI
  6091.        For customers
  6092.           print list items
  6093.           if bottom margin < 1.5 then
  6094.              Line feed : Bold On : 10 CPI
  6095.              Print Page footer
  6096.              Page feed
  6097.              Print Page header
  6098.              Bold Off : 12 CPI
  6099.           end if
  6100.        next
  6101.        Bold on:Italic On :10 CPI
  6102.        print report footer
  6103.  
  6104.        The above example turns Near Letter Quality printing on for the
  6105.        entire report. It prints page headers and footers in bold at 10
  6106.        characters per inch, list items at 12 characters per inch and
  6107.        the report footer in bold italics.
  6108.  
  6109.  
  6110.  
  6111.  
  6112.  
  6113.  
  6114.  
  6115.  
  6116.  
  6117.                                  - 104 -
  6118. ................................................................................
  6119.        PROPER                     FUNCTION                      PROPER
  6120.  
  6121.        This function returns the parameter with the first letter of
  6122.        each word in upper case and the rest in lower case. If you wish
  6123.        to enter initials in a field derived as proper and keep them in
  6124.        upper case then there must either be a space or a full stop
  6125.        between them.
  6126.  
  6127.        Ex.     Proper(Address)
  6128.  
  6129.        Ex.
  6130.  
  6131.        labelname = upper(company.name)
  6132.        insetname = proper(company.name)
  6133.  
  6134.  
  6135.        Acceptable parameters:
  6136.  
  6137.        Quoted text
  6138.        Text field/variable
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.  
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.  
  6174.                                  - 105 -
  6175. ................................................................................
  6176.        Q AND A INPUT SCREEN        METHOD         Q AND A INPUT SCREEN
  6177.  
  6178.        If, for a procedure you have to collect many items of data via
  6179.        an input screen, then presenting all the fields and their
  6180.        labels at once can be confusing to an operator.  You can start
  6181.        with an empty screen other than the first field and its prompt
  6182.        then have each subsequent prompt "Pop up" when the previous
  6183.        field has been filled.
  6184.  
  6185.        To do this you make all your input fields without a background
  6186.        (Text, Alt1 or Alt2) and you create fields for the prompts
  6187.        which have no user entry and also show no background.
  6188.  
  6189.        Ex.
  6190.  
  6191.        To collect data for paymethod, customer, and amount lay out the
  6192.        following fields:-
  6193.  
  6194.                Enter Method of payment....     { Paymethod Field }
  6195.                { Pop1 Field               }    { Customer Field  }
  6196.                { Pop2 Field               }    { Amount Field   }
  6197.  
  6198.        The "Pop1" field is derived:-
  6199.  
  6200.           If(Pop1 = blank and paymethod = blank,blank,"Enter Customers
  6201.                   name.........")
  6202.  
  6203.        and the "Pop2" field is derived:-
  6204.  
  6205.           If(Pop2 = blank and customer = blank,blank,"Enter Amount...
  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.                                  - 106 -
  6232. ................................................................................
  6233.        RANDOM                     FUNCTION                      RANDOM
  6234.  
  6235.        This function returns a random number between the upper and
  6236.        lower parameters.
  6237.  
  6238.        Ex.  Random(1,100)
  6239.           <Returns a random number between 1 and 100>
  6240.  
  6241.        Ex.  The two fields No and card simulate the random cutting of
  6242.        a deck of cards each time the No field is cleared.
  6243.  
  6244.        No field derivation:-
  6245.            if(no <> blank,no,random(1,52))
  6246.  
  6247.        Card field derivation:-
  6248.  
  6249.            jointext(if(mod(no,13) = 1,"Ace",mod(no,13) = 0,"King",
  6250.        mod(no,13) = 12,"Queen",mod(no,13) = 11,"Jack",mod(no,13)),
  6251.        " of ",if(no < 14,"Hearts",no < 27 ,"Clubs",no <40,"Diamonds",
  6252.        ,"Spades"))
  6253.  
  6254.  
  6255.        Acceptable parameters
  6256.  
  6257.        Numeric Value
  6258.        Numeric expression
  6259.        Numeric field/variable
  6260.        Any other function which returns a numeric value
  6261.  
  6262.  
  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.                                  - 107 -
  6289. ................................................................................
  6290.        REBUILD DIRECTORIES        UTILITY          REBUILD DIRECTORIES
  6291.  
  6292.        In Easy Base, all DOS file handling is taken care of for you in
  6293.        the background. To do this Easy Base maintains three
  6294.        "Directory" files in which the names which you give to forms,
  6295.        procedures and choice field lists are linked to the actual DOS
  6296.        filenames.
  6297.  
  6298.        The three files are :-
  6299.  
  6300.        BASE.DIR     The forms directory
  6301.        PROC.DIR     The procedures directory
  6302.        CHOICES.DIR  The choice list directory
  6303.  
  6304.        Because these are key files, Easy Base includes a utility which
  6305.        will rebuild them in the event of accidental erasure or
  6306.        corruption.
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.                                  - 108 -
  6346. ................................................................................
  6347.        RECORD NUMBER            SYSTEM VALUE             RECORD NUMBER
  6348.  
  6349.        If you derive a field with the formula "record number" it will
  6350.        be filled with the record number at the time of filing or
  6351.        reformatting.  Record number differs from "sequence" in the
  6352.        following way. Each time you derive a field with "sequence" you
  6353.        get the next sequencial number irrespective of whether the form
  6354.        has had records deleted and has been repacked. If a file has
  6355.        had at some time 500 records but now only has 20 the next
  6356.        derivation of "sequence" will be 501 and the next derivation of
  6357.        "record number" will be 21.
  6358.  
  6359.        The main use of "record number" is to renumber a set of records
  6360.        after deletions. To do this just add a new field to the form
  6361.        derived as record number. The field will be filled
  6362.        automatically during the data reformatting process.
  6363.  
  6364.        Record Number has no meaning in procedure code.
  6365.  
  6366.        See Also:-  Current Record Number
  6367.  
  6368.  
  6369.  
  6370.  
  6371.  
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.  
  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.                                  - 109 -
  6403. ................................................................................
  6404.        REMARK                 PROCEDURE COMMAND                 REMARK
  6405.  
  6406.        You can place remarks anywhere within Easy base procedure code
  6407.        by prefixing them with an apostrophe.
  6408.  
  6409.        Ex.
  6410.  
  6411.        '.................This entire line is a remark.....
  6412.        for pupils with age > 9
  6413.           if grade = "g" then skip record   'exclude g's from count
  6414.           count = count + 1                 'These are remarks
  6415.        next
  6416.        '..............................................
  6417.  
  6418.        All text to the right of the apostrophe is ignored at run time.
  6419.  
  6420.  
  6421.  
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  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.                                  - 110 -
  6460. ................................................................................
  6461.        RESTORE                    UTILITY                      RESTORE
  6462.  
  6463.        Easy Base will restore applications or data which it has backed
  6464.        up. You can only restore an application with the "Restore
  6465.        Application" utility called from the utilities menu and you can
  6466.        only restore data-only backups with the "Restore Data" utility
  6467.        called from a user menu.
  6468.  
  6469.  
  6470.        See Also:-  Backup
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.                                  - 111 -
  6517. ................................................................................
  6518.        RETAIL                     FUNCTION                      RETAIL
  6519.  
  6520.        The retail function returns the retail price given the
  6521.        wholesale price and the discount as a percentage of retail.
  6522.  
  6523.        Ex   Retail(cost,discount)
  6524.  
  6525.             < returns 125 if cost = 100 and discount = 20>
  6526.  
  6527.  
  6528.  
  6529.  
  6530.  
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.  
  6542.  
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.                                  - 112 -
  6574. ................................................................................
  6575.        RETEST                 DERIVATION PREFIX                 RETEST
  6576.  
  6577.        In Easy Base, fields are derived when a new record is started
  6578.        and when any other field which affects the derivation is
  6579.        changed. You can force a field to be rederived when F2 is
  6580.        pressed by prefixing the derivation with "retest".
  6581.  
  6582.        Suppose you have a field "degrees" in which the user must enter
  6583.        a number between 1 and 360.
  6584.  
  6585.        To prevent him entering an out of range number you could derive
  6586.        the field :-
  6587.  
  6588.        If(degrees<1 or degrees > 360,blank[beepInvalid number of
  6589.        degreesCursor degrees],degrees)
  6590.  
  6591.        The above derivation would prevent the user from filing a
  6592.        record with an out of range number. However, by the time he
  6593.        read the message, his entry would be blanked out. It would be
  6594.        better if the number he had typed could be left in the field so
  6595.        that he could see his error. To do this all you have to do is
  6596.        change "blank" to "degrees" in the above derivation.
  6597.  
  6598.        This however would allow the user ( Should he decide to ignore
  6599.        the message ) to then file the incorrect value. To leave the
  6600.        value in the field and still prevent the user from filing it,
  6601.        use the "retest" prefix.
  6602.  
  6603.        Retest If(degrees<1 or degrees > 360,degrees[beepInvalid number
  6604.        of degreesCursor degrees],degrees)
  6605.  
  6606.  
  6607.        Note: You can only have one prefix on any one field derivation.
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.  
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.  
  6620.  
  6621.  
  6622.  
  6623.  
  6624.  
  6625.  
  6626.  
  6627.  
  6628.  
  6629.  
  6630.                                  - 113 -
  6631. ................................................................................
  6632.        REVERSE                    FUNCTION                     REVERSE
  6633.  
  6634.        The reverse function is used in the creation of compound index
  6635.        fields. What it actually does is alter the characters of the
  6636.        parameter in such a way that an alphabetic listing of a field
  6637.        after reversal will have the reverse order to that of the
  6638.        original characters before using the reverse function.
  6639.  
  6640.        In the example shown for the function "zeropad", had you wished
  6641.        to list the pupils in descending age order there would be no
  6642.        point in using the procedure code:
  6643.  
  6644.        for pupils with unifield in reverse order
  6645.  
  6646.        as this would not only reverse the age grouping but would also
  6647.        reverse the name order.
  6648.  
  6649.        To produce the desired printout use exactly the same procedure
  6650.        but derive "unifield" as:-
  6651.  
  6652.        Jointext(reverse(zeropad(age,2,0)),name)
  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.                                  - 114 -
  6688. ................................................................................
  6689.        RIGHTTEXT                  FUNCTION                   RIGHTTEXT
  6690.  
  6691.        This function returns a specified number of characters from the
  6692.        end of a field or variable.
  6693.  
  6694.        Ex    Righttext(name,10)
  6695.  
  6696.  
  6697.        Ex.   Righttext(datetext(system date),4)
  6698.              < returns  1993 , 1994 Etc.>
  6699.  
  6700.  
  6701.        Acceptable parameters:
  6702.  
  6703.        Text field/variable
  6704.        Any function returning a text value
  6705.  
  6706.  
  6707.  
  6708.  
  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.                                  - 115 -
  6745. ................................................................................
  6746.        ROUND                      FUNCTION                       ROUND
  6747.  
  6748.        There are three rounding functions in Easy base:-
  6749.  
  6750.        Round
  6751.        Roundup
  6752.        Rounddown
  6753.  
  6754.        If a rounding function is called with a single parameter then
  6755.        the return value is the parameter rounded to the nearest
  6756.        integer value.
  6757.  
  6758.        Ex. Round(items/reps)
  6759.           < if items = 9 and reps = 4. 2 is returned >
  6760.  
  6761.        All rounding functions accept a second parameter indicating the
  6762.        number of decimal places (or powers of 10 if negative) to round
  6763.        to.
  6764.  
  6765.        Ex. Rounddown(vaton(net),2)
  6766.           < Rounds down the VAT on field "net" to the nearest penny.
  6767.  
  6768.        Ex. Jointext(roundup(if(mod(years,100) = 0,years+1,years),-2
  6769.            )/100,"th Century")
  6770.  
  6771.          < Returns "20th Century" for all values of years 1900-1999 >
  6772.  
  6773.  
  6774.        Round Produces a default rounding system in which:-
  6775.  
  6776.           2.4 rounds to  2
  6777.           2.5 rounds to  3
  6778.          -2.4 rounds to -2
  6779.          -2.5 rounds to -3
  6780.  
  6781.        In the Roundup and Rounddown functions the direction is sign
  6782.        sensitive:-
  6783.  
  6784.           2.5 roundsup to  3      2.5 roundsdown to  2
  6785.          -2.5 roundsup to -2     -2.5 roundsdown to -3
  6786.  
  6787.        Acceptable parameters:
  6788.  
  6789.        Numeric value
  6790.        Numeric expression
  6791.        Numeric field/variable
  6792.        Any other function which returns a numeric value
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.                                  - 116 -
  6802. ................................................................................
  6803.        RUN                      FIELD CONTROL                      RUN
  6804.  
  6805.        The "run" control is used to initiate procedures with input
  6806.        screens without the user having to press F2.
  6807.  
  6808.        Ex.   If(lookup(customers,name) = blank,blank,lookup(customers,
  6809.              name)[run])
  6810.  
  6811.        In the above example, a procedure which lists customers
  6812.        accounts has an input screen with a single field where the
  6813.        customers name is entered. When the user enters a name the
  6814.        above derivation will test whether or not the entered name is a
  6815.        customer. If the entered name does not exist in the customers
  6816.        file the field will be blanked out but if it does then the
  6817.        procedure will run without the user having to press F2.
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.  
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847.  
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.  
  6857.  
  6858.                                  - 117 -
  6859. ................................................................................
  6860.        SCREEN COLOURS             UTILITY               SCREEN COLOURS
  6861.  
  6862.        The "Screen Colours" utility provides 14 pre defined colour
  6863.        sets including two for "Mono Graphics" cards together with a
  6864.        user defined setup. To change the colours of your system simply
  6865.        select "Screen Colours" from the Utilities menu and select the
  6866.        set you want.
  6867.  
  6868.        The "Screen Colours" utility can also be called as a User Menu
  6869.        function allowing an end user to change his screen set from
  6870.        your menus without accessing the system.
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876.  
  6877.  
  6878.  
  6879.  
  6880.  
  6881.  
  6882.  
  6883.  
  6884.  
  6885.  
  6886.  
  6887.  
  6888.  
  6889.  
  6890.  
  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.                                  - 118 -
  6916. ................................................................................
  6917.        SECONDS                    FUNCTION                     SECONDS
  6918.  
  6919.        This function returns the seconds number from the time
  6920.        parameter.
  6921.  
  6922.        Ex.    seconds(system time)
  6923.  
  6924.  
  6925.        Acceptable parameters:
  6926.  
  6927.        System time
  6928.        Time field
  6929.        Maketime function
  6930.        Time expression
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.  
  6938.  
  6939.  
  6940.  
  6941.  
  6942.  
  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.                                  - 119 -
  6973. ................................................................................
  6974.        SEQUENCE                 SYSTEM VALUE                  SEQUENCE
  6975.  
  6976.        When you create a new form a sequence value is updated each
  6977.        time a record is entered. The "sequence" value starts at 1 and
  6978.        continues to 2 billion irrespective of whether or not records
  6979.        have been deleted from the form. If you derive a field as
  6980.        "sequence" then each new record will have the next sequenced
  6981.        number. Sequence derivations are useful for such things as
  6982.        invoice numbers.
  6983.  
  6984.        A sequence field need not start at one however.
  6985.  
  6986.        Ex.  sequence + 1000 would number the first record 1001
  6987.  
  6988.        The sequence value is only available in data entry to a form.
  6989.        A common problem in data systems is to produce a sequence
  6990.        number when records are entered to forms via procedures.
  6991.  
  6992.        To accomplish this define fields to hold the number on both the
  6993.        form and the procedure input screen. Also define a single
  6994.        character text field, let's call it x on both. This field can
  6995.        be invisible. The x field in the form is indexed but not
  6996.        derived. The x field on the input screen is derived as "x".
  6997.        A relationship, let's call it "invoice" is entered between the
  6998.        input screen and the form relating the two "x" fields.
  6999.        Assuming the fields for the sequence number are called "invno"
  7000.        the field on the input screen is derived as:-
  7001.  
  7002.           lookup(invoice,invno)+ 1
  7003.  
  7004.        To update the x field in the form which is used purely as a
  7005.        flag to mark the last record your procedure code would be
  7006.        something like:-
  7007.  
  7008.        for invoices with x = "x"
  7009.           invoices.x = blank
  7010.           update record
  7011.        next
  7012.        for invoices new record
  7013.           copy all from input
  7014.        next
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.  
  7029.                                  - 120 -
  7030. ................................................................................
  7031.        SET PAPER LENGTH           UTILITY             SET PAPER LENGTH
  7032.  
  7033.        The "Set Paper Length" utility is accessed from the
  7034.        Utilities menu and can also be called from a user menu.
  7035.  
  7036.        There are settings for A3, A4, A5, American Letter and
  7037.        American Legal in both portrait and landscape.
  7038.  
  7039.        When you change the paper length in use then you update
  7040.        pagination for all report outputs.
  7041.  
  7042.        The landscape options are for use in wide carriage printers
  7043.        where the paper can be fed in landscape orientation they do not
  7044.        produce "sideways" printing on narrow carriage printers.
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.  
  7053.  
  7054.  
  7055.  
  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.                                  - 121 -
  7087. ................................................................................
  7088.        SKIP GROUP             PROCEDURE COMMAND             SKIP GROUP
  7089.  
  7090.        The "Skip Group" command excludes an entire group of records
  7091.        from selection by a "For" loop.
  7092.  
  7093.        Ex.
  7094.  
  7095.        for employees with type in order
  7096.           if employees.type = "Part time" then skip group
  7097.           print list items
  7098.        next
  7099.  
  7100.        The "Skip Group" command is not the same as filtering with a
  7101.        "<>" condition.  You could achieve the same result with :-
  7102.  
  7103.        for employees with type in order
  7104.           if employees.type <> "Part time" then
  7105.              print list items
  7106.           end if
  7107.        next
  7108.  
  7109.        but the second procedure would take much longer to run as each
  7110.        part time employee's record would be loaded into memory only to
  7111.        be rejected by the "If" condition.  The first procedure on the
  7112.        other hand only loads a single part time employee's record then
  7113.        skips the entire group by advancing the index pointer in use
  7114.        for record selection.
  7115.  
  7116.        You can also use the "Skip Group" command to terminate
  7117.        selection of a group of records at a given point.
  7118.  
  7119.        declare variables
  7120.           count as number
  7121.        end
  7122.        for employees with type in order
  7123.           count = count + 1
  7124.           if count = 51 then
  7125.              count = 0
  7126.              skip group
  7127.           end if
  7128.           print list items
  7129.        next
  7130.  
  7131.        The above procedure prints the first fifty employees in each
  7132.        "type" group.
  7133.  
  7134.  
  7135.        The "Skip Group" command can be shortened to "Skipgrp"
  7136.  
  7137.  
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.                                  - 122 -
  7144. ................................................................................
  7145.        SKIP RECORD            PROCEDURE COMMAND            SKIP RECORD
  7146.  
  7147.        The "Skip Record" command is used to exclude individual records
  7148.        from selection in a "For" Loop.
  7149.  
  7150.        Ex.
  7151.  
  7152.        for employee with worksno in order
  7153.           if employees.worksno = 12 then skip record
  7154.           print list items
  7155.        next
  7156.  
  7157.        The "Skip Record" command has exactly the same effect as
  7158.        filtering with a "<>" condition but is much easier to write if
  7159.        there are many items to exclude
  7160.  
  7161.        for employees with worksno in order
  7162.           if employees.worksno = 12 or employees.worksno = 15 then
  7163.              skip record
  7164.           end if
  7165.           if employees.name = "smith" then skip record
  7166.           if employees.age > 50 then skip record
  7167.        next
  7168.  
  7169.        You can exclude groups of records from an inner loop by
  7170.        applying the "Skip Record" command to a "Unique" outer loop.
  7171.  
  7172.  
  7173.        for employees alias types with type in order unique
  7174.           if types.type = "director" then skip record
  7175.           if types.type = "part time" then skip record
  7176.           for employees with type = types.type
  7177.              print list items
  7178.           next
  7179.        next
  7180.  
  7181.  
  7182.        If you need to exclude groups of records from a single loop you
  7183.        must use the "Skip Group" command.
  7184.  
  7185.  
  7186.        The "Skip Record" command can be shortened to "Skiprec".
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193.  
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.                                  - 123 -
  7201. ................................................................................
  7202.        SPACEPAD                   FUNCTION                    SPACEPAD
  7203.  
  7204.        The Spacepad function pads a text variable to a given length
  7205.        with spaces.
  7206.  
  7207.        Ex.   Spacepad(name,10)
  7208.              < returns "Fred      " if name = "Fred"
  7209.  
  7210.        The spacepad function is used in the creation of compound index
  7211.        fields.
  7212.  
  7213.        For example:    A "Films" form has the fields "title" and
  7214.        "category". To list the films grouped by category in order and
  7215.        with the titles in each category in order create the field
  7216.        "groupindex" as text,long enough to hold both category and
  7217.        title fields and derived as :-
  7218.  
  7219.        Jointext(spacepad(category,15),title)
  7220.                        {15 is length of category field}
  7221.  
  7222.        You can then produce the required printout with the following
  7223.  
  7224.        procedure.
  7225.  
  7226.        ....................format.........................
  7227.  
  7228.        .Report header
  7229.          ═══════════════════════════════════════════════════════════
  7230.                         FILM LIST BY CATEGORY
  7231.          ═══════════════════════════════════════════════════════════
  7232.        .Group header
  7233.          Films in {category field}
  7234.        .List items
  7235.         {title field} Starring {Star field} Running time {length Fld}
  7236.        .end
  7237.  
  7238.        ......................procedure code.................
  7239.        declare output fields
  7240.           films.title:films.star:films.length:films.category
  7241.        end
  7242.        declare variables
  7243.           catcheck as text
  7244.        end
  7245.        '............
  7246.        bold on
  7247.        print report header
  7248.        for films with groupindex in order
  7249.           if films.category <> catcheck then
  7250.              bold on
  7251.              print group header
  7252.              bold off
  7253.           end if
  7254.           print list items
  7255.        next
  7256.  
  7257.                                  - 124 -
  7258. ................................................................................
  7259.        SPELLDAY                   FUNCTION                    SPELLDAY
  7260.  
  7261.        This function spells out the day of the number (1-7) parameter.
  7262.  
  7263.        Ex.   Spellday(dayofweek(system date))
  7264.  
  7265.  
  7266.        Acceptable parameters:
  7267.  
  7268.        Numeric value                              (1-7)
  7269.        Numeric expression evaluating to           (1-7)
  7270.        Numeric Field/variable holding value       (1-7)
  7271.        Any function returning a numeric value     (1-7)
  7272.  
  7273.  
  7274.  
  7275.  
  7276.  
  7277.  
  7278.  
  7279.  
  7280.  
  7281.  
  7282.  
  7283.  
  7284.  
  7285.  
  7286.  
  7287.  
  7288.  
  7289.  
  7290.  
  7291.  
  7292.  
  7293.  
  7294.  
  7295.  
  7296.  
  7297.  
  7298.  
  7299.  
  7300.  
  7301.  
  7302.  
  7303.  
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.                                  - 125 -
  7315. ................................................................................
  7316.        SPELLMONTH                 FUNCTION                  SPELLMONTH
  7317.  
  7318.        This function spells out the day of the number (1-12)
  7319.        parameter.
  7320.  
  7321.  
  7322.        Ex.   Spellmonth(month(system date))
  7323.  
  7324.        Ex.   Month = Spellmonth(month(invoices.date))
  7325.  
  7326.  
  7327.        Acceptable parameters:
  7328.  
  7329.        Numeric value                           (1-12)
  7330.        Numeric expression evaluating to        (1-12)
  7331.        Numeric Field/variable holding value    (1-12)
  7332.        Any function returning a numeric value  (1-12)
  7333.  
  7334.  
  7335.  
  7336.  
  7337.  
  7338.  
  7339.  
  7340.  
  7341.  
  7342.  
  7343.  
  7344.  
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.                                  - 126 -
  7372. ................................................................................
  7373.        START HERE             DERIVATION PREFIX             START HERE
  7374.  
  7375.        If, in a form or procedure input screen, you want the cursor to
  7376.        start in other than the top left field then derive the field in
  7377.        which you wish the cursor to start with "Start here" .
  7378.  
  7379.        If the field in which the cursor is to start already has a
  7380.        derivation then simply prefix the derivation with "Start here".
  7381.  
  7382.        Ex.
  7383.  
  7384.        start here Lookup(customers,name)
  7385.  
  7386.  
  7387.  
  7388.        Note: You can only have one prefix on any one field derivation.
  7389.  
  7390.  
  7391.  
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.  
  7400.  
  7401.  
  7402.  
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.                                  - 127 -
  7429. ................................................................................
  7430.        STRINGOF                   FUNCTION                    STRINGOF
  7431.  
  7432.        This function returns a string of characters.
  7433.  
  7434.        Ex.   Stringof(12,"-")
  7435.               < Returns "------------">
  7436.  
  7437.  
  7438.        Ex.  Stringof(5,chr$(240))
  7439.              < Returns "≡≡≡≡≡">
  7440.  
  7441.  
  7442.        One of the most useful applications of the "Stringof" function
  7443.        is to pad output fields in tabular reports with "." characters.
  7444.  
  7445.        Ex.
  7446.  
  7447.        Declare output fields
  7448.           stock.name : stock.price
  7449.        end
  7450.        for stock with name in order
  7451.           stock.name = jointext(stock.name,stringof(30-lengthtext(
  7452.                        stock.name),".")
  7453.           print list items
  7454.        next
  7455.  
  7456.  
  7457.        The printed output from the above report would be in the form:-
  7458.  
  7459.              Gizmo.........................  2.50
  7460.              Sprocket......................  9.95
  7461.              Widget........................  3.10
  7462.  
  7463.  
  7464.  
  7465.        Acceptable parameters:
  7466.  
  7467.        1   Any numeric field, variable, expression or function
  7468.        2   Single quoted character - Function returning a single
  7469.            character
  7470.  
  7471.  
  7472.  
  7473.  
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.  
  7483.  
  7484.  
  7485.                                  - 128 -
  7486. ................................................................................
  7487.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7488.  
  7489.        If you need to list records from a form in such a way that they
  7490.        are in groups but with each group in order, there are two ways
  7491.        to accomplish this. You can include a compound index field on
  7492.        the form or you can "subindex" the group during the procedure.
  7493.        The advantage of having a compound index is that no time is
  7494.        wasted "sorting" the sub group during any procedure that uses
  7495.        it and the disadvantage is that it uses extra disk space. As a
  7496.        general rule you should use a compound index where the sub
  7497.        groups are likely to be large and "subindex" during the
  7498.        procedure only if each sub group has up to a few dozen or so
  7499.        records or if you need to order unnatural groupings.
  7500.  
  7501.        Ex.
  7502.  
  7503.        for pupils alias agegroups with age in order unique
  7504.           for pupils alias sortgroup with age = agegroups.age
  7505.              subindex name
  7506.           next
  7507.           for pupils with subindex in order
  7508.              print list items
  7509.           next
  7510.        next
  7511.  
  7512.        The grouping can be extended to more than one level. The
  7513.        following example lists records from a "Videos" form grouped
  7514.        by rental price then by category and with the sub sub group
  7515.        titles in alphabetic order.
  7516.  
  7517.        for videos alias pricegroups with price in order unique
  7518.           for videos alias catgroups with category in order unique
  7519.              for videos alias group with category = catgroups.category
  7520.                 if group.price = pricegroups.price then
  7521.                    subindex title
  7522.                 end if
  7523.              next
  7524.              for videos with subindex in order
  7525.                 print list items
  7526.              next
  7527.           next
  7528.        next
  7529.  
  7530.        As you can see from the listing the output from these examples
  7531.        has to pause between groups while the subindex is written. If
  7532.        you have a 66 Mhz PC and there are twenty records in the sub
  7533.        group you probably won't notice but if you have a 12 Mhz
  7534.        machine and there are a thousand records in the sub group you
  7535.        may as well break for lunch!  If you write a "subindexing"
  7536.        procedure and find that the "Sorting" time is unacceptable then
  7537.        add a compound index field to the form.
  7538.  
  7539.  
  7540.  
  7541.  
  7542.                                  - 129 -
  7543. ................................................................................
  7544.        SUBINDEX               PROCEDURE COMMAND               SUBINDEX
  7545.  
  7546.        Although using compound index fields to produce group ordering
  7547.        is normally preferable to using "Subindex", there is one
  7548.        important area where "Subindex" is more flexible. That is where
  7549.        you need to order records in unnatural groups.
  7550.  
  7551.        Consider the "Videos" form which has fields for "Title" ,
  7552.        "RentalPrice" and "Category".
  7553.  
  7554.        Natural Groupings would be:-
  7555.  
  7556.        Titles with RentalPrice = £2
  7557.        Titles with Category = "Comedy"
  7558.        Titles with RentalPrice = £2 and category = "Horror"
  7559.  
  7560.        Unnatural groupings would be :-
  7561.  
  7562.        Titles with RentalPrice = £2 or Rentalprice = £1.50
  7563.        Titles With RentalPrice = £1.50 or Category = "Western"
  7564.  
  7565.        Although you can make compound index fields to produce
  7566.        unnatural groupings they are not flexible - You need a separate
  7567.        compound index for each unnatural group.
  7568.  
  7569.        If you wished to write a procedure which allowed the user to
  7570.        enter any two video "Categories" and have all titles with
  7571.        either of those two categories listed in order then you must
  7572.        use "Subindex".
  7573.  
  7574.        Ex.
  7575.  
  7576.        for videos alias cat1 with category = input.cat1
  7577.           subindex title
  7578.        next
  7579.        for videos alias cat2 with category = input.cat2
  7580.           subindex title
  7581.        next
  7582.        for videos with subindex in order
  7583.           print list items
  7584.        next
  7585.  
  7586.        You will notice in the above example that two "For" loops add
  7587.        records to the "Subindex" before it is used. Once you start a
  7588.        subindex you can add records to it as often as you wish before
  7589.        using it. Once you use it it is erased.
  7590.  
  7591.        You can only have one "Subindex" active at any time. You can
  7592.        use any number of "Subindexes" within one procedure but each
  7593.        one must be "used" before the next is started.
  7594.  
  7595.  
  7596.  
  7597.  
  7598.  
  7599.                                  - 130 -
  7600. ................................................................................
  7601.        SYSTEM DATE              SYSTEM VALUE               SYSTEM DATE
  7602.  
  7603.        You can use your computers inbuilt date anywhere in field
  7604.        derivations or procedure code by simply quoting "system date".
  7605.  
  7606.        Ex.
  7607.  
  7608.        for diary with date = system date
  7609.           print list items
  7610.        next
  7611.  
  7612.  
  7613.  
  7614.  
  7615.  
  7616.  
  7617.  
  7618.  
  7619.  
  7620.  
  7621.  
  7622.  
  7623.  
  7624.  
  7625.  
  7626.  
  7627.  
  7628.  
  7629.  
  7630.  
  7631.  
  7632.  
  7633.  
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.  
  7656.                                  - 131 -
  7657. ................................................................................
  7658.        SYSTEM TIME              SYSTEM VALUE               SYSTEM TIME
  7659.  
  7660.        You can use your computers inbuilt time anywhere in field
  7661.        derivations or procedure code by simply quoting "system time".
  7662.  
  7663.        Ex.
  7664.  
  7665.        for stockitems with stockno = input.stockno
  7666.           lastcheckeddate = system date
  7667.           lastcheckedtime = system time
  7668.           update record
  7669.        next
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679.  
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  
  7685.  
  7686.  
  7687.  
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.  
  7696.  
  7697.  
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.  
  7707.  
  7708.  
  7709.  
  7710.  
  7711.  
  7712.  
  7713.                                  - 132 -
  7714. ................................................................................
  7715.        TABULATION                  METHOD                   TABULATION
  7716.  
  7717.        To create a printout in which fields are enclosed within a
  7718.        lined table use the linedrawing facility in the format editor
  7719.        to create a page header and page footer containing the top and
  7720.        bottom of the table and insert only the vertical lines between
  7721.        the fields in the list items section.
  7722.  
  7723.        Ex.
  7724.  
  7725.        Declare output fields
  7726.           stock.name : stock.price
  7727.        end
  7728.        print page header
  7729.        for stock with name in order
  7730.           if bottom margin < 0.7 then
  7731.              print page footer
  7732.              page feed
  7733.              print page header
  7734.           end if
  7735.           print list items
  7736.        next
  7737.        print page footer
  7738.        Page feed
  7739.  
  7740.        ........................format.........................
  7741.  
  7742.        .page header
  7743.              ╔════════════════════╤═══════════════╗
  7744.              ║ Name               │  Price        ║
  7745.              ╠════════════════════╪═══════════════╣
  7746.        .list items
  7747.              ║ {Name Field     }  │ {Price Fld. } ║
  7748.        .page footer
  7749.              ╚════════════════════╧═══════════════╝
  7750.        .end
  7751.  
  7752.  
  7753.  
  7754.  
  7755.  
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.  
  7762.  
  7763.  
  7764.  
  7765.  
  7766.  
  7767.  
  7768.  
  7769.  
  7770.                                  - 133 -
  7771. ................................................................................
  7772.        TEXT                      FIELD TYPE                       TEXT
  7773.  
  7774.        The text field type can be up to 80 characters long.
  7775.  
  7776.        Cut copy and paste operations are available between all text,
  7777.        and textblock fields :
  7778.  
  7779.        Use Shift plus the arrow keys to mark the text you wish to cut
  7780.        or copy. When you release the keys the cut or copy choice will
  7781.        appear.
  7782.  
  7783.        To paste cut text position the cursor where you want it
  7784.        inserted and press Shift plus Ins.
  7785.  
  7786.        Spell Checking is also available in text fields -
  7787.           Press Ctrl + S
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  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.                                  - 134 -
  7828. ................................................................................
  7829.        TEXT BLOCK                FIELD TYPE                 TEXT BLOCK
  7830.  
  7831.        When you Define a field with the field type "Text Block" then
  7832.        instead of entering a field length you shade out the area which
  7833.        you wish the field to cover using the arrow keys.
  7834.  
  7835.        Textblock fields offer many of the facilities of a
  7836.        wordprocessor including cut and paste, wordwrap and spell
  7837.        checking.
  7838.  
  7839.        Useful widths for A4 and Letter size paper are 63 characters if
  7840.        you intend to print at 10 characters per inch and 75 characters
  7841.        if you intend to print at 12 characters per inch. This document
  7842.        for instance was created in 63 character wide text blocks.
  7843.  
  7844.        The maximum width of a text block field on screen is 80
  7845.        characters. You can however redefine it up to 230 characters
  7846.        wide in procedure printouts and Easy Base will reformat your
  7847.        paragraphs to the new width.
  7848.  
  7849.        A text block field is not a "memo" field. It can be indexed and
  7850.        derived.
  7851.  
  7852.  
  7853.  
  7854.  
  7855.  
  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.                                  - 135 -
  7885. ................................................................................
  7886.        TIME                      FIELD TYPE                       TIME
  7887.  
  7888.        The Easy Base "time" field has the eight character format:-
  7889.  
  7890.        11:20:20    (Hours:Minutes:Seconds)
  7891.  
  7892.        You can record time data in any format you wish by using a
  7893.        "Formatted Text" field but you must use a "Time" field if you
  7894.        wish to perform addition and subtraction operations on time
  7895.        values.  (in seconds)
  7896.  
  7897.        Time fields are automatically checked for validity.
  7898.  
  7899.  
  7900.        See Also:-  Maketime
  7901.  
  7902.  
  7903.  
  7904.  
  7905.  
  7906.  
  7907.  
  7908.  
  7909.  
  7910.  
  7911.  
  7912.  
  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.                                  - 136 -
  7942. ................................................................................
  7943.        TIMEAMPM                   FUNCTION                    TIMEAMPM
  7944.  
  7945.        This function returns the hour ( 0 - 12) plus am. or pm. from
  7946.        the time field parameter.
  7947.  
  7948.        Ex. Timeampm(system time)
  7949.  
  7950.        Ex.
  7951.        -------------------------format----------------------------
  7952.        .Report header
  7953.                       Appointments for {Apps.Date Field}
  7954.        .List items
  7955.                  {Apps.Name Field      }   at  {Time Field}
  7956.        .End
  7957.        -------------------------code----------------------------
  7958.        declare output fields
  7959.           Apps.name
  7960.           Apps.date
  7961.           Time
  7962.        end
  7963.        print report header
  7964.        for apps with date = system date
  7965.           time = timeampm(apps.time)
  7966.           print list items
  7967.        next
  7968.  
  7969.  
  7970.        Acceptable parameters:
  7971.  
  7972.        System time
  7973.        Time field
  7974.        Maketime function
  7975.        Time expression
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.  
  7994.  
  7995.  
  7996.  
  7997.  
  7998.                                  - 137 -
  7999. ................................................................................
  8000.        TOTAL COPIES             SYSTEM VALUE              TOTAL COPIES
  8001.  
  8002.        Whenever a procedure enters a "FOR" loop qualified by "With
  8003.        fieldname = " the total number of records which match the
  8004.        qualification value is available in the system value "Total
  8005.        Copies"
  8006.  
  8007.        Total Copies is extracted directly from the index file and
  8008.        relieves you of a time consuming loop all the way through a
  8009.        form updating a counter.
  8010.  
  8011.        In other words:-
  8012.  
  8013.        for books with category = "fiction"
  8014.           count = count + 1
  8015.        next
  8016.  
  8017.        can be replaced with:-
  8018.  
  8019.        for books with category = "fiction"
  8020.           count = total copies
  8021.           exit for
  8022.        next
  8023.  
  8024.        Unlike "Total Records" the "Total Copies" value never includes
  8025.        records marked for deletion.
  8026.  
  8027.        Easy Base does not track separate values for "Total Records" or
  8028.        "Total Copies" when there are nested "For" loops. The values
  8029.        are set for the outer loop on the first iteration and reset for
  8030.        the inner loop on its first iteration. If you need a value for
  8031.        "Total Records" or for "Total Copies" after your procedure has
  8032.        entered another loop then you must transfer the value to a
  8033.        variable while it is available. (See the example for "Display
  8034.        Status")
  8035.  
  8036.        Easy Base does not update "Total Records" or "Total Copies"
  8037.        when records are added or deleted during a procedure.
  8038.  
  8039.  
  8040.  
  8041.  
  8042.  
  8043.  
  8044.  
  8045.  
  8046.  
  8047.  
  8048.  
  8049.  
  8050.  
  8051.  
  8052.  
  8053.  
  8054.  
  8055.                                  - 138 -
  8056. ................................................................................
  8057.        TOTAL RECORDS            SYSTEM VALUE             TOTAL RECORDS
  8058.  
  8059.        Whenever a procedure enters a "FOR" loop the total number of
  8060.        records in the form is available in the system value "Total
  8061.        records"
  8062.  
  8063.        Ex.
  8064.        The following code fragment updates a "Customer summary" form
  8065.        with the total number of customers in the "Customers" form.
  8066.  
  8067.        declare variables
  8068.          tot as number
  8069.        end
  8070.        for customers with acno = 1
  8071.           tot = total records
  8072.           exit for
  8073.        next
  8074.        for customersummary
  8075.           customersummary.totalcustomers = tot
  8076.           update record
  8077.        next
  8078.  
  8079.        Caution.
  8080.  
  8081.        Provided that the "For" loop is qualified by a "with" statement
  8082.        then the "Total Records" value is extracted directly from the
  8083.        open index file and is the total number of "Live Records".
  8084.  
  8085.        If you access the "Total records" value in an unqualified "For"
  8086.        loop then there is no index file open and the "Total Records"
  8087.        value is derived by dividing the forms file length by the
  8088.        record length. It therefore represents the total number of
  8089.        records in the form "Live" and "Deleted".
  8090.  
  8091.        Ex.
  8092.  
  8093.        If a form "books" has 2000 records and 10 are marked for
  8094.        deletion at the next re-pack then "count" returns 1990 in:-
  8095.  
  8096.        for books with catalogueno = 1
  8097.          count = total records
  8098.        next
  8099.  
  8100.        and 2000 in :-
  8101.  
  8102.        for books
  8103.           count = total records
  8104.           exit for
  8105.        next
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.                                  - 139 -
  8113. ................................................................................
  8114.        TOTALS & SUB TOTALS         METHOD          TOTALS & SUB TOTALS
  8115.  
  8116.        To produce totals and sub totals in printouts use ad hoc fields
  8117.        to hold the values and increment them during each iteration of
  8118.        the output loops. The following code lists all entries in a
  8119.        clients time sheet form with the cost of work in hand totalled
  8120.        and sub totalled for each client.
  8121.  
  8122.        Declare output fields
  8123.          Clients.Name:Timesheet.Hrs:Timesheet.Mins:Timesheet.Amount
  8124.          Timesheet.date : Subtotal : Grandtotal
  8125.        end
  8126.        Print Report Header
  8127.        for Clients with name in order
  8128.           Print Group Header
  8129.           Subtotal = 0
  8130.           For Timesheet with Acno = Clients.Acno
  8131.              Subtotal = Subtotal + timesheet.amount
  8132.              Grandtotal = Grandtotal + Timesheet.amount
  8133.              Print List Items
  8134.           next
  8135.           Print Group Footer
  8136.        next
  8137.        Print report footer
  8138.  
  8139.        .......................Output Format.........................
  8140.        .Report Header
  8141.           ═════════════════════════════════════════════════════════
  8142.                     Work in Hand Totalled by Client
  8143.           ═════════════════════════════════════════════════════════
  8144.        .Group Header
  8145.  
  8146.           ██████████████████
  8147.        .List Items
  8148.              ████████      ██Hrs ██Mins                     ██████
  8149.        .Group Footer
  8150.                                                         ──────────
  8151.            Total for ██████████████████                 ██████████
  8152.                                                         ══════════
  8153.        .Report Footer
  8154.           ═════════════════════════════════════════════════════════
  8155.           Total Work In Hand                            ██████████
  8156.           ═════════════════════════════════════════════════════════
  8157.        .end
  8158.  
  8159.        The field in the Group Header is Clients.name
  8160.        The fields in List Items are Timesheet.date, Timesheet.Hrs,
  8161.        Timesheet.Mins and Timesheet.amount.
  8162.        The fields in Group Footer are Clients.name and Subtotal.
  8163.        The field in Report Footer is Grandtotal.
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.                                  - 140 -
  8170. ................................................................................
  8171.        UPDATE RECORD          PROCEDURE COMMAND          UPDATE RECORD
  8172.  
  8173.        The "Update record" command is used to alter the contents of
  8174.        one or many records in a form.
  8175.  
  8176.        Ex.
  8177.  
  8178.        for stock with item = input.item
  8179.           stock.price = input.price
  8180.           stock.pricechangedate = system date
  8181.           update record
  8182.        next
  8183.  
  8184.        This example changes the price of a single "Stock" item.
  8185.  
  8186.  
  8187.        for employees with taxcode = input.oldtaxcode
  8188.           employees.taxcode = input.newtaxcode
  8189.           update record
  8190.        next
  8191.  
  8192.        This example changes the taxcode field of all the employees
  8193.        whose present taxcode is the same as the input screen
  8194.        "oldtaxcode" to the input screen "newtaxcode".
  8195.  
  8196.  
  8197.        for employees
  8198.           employees.taxcode = employees.taxcode + 60
  8199.           update record
  8200.        next
  8201.  
  8202.        This example increases the taxcode of all employees by sixty.
  8203.  
  8204.  
  8205.  
  8206.  
  8207.  
  8208.  
  8209.  
  8210.  
  8211.  
  8212.  
  8213.  
  8214.  
  8215.  
  8216.  
  8217.  
  8218.  
  8219.  
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225.  
  8226.                                  - 141 -
  8227. ................................................................................
  8228.        UPPER                      FUNCTION                       UPPER
  8229.  
  8230.        Returns the Uppercase of a text field or variable.
  8231.  
  8232.        Ex.  Upper(postcode)
  8233.             < shows the postcode field in uppercase>
  8234.  
  8235.        Ex.
  8236.        '.......................
  8237.        declare output fields
  8238.           labelname
  8239.           labeladdress
  8240.           labelcode
  8241.        end
  8242.        for customers with maillist = "yes"
  8243.           Labelname = Upper(customers.name)
  8244.           Labeladdress = Upper(customers.address)
  8245.           Labelcode = customers.postcode
  8246.           print labels
  8247.        next
  8248.  
  8249.        Acceptable parameters:
  8250.  
  8251.        Quoted text
  8252.        Text field/variable
  8253.  
  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.                                  - 142 -
  8284. ................................................................................
  8285.        V.A.T. FUNCTIONS           FUNCTION            V.A.T. FUNCTIONS
  8286.  
  8287.        Easy Base has a set of five VAT rates which can be altered from
  8288.        the utilities menu. There are four VAT functions:-
  8289.           VATin
  8290.           VATon
  8291.           PlusVAT
  8292.           MinusVAT
  8293.  
  8294.        Ex.   VATin(retailprice,2)
  8295.               < Returns the VAT content of "retailprice" at VAT rate 2
  8296.  
  8297.        Ex.   VATon(netprice,4)
  8298.              < Returns the VAT to be added to "netprice" at VAT rate 4
  8299.  
  8300.        Ex.   PlusVAT(netprice,3)
  8301.              < Returns the VAT inclusive price at VAT rate 3>
  8302.  
  8303.        Ex.   MinusVAT(retailprice,2)
  8304.              < Returns the net price of "retailprice" before VAT at
  8305.                VAT rate 2>
  8306.  
  8307.         (assumes Retailprice as VAT Inclusive and Netprice exclusive)
  8308.  
  8309.        If the second parameter (rate) is omitted from any of the VAT
  8310.        functions then Rate 1 is assumed.
  8311.  
  8312.        Ex.   Gross = PlusVAT(input.net)
  8313.              < The variable "Gross" = the VAT inclusive of the input
  8314.               screen field "net" calculated at rate 1.>
  8315.  
  8316.        Although the VAT functions are primarily included for business
  8317.        applications, they can be used for any purpose where a
  8318.        percentage needs to be changed globally throughout an
  8319.        application without the need to alter each procedure or field
  8320.        derivation in which it is used.
  8321.  
  8322.        Acceptable parameters:
  8323.  
  8324.        1   Any numeric value, field, variable, expression or function
  8325.        2   As Parameter 1 but evaluating between 1 an 5
  8326.  
  8327.  
  8328.  
  8329.  
  8330.  
  8331.  
  8332.  
  8333.  
  8334.  
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.                                  - 143 -
  8341. ................................................................................
  8342.        YEAR                       FUNCTION                        YEAR
  8343.  
  8344.        This function returns the year number from a date parameter.
  8345.  
  8346.        Ex.    Year(system date)
  8347.  
  8348.        Ex.
  8349.  
  8350.        Carage = jointext((year(system date)-year(registered))," Years
  8351.        old")
  8352.  
  8353.  
  8354.        Acceptable parameters:
  8355.  
  8356.        System date
  8357.        Date field
  8358.        Makedate function
  8359.        Date expression
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  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.                                  - 144 -
  8398. ................................................................................
  8399.        ZEROPAD                    FUNCTION                     ZEROPAD
  8400.  
  8401.        The Zeropad function pads an integer or fixed point field to a
  8402.        given number of places left and right of the decimal point.
  8403.  
  8404.        Ex.  Zeropad(price,3,2)
  8405.             <Returns "001.50" if price = 1.5>
  8406.  
  8407.        Ex.  Zeropad(acno,6,0)
  8408.             <Returns "004532" if acno = 4,532>
  8409.  
  8410.        The Zeropad function can be used as in the second example to
  8411.        return a fixed length numeric string from an integer field.
  8412.        It's main use, however, is in the creation of fields for
  8413.        compound indices where one of the fields to be compounded is a
  8414.        number.
  8415.  
  8416.        For example: A school has all pupils names and ages recorded on
  8417.        a form in fields "name" and "age". To create an index which
  8418.        will list pupils names alphabetically but grouped by age a
  8419.        compound field which is invisible and does not allow user entry
  8420.        is created as a text field derived with:-
  8421.        Jointext(zeropad(age,2,0),name)
  8422.  
  8423.        Because the compound field is text the index file will be
  8424.        sorted alphabetically. If you sort the numbers 8,9 and 12
  8425.        alphabetically you get 12,8,9 because the one in 12 comes
  8426.        before 8. If however you sort the numbers 08,09 and 12
  8427.        alphabetically you get the correct numeric order.
  8428.  
  8429.        By using the zeropad function in the above example and indexing
  8430.        the compound field,let's call it "unifield" you could then
  8431.        print out the pupils in age groups with the names in each group
  8432.        arranged alphabetically.
  8433.        .........................format.................
  8434.        .group header
  8435.         Pupils aged {pupils.age field}
  8436.        .list items
  8437.                {pupils.name field}
  8438.        .end
  8439.        .........................procedure code.........
  8440.        declare output fields
  8441.           pupils.name:pupils.age
  8442.        end
  8443.        declare variables
  8444.           agecheck as number
  8445.        end
  8446.        agecheck = 0
  8447.        for pupils with unifield in order
  8448.           if pupils.age <> agecheck then print group header
  8449.           agecheck = pupils.age
  8450.           print list items
  8451.        next
  8452.  
  8453.  
  8454.                                  - 145 -
  8455. ................................................................................
  8456.