Logical expression calculation interface5428738Abstract A system and method for constructing logical, mathematical, and other action-oriented expressions for execution by a computer program. The system and method allows users to more easily design and construct even complex expressions that execute real-time decisions during program execution. The system and method reduces the complexity of creating such expressions by replacing logical constructs with visual equivalents generated by a user in step-by-step fashion on the computer display screen. Claims We claim: Description BACKGROUND AND SUMMARY OF THE INVENTION
______________________________________
Calculation Type
Description
______________________________________
Entry The calculation is performed as soon as a user
moves the focus to the form object that con-
tains the calculation, either by tabbing to it, by
using the mouse, or as a result of a calculation
action event.
Exit The calculation is performed after the user
leaves the form object, either by tabbing to
another form object or by moving the focus
with the mouse.
Action This option is available only for action
buttons. The calculation is performed as soon
as the user chooses the action button. Merely
tabbing to it does not instigate the calculation.
Change The calculation is checked to see whether it
needs to be recalculated whenever any change
is made to the form, including when the form
is opened.
Close The calculation is performed when the form is
closed or when a record is added to or modifi-
ed in a database.
______________________________________
Referring now to the working area 14 shown in FIG. 2, when the user selects the CREATE option from a menu, the working area 14 has the appearance shown. A single logic box 30 of the DO format is presented. Logic box 30 comprises an outer frame 31, an inner frame 32 outlining the working area of the box, a Maximize button 33, an INSERT button 34 and a label 35, here a "DO" label. The cursor 36 is initially positioned in the working area 37. The title bar 15 indicates that the form object for which the calculation is being created is called DueComp and that the calculation has been chosen to be of the Change type. As will be apparent, the calculation in this example determines whether an advance payment to an employee for travel expenses or the like exceeds the total expenses actually incurred and therefore whether additional reimbursement is required. The user can enter the desired calculation by typing the desired formulas in the working area of the logic box or, in the case of functions or operators, using the mouse as described above. If more room is needed to view or edit the text being placed in a calculation box, the user may enlarge it by clicking on the Maximize button. When the box has been maximized, a Minimize button will appear in the upper right comer, permitting the user to reduce the box to its normal size when desired. In some circumstances, such as the circumstances of the present example, the user may want to create a calculation that uses different formulas depending on the value of a condition. The present invention enables this to be done in a novel and easy-to-use way. A user desiring to create such a calculation can add an IF box above the DO box, either by clicking on the INSERT button 34 in the currently active DO box 30 or by choosing the INSERT command from the pull-down Edit menu. (In this invention, the term "above" means "before" in a logical sense.) The INSERT Options item on the Edit menu permits the user to insert the IF box above or below the current DO box. Two alternative boxes must exist below an IF box: a DO box, for use if the condition is satisfied, and an OTHERWISE box, for use if the condition is not satisfied. Therefore, when an IF box is added above an existing DO box, an OTHERWISE box will automatically appear beneath the IF box. As will be demonstrated later, there are also circumstances where a second or even more levels of conditions should be tested before an OTHERWISE box is appropriate, and in such circumstances one or more ELSE IF boxes can be created. FIG. 3 shows the appearance of the calculation screen after an INSERT command has been entered in DO box 30. DO box 30 has moved to the right, or below--in a logical sense--the inserted IF box 40. As mentioned, an OTHERWISE box 41 has also appeared, to account for the event that the condition tested for in the IF box is not satisfied. The box in which the cursor currently resides is considered the "live" box, and hence has the INSERT and MAXIMIZE buttons. FIG. 4 completes the illustration of the current example, by showing the calculation screen after the content of the calculations have been entered. As will be understood, the calculation first involves testing, in IF box 40, whether the quantity Advance is equal to or greater than the quantity TOTAL. If that condition is satisfied, compensation is due and the DO box calculates the amount by subtracting TOTAL from Advance. If the condition is not satisfied, the underlying computer program proceeds to the OTHERWISE box, where the user has chosen to make the result the display or use of the number 0. FIG. 5 shows a more complex calculation, after it has been fully implemented using the procedures just described. In FIG. 5, which includes only the working area 14, conditional calculations are shown which calculate a discount rate. Referring to the Figure, IF box 51 tests to see if the Company named is Jones Auto Mart. If that condition is met, the expression moves to the fight, to another IF box 52, and tests whether the quantity Total is equal to or greater than $1000. If that condition is also satisfied, the calculation moves again to the fight, to DO box 53, where it multiplies the Total by 0.75 to arrive a final number. If, however, the condition in IF box 52 is not met, i.e., if Total is less than $1,000., the calculation proceeds to OTHERWISE box 54 and calculates an answer by multiplying the Total by 0.90. Returning to the initial condition test performed in box 51, if Company does not equal Jones Auto Mart, the calculation moves downward, to ELSE IF box 56, where it tests for equality between Company and "Desert Industries." If that condition is satisfied, a further test is performed in IF box 57 to determine whether Total is equal to or greater than $600. If that condition is met, the calculation proceeds to DO box 58, where Total is multiplied by 0.8 to arrive at the answer. If the condition set forth in IF box 57 is not met, i.e., if Total is less than $600, the calculation proceeds downward, to OTHERWISE box 59 where the Total is multiplied by 0.95. If the ELSE IF condition in box 56 was not met, however, the calculation proceeds downward to OTHERWISE box 61, where the Total is left undiscounted. The user would create the boxes shown in FIG. 5 in a step-by-step manner shown in FIGS. 6a-6d, as he/she worked through the calculation logic. Each click of the mouse would create the next phase of the calculation, and the actual commands could be entered step-by-step or after the structure had been created. 1. The user will click on the INSERT button on the initial DO box, thereby causing the DO box to move to the fight, an IF box to appear where the DO box had been, and an OTHERWISE box to appear below the new IF box. See FIG. 6a. The condition--Company="Jones Auto Mart"--can now be inserted in the first IF box. 2. The user then moves the mouse to the DO box in its new location and clicks on the INSERT button of that box, thereby causing another IF box to be inserted, with its associated OTHERWISE box, and the DO box moves to the right again. The screen then has the appearance shown in FIG. 6b. At this point, the condition to be tested if the Company="Jones Auto Mart" condition is satisfied, may be entered. That condition is Total>=1000.00. The associated DO box command, Total* 0.75, may also be entered. Also the OTHERWISE box may be filled in with the calculation to be followed if the condition Total>=1,000.00 is not met: Total* 0.9. 3. The user can next generate the structure of boxes needed to check the condition to be tested if the condition Company="Jones Auto Mart" is not satisfied: Company="Desert Industries". That is done by moving the cursor to the OTHERWISE box created in the left-most column, activating it by clicking anywhere in the box, and then clicking on the INSERT button to add associated DO and OTHERWISE boxes. At this point, the display has the appearance shown in FIG. 6c. At this point, it will be noted, the IF box below the original IF box now bears a label ELSE IF, reflecting the fact that it is a condition to be tested if the initial condition is not satisfied. 4. Next, the user completes the box structure by activating the DO box associated with a positive condition Company="Desert Industries" and inserting an IF box to test for the size of the quantity Total. When the INSERT button is clicked in that DO box, another IF/OTHERWISE pair of boxes are inserted, and the screen display assumes the appearance shown in FIG. 6d. 5. At this point the logical structure has been created and the remaining (or all) the expressions can be inserted. While the foregoing calculation is easy to understand, indeed almost simplistic, when created and viewed according to the present invention, its creation in a traditional sense would be beyond the capabilities of untrained persons. In traditional notation, the calculation would be expressed as follows: If (the Company is Jones Auto Mart, then (if the Total is equal to or greater than $1000, then return Total * 0.75) otherwise (if the Total is less than $1000, then return Total * 0.90)) else if (the Company is Desert Industries, then (if the Total is equal to or greater than $600, then return Total * 0.80) otherwise (if the Total is less than $600, then return Total * 0.95)) otherwise return Total. It will be apparent that the system of the present invention, the step-by-step creation of a visual representation of the logical components of the calculation, makes it far easier to construct even complex calculations. The formation of the boxes on the screen, along with the highly structured manner in which they are created, assists the user in understanding the relationship between them and the flow of decisions throughout the expression. The interface guides the user into understanding his/her expression to be much like a decision tree or flow chart, but adds the additional element of dynamic creation and deletion of branches or termination points on demand. The present invention can also be used to select records from a database. If a form is linked to a database, a user can perform calculations according to the present invention on any data in the database as well as data contained in the current form. For example, a form might contain a field to calculate the average age of all employees whose records are contained in a database. To accomplish this result, as shown in FIG. 7, the user opens a form that has already been linked to a database or creates a database link for the open form. Next, the cursor is positioned in the IF box in which the selection is to be performed. (It is possible that the IF box will have first to be created, as described above.) When the user clicks on the IF box, a menu of choices, including a choice labelled SELECT, will appear in a pop-up list 65 at the top of the box. Once the user chooses SELECT, a query window 80 appears, as shown in FIG. 8. To perform a calculation on selected records in a database field, the user must specify the criteria for the data shown in the query window. As is apparent from the Figure, query window 80 contains columns headed by the name of each field in the database and permits the user to specify criteria for use in selecting records from the database. This specification is then saved, and the query window closed. If no criteria are specified, the calculation in the "DO" box will use all records in the database field named. After the criteria for selection of records is made, the user clicks on the "DO" box that is next to the "SELECT" box containing the query and creates the calculation to be performed on the selected fields. The calculation should reference a database field as would any other calculation. In the present embodiment of the invention, the name of the referenced database field is preceded with "DB", to indicate that the named field comes from the database rather than from the form itself. If no records are found satisfying the query conditions, the calculation specified in the "OTHERWISE" box is performed. According to the invention, IF and SELECT boxes can be deleted using the Delete function from the Edit menu. Deleting an IF or SELECT box causes the deletion of any DO or OTHERWISE boxes that are associated with the deleted IF or SELECT. Calculations can be "independent." An independent calculation works just like any other calculation, except that its result is not displayed in a form object. Instead, the result of an independent calculation would be used in another calculation. Even though independent calculations are not tied to any object, they can be used only in the form in which they were created. An independent calculation, for example, might determine the sales tax rate based on the contents of the "State" entry field. A calculation assigned to a "Tax Due" entry field would calculate the amount of tax due as the contents of the "Subtotal" entry field multiplied by the value returned by the independent calculation. An independent calculation can be created by choosing the Calculations option from the Properties menu and then choosing the Create function in the Independent Calculations group box of the Calculation Worksheet shown in FIG. 1. Once the user enters a name for the calculation in the Name text box, the calculation is created as described above. When the calculation has been created, the user chooses the Close/Save function from the File menu in the calculation window and then the Close function from the Calculation Worksheet dialog box. The user can now use the value returned by the calculation as arguments in other calculations, by selecting Independent from the function pop-up list, then double-clicking the chosen calculation. The user can also select Independent Calcs from the Functions pull-down menu, then select the chosen calculation. In each case, the computer system is programmed in a manner that will be understood by those skilled in the art, to store, manipulate and recognize the logical meaning of the boxes created by the user and to cause the appropriate actions to be taken in accordance with the results of the calculations. As indicated, the present invention replaces logical, arithmetic, and precedence operators with two types of visual equivalents, decision boxes and result boxes. Boxes of the former type, containing expressions that make decisions, are labeled IF, ELSE IF and SELECT; boxes of the latter type, which contain expressions reflecting results of decisions, are labelled DO and OTHERWISE. A calculation branch consists of an "IF" box and any other "IF" boxes, "DO" boxes, or "OTHERWISE" that are associated with it. To identify a calculation branch, place the insertion point in an "IF" box. All of the calculation boxes in the current branch are highlighted. Calculation branches can be copied or moved. Copying or moving a calculation branch copies or moves the structure of the branch along with the text. In the present invention, the user can accomplish this by placing the insertion point in the "IF" box that begins the branch to be copied or moved. To copy the branch while preserving the original, the Copy command is chosen from the Edit menu. To move the branch to another location in the calculation, removing it from the original position, the Cut command is chosen from the Edit menu. The user clicks the calculation box to which he/she wants to copy or move the branch and then chooses the Paste command from the Edit menu. The practical uses for this method extend to any application where logical flow and decision-making design work is required. While the invention has been described in its present embodiment of an electronic forms program, its uses extend well beyond that particular application.
|
Same subclass Same class Consider this |
||||||||||
