The Invoice File Structure

In this lesson we show you the file structure for the “invc” file and explain, in detail, one of its interesting features, the use of “associated fields.” A file named “fpinvc”, was installed with your demo system. The “sneak preview” of the tutorial application, revealed in the beginning of this tutorial, was run using the “fpinvc” file.

You may want to create the various parts of the “invc” file, as shown in the next several lessons or, you may want to read along and look at the appropriate parts of the “fpinvc” file as you go.

This file will contain invoices for sales of our products to our customers. The file structure information is below:

 

 

1

Customer number

4

 

 

2

Invoice number

5

.0

 

3

Invoice date

8

MDY/

 

4

Customer last name

15

UPLOW

 

5

Customer first name

15

UPLOW

 

6

Tax rate

5

.2

 

7

Billing address

15

ALLUP

 

8

City

15

ALLUP

 

9

State

2

STATE

 

10

Zip

10

ZIP

 

11

Al) product code

3

ALLUP

 

12

Al)

3

ALLUP

 

13

Al)

3

ALLUP

 

14

Al)

3

ALLUP

 

15

A2) Quantity

3

.0

 

16

A2)

3

.0

 

17

A2)

3

.0

 

18

A2)

3

.0

 

19

A3) Description

15

UPLOW

 

20

A3)

15

UPLOW

 

21

A3)

15

UPLOW

 

22

A3)

15

UPLOW

 

23

A4) Unit price

7

.2

 

24

A4)

7

.2

 

25

A4)

7

.2

 

26

A4)

7

.2

 

27

AS) Total cost

10

.2

 

28

A5)

10

.2

 

29

A5)

10

.2

 

30

A5)

10

.2

 

31

Subtotal

10

.2

 

32

State tax

7

.2

 

33

Total amount due

10

.2

 

34

Invoice print date

8

MDY/

 

The “mdyl” edit for field 3 is date field-edit that puts the date into a “mmldd/yy” format.

 

Associated Fields

filePro Plus supports the two powerful concepts of “associated fields” and “associated field groups”.

Associated fields allow you to enter many similar items in a record in no particular order. When it’s time to select records, rather than searching for data in a particular field, you an tell filePro Plus to search in all of the associated fields for any match. When sorting on a associated fields, filePro Plus will process each record as many times as there are on-blank entries in the associated fields.

An associated field group extends this so that reports and processing can reference more than one set of associated fields to be assured that the appropriate fields are referenced.

You specify that fields are associated in the Define Files program. The field heading tells filePro Plus that certain fields are to be associated. To define associated fields, use a single capital letter followed by a number from 0 through 9 followed by a close parentheses, i.e., Al), A2), etc, as the first characters of the field heading. You can associate up to 32 fields by starting all of the field headings with the same letter, number, close parentheses combination.

Fields whose headings start with the same letter, a different number and "a close parentheses" are considered in the same group. If this sounds confusing, don’t worry. The following example should help to clarify it:

Let’s say you needed to keep a database of skills for employees. You could define the file as follows:

1— employee name

2— Al) skull

3— Al) skill2

4— Al) skill3

5— Al) skill4

For employee 1, Tom Jones, the skills might contain:

2-    COMPUTER OPERATOR

3-    5- FRENCH

4-    4- TYPING

For employee 2, Mary Smith, the skills might contain:

2 -  STENO

3 -  SPANISH

4- - FRENCH

5 -  COBOL

If we wanted to search for all employees that spoke French we would select All equal to french. Both employees would be selected even though FRENCH appears in field 3 for employee 1 and in field 4 for employee 2.

To illustrate an associated group let’s say we re—defined the file as follows:

1 - employee name

2 - Al) skill1

3 - Al) skill2

4 - Al) skill3

5 - Al) skill4

6 - A2) proficiency level

7 - A2)

8 - A2)

9 - A2)

In the above file, each proficiency level field is associated with a particular skill field. Therefore, the first proficiency level field is associated with the first skill field, the second proficiency level with the second skill, etc. In this example field 6 would be associated with field 2, field 7 would be associated with field 3, etc. If you sorted a report by Al, you could print the particular skill and its associated proficiency level.

On the supplied invoice file, “fpinvc”, there are five associated field sets, “Al) —AS)”. Each one contains 4 fields.

Associated field groups can be used to simplify the processing you write for a file. In the processing for the invoice file that follows we want to perform similar processing for each line item. Instead of writing separate processing for fields 11, 12, 13, and 14 we have assigned them to associated field Al) and can write one processing routine for “when leaving field Al” by using the label @WLFA1.