Define Edits - Option 4

 

Contents of this section

 

Description

Edit Dictionaries

Edit Syntax

Prompted Edits

Define Edit Screen Commands

Building Block Edits

The Global Edits Dictionary

 

Description:

The "Define Edits" option provides an ability to perform sophisticated validation of data as it is entered into any field or when creating outputs such as reports. This feature of filePro can save you an enormous amount of time in validating data without having to write a single line of programming code. This powerful tool is one feature of filePro that sets it aside from most other programming languages since most languages require many lines of programming code to accomplish the same things that you can do in a few minutes by creating a simple edit. This tool is sometimes call a "filter" in other program languages since it filters out unwanted data.

Edit Dictionaries

A "Global Edit Dictionary" is predefined for you (referred to as GLOBAL) that will satisfy many of your validation requirements. Edits in this dictionary are available to all filePro files and normally resides at /fp/lib/edits. You can add "User" edits to this dictionary by selecting GLOBAL when entering "Define Edits".

"Local Edit Dictionaries" can be created to accommodate edits unique to a file. These edit dictionaries are also accessed, in addition to the GLOBAL edits, when working with filePro files. "Local Edit Dictionaries" are maintained in the respective filePro directory as /filePro/filename/edits.

As a general rule, only modify the "GLOBAL Edits Dictionary" if you plan to use the edit many times and across all of your applications. As you develop programs in filePro, you will find that edits that you develop for "Key fields" (a field used to link multiple files) will generally be the only edits you add to the "GLOBAL Edits Dictionary". Examples of "Local Edits" would be "Part#", "UPC# "or "Acct#" which control how a user enters data into your inventory or accounting systems. You may design several systems with different requirements on each system for "Part#" and "Acct#". The "UPC#" might be a candidate to be added to the "GLOBAL Edits Dictionary" since there are standards for formatting this type of number and you designed your systems to only use vendor provided UPC codes. However, if you also print non-standard barcodes for "Point-of-Sale" scanning, you may want to change the edit rules for "UPC#" from system to system and therefore include the "UPC#" in a "Local Edits Dictionary".

Edits Syntax

In the following descriptions, "X" and "Y" are edit expressions, and "L" is any literal, surrounded by quotes.

( X )

Parentheses may be used to separate expressions as in algebra.

[ X ]

The expression X is optional.

{ X }

The expression X may occur any number of times, but must occur at least once.

< L >

The literal may appear, but if it doesn’t, filePro will add it. For example, Y<es> " will accept either "Y" or "Yes" as input and will turn a "Y" into a "Yes".

! L !

The literal must appear, and filePro will delete it.

X | Y

Either expression is permitted. For example: "N" | "N"!o! will accept only "N" or "No", and will turn a "No" into an "N".

X & Y

The data must conform to both expressions.

*

Accept any single character.

\

At beginning of line. Right justifies the resulting field.

^

Ignores case differences. Takes effect where it occurs on line.

%

Turns off case conversion. Takes effect where it occurs.

~

Converts data to uppercase. Takes effect where it occurs.

_

Converts data to lowercase. Takes effect where it occurs.

 

 

 

Example: edit ~"N"_<o> will accept any of the following as input and turn it into "No".

 

"N", "n", "no", " NO", "No", "nO"

 

Punctuation may be combined to form the following functions:

[{ X }]

The expression may occur any number of times, or not at all.

[! L !]

If the literal appears, it will be deleted.

 

Prompted Edits

filePro lets you add prompts to your edits by using and apostrophes around the prompt message. When the user moves to a field that uses a prompted edit, the prompt will appear at the bottom of the screen before the user types anything into the field.

Syntax:

name ‘prompt’ normal edit syntax

where "name" is the name of the edit and "’prompt" is the prompt text enclosed in apostrophes (do not use quotation marks).

Define Edit Screen Commands

 

F – Select File

Selects another edit table or allows you to define a new file edit table for an existing file.

U - Update

Updates the edit table currently displayed.

C - Copy From

Prompts you for the edit table to append to the end of the current edit table.

Pgup/PgDn - Scroll

Scrolls you through the current edit table a page at a time.

F10 - Help

Invokes the filePro help screens.

H - Hardcopy

Prints the current edit table.

T - Test Edits

Allows you to test any system or global edit as well as any of the file edits currently displayed.

X - Exit

Exits from the Define Edits program.

 

Building Block Edits

The simpler edits such as N, A and NUM are often referred to as building block edits. You can define more complex edits by using any other edit as a building block edit. In the following table, notice the way some edits make use of more than one line by naming another line to include in the edit (Example: STATE uses state2, state3, state4 etc.). Also, notice how some edits make use of other simpler edits by referring to them. Notice the prompted edit for SSNUM is enclosed in apostrophes.

image\File0364.gif

The Global Edits Dictionary-The following edits are some of the edits predefined for you in the "Global Edits Dictionary". For a complete list of edits, go to the "Define Edits" option 5 of the filePro Plus Menu, and select [GLOBAL].

image\File0365.gif

image\File0366.gif

 

Customizing Global Edits

The "Global Edits Dictionary" can be customized for your specific needs. The following is an example of adding user edits to the "Global Edits Dictionary".

image\File0367.gif

image\File0368.gif

Notice how the Canadian province abbreviations have been added and a new line "state6" has been added to the edits table. Canadian ZIP Code "canzip" and other building block edits have been added to the pre-defined "zip" edit so that all U.S. and Canadian ZIP codes are handled properly.

TIP: You may find the following useful if you need a Spanish CHEQUE edit.

CKESP:[{!" "!}](cero| <*** >(esp3|esp2|mil|cien|diez|unos) chele | <***zero> chele)
esp3:N N N N N N & (!000! | ( !00! diez | cien ) < mil > ) (mil|cien|diez|unos)| tt
esp2:N N N N N & (!00! | ( !0! unos | diez ) < mil > ) (cien|diez|unos)
mil:N N N N & (!0! | xunos < mil >)(cien | diez | unos)
cien:N N N & (!0! | xunos < cientos >) (diez | unos)
xunos:!0!|!1!|!2!<dos>|!3!<tres>|!4!<cuatro>|!5!<cinco>|!6!<seis>|unos2
unos:!0!|!1!<uno>|!2!<dos>|!3!<tres>|!4!<cuatro>|!5!<cinco>|!6!<seis>|unos2
unos2:!7!<siete>|!8!<ocho>|!9!<nueve>
diez:!10!<diez>|!11!<once>|!12!<doce>|!13!<trece>|!14!<catorce>|diez2
diez2:!15!<quince>|!16!<diez y seis>|!17!<diez y ciete>|!18!<diez y ocho>|diez3
diez3:!19!<diez y nueve>|!20!<veinte>|!30!<treinta>|!40!<cuarenta>|!50!<cincuenta>| diez4
diez4:!60!<sesenta>|!70!<setenta>|!80!<ochenta>|!90!<noventa>|diez5
diez5:(!0!|diez6 <" y ">) unos
diez6:!2!<veinte>|!3!<treinta>|!4!<cuarenta>|!5!<cincuenta>|!6!<sesenta>|diez7
diez7:!7!<setenta>|!8!<ochenta>|!9!<noventa>
chele:< con > [!.!] num num </100 ***>
zero:zero1 <*** zero> !.! chele
zero1:(N N N N N & !00000!) | (N N N N & !0000!) | zero2
zero2:(N N N & !000!) | (N N & !00!) | (N & !0!)