Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 17 of 21

PT Program Generator User's Manual, pages 158 to 167

Pages 158 to 167 of 204

The original document is the PDF (14 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the PSC PT40 and Datalogic PT40

Page 158

2342.book Page 146 Thursday, July 22, 2004 8:35 AM

Example Frames

Verify: DNLD

Checks to see if <F3> was pressed and, if it was, continues to the Display node. If <F3> was not pressed, the program loops back to the Input node and waits for further input.

Display: WAIT

Displays Downloading, Please Wait on the portable’s screen.

Input: TO FILE

Starts downloading the file. Options in its dialog box are set as shown in Figure 119 on page 146.

Figure 119. The Input: TO FILE Dialog

Display: DONE

If downloading is successful, Display: DONE displays DOWNLOAD DONE; <F3>= MORE; <F4>=QUIT on the portable’s screen.

Display: TIMEOUT

If downloading is unsuccessful, Display: TIMEOUT displays TIMEOUT EXCEEDED; <F3>=TRY AGAIN; <F4>=QUIT on the portable’s screen.

Input: FKEY

Both these Display nodes loop back to the Input: FKEY node, which accepts the user’s function key input.

To download a file to a portable, set options for the Input node as follows:

146

Serial

Selected for the Input From option.

Time Out

Selected for the Input From option. Should Link to a Display node that prompts the user to try again.

Destination

Set to the desired file. Choose to replace existing data or place new data at the beginning or end of the file or at a given record number.

Echo to Display

Enabled so that the user can see the file going into the portable unit.

PT Program Generator (PPG) v5.0

Page 159

2342.book Page 147 Thursday, July 22, 2004 8:35 AM

Finding the Number of Records in a File

Finding the Number of Records in a File The easiest way to determine the number of records in a file is to use a Verify node with Match set to a value you know is not in the file and the Store Index in Register checkbox selected (with a register specified for storing the index value). Since it won’t find a match, the program will return the file size, storing it in the index register. Another method copies a known value to the end of the file, uses a Verify node to locate it, and then subtracts 1 from the Location Index. Tip07.scr, illustrated in Figure 120, demonstrates this method. Figure 120. Tip07.scr Determines the Number of Records in a File

Display: RECORDS

User’s Guide

Writes RECORDS= on the portable’s screen.

147

Page 160

2342.book Page 148 Thursday, July 22, 2004 8:35 AM

Example Frames

Copy: END

Copies the constant value “end” to the end of the file being checked.

Verify: END

Looks for the constant “end” in the file and stores the index value of the matching record in a register named INDEX.

Math: INDEX-1

Subtracts 1 from the index value.

Modify: DEL END Deletes the “end” record so that the constant doesn’t corrupt the file. Output: POSITION

Positions the cursor at column 8 in the first line, directly after RECORDS=.

Output: TOTAL

Displays the index value at the cursor position on the portable screen.

Input: TO EXIT

Waits for a function or data key to be pressed before returning to the Main frame.

Searching for a Partial Match A partial match for data in a file may be searched for using the wild card characters “~” and “*” and a Verify node. By inserting “~,” on the front and appending a * to the end of a register containing the desired partial match data and searching the file with that register, the first record with the beginning characters in the second field of the register will be found if one exists. For example: to look up Part # in a comma delimited Default File with Locations and Prices by Part # such as: Loc1,0001,1.00 Loc1,0010,2.00 Loc2,0100,10.00 Loc2,1000,100.00 Loc3,1001,250.00 enter 1000 at a prompt. To look up the Price for Part # 1000, insert “~,” in front of the register and append a “*” to the end of the register so the result is: ~,1000* Use that register in a Verify node as the Comparison type against the Default File to determine whether there is a match. To search for a partial match, complete the following steps: 1. Input Item ID into Default Register overwriting. 2. Copy insert “~,” into the Default Register. 3. Copy append “*” to the Default Register

148

PT Program Generator (PPG) v5.0

Page 161

2342.book Page 149 Thursday, July 22, 2004 8:35 AM

Searching for Data in a File

Figure 121. Tip08

4. In the Verify node Verify Information tab, select File as the Data Type. and Default File as the File type. 5. In the Verify node, Verify Options tab, select ASCII as the Data Type, Register as the Comparison type, and Default Register as the Register type.

Searching for Data in a File A search of a multiple field file for data in one field of the file may be accomplished using the “~” and “*” wildcard characters and a Verify node. Multiple files are not necessary. For example: if the collected data in the Default File is comma delimited with the following structure:

User’s Guide

149

Page 162

2342.book Page 150 Thursday, July 22, 2004 8:35 AM

Example Frames

Location Asset # Date Time

Example data: Room 1,12345,2/24/2003,13:39:53 Room 1,12346,2/24/2003,13:39:58 Room 2,12347,2/24/2003,13:45:33 Room 2,12348,2/24/2003,13:39:43

If duplicate Asset #'s are to be disallowed, the Asset # must be looked up in the second field and, if found, display a message and disallow the entry. Enter “12347” at the Asset # prompt and store it in the Default Register field Asset #, copy Asset # to the Lookup register, insert “~,” on the front of the entry and append “,*” onto the end of the entry so the result is: ~,12347,*

Use the Lookup register in a Verify node as the comparison type against the Default File to determine the existence of a duplicate record. To search for a data in a file, complete the following steps: 1. Input Asset # into Default Register Asset # field 2. Copy the Default Register Asset # field to the Lookup register 3. Copy insert “~,” onto the front of the Lookup register 4. Copy append“,*” to the Lookup register 5. In the Verify node, Verify Information tab, select File as the Data Type and File as the File = Default File type. 6. In the Verify node, Verify Options tab, select ASCII as the Data type, Register as the Comparison type, and Lookup as the Register type.

150

PT Program Generator (PPG) v5.0

Page 163

2342.book Page 151 Thursday, July 22, 2004 8:35 AM

Splitting Records into Two Files

Splitting Records into Two Files =

This method is still valid, but no longer recommended since you can use Wildcards. Use Searching for a Partial Match on page 148, instead.

When verifying only a part of a record, you can accelerate the process by splitting the record into two different files and referencing each file’s index position. For example, if you had a file with the following records showing item numbers and descriptions: item1, desc1 item2, desc2 item3, desc3 you could divide it into two files as follows: File1

File2 item1 desc1 item2 desc2 item3 desc3

Instead of searching through both item numbers and descriptions, your program could search through File1, which contains item numbers only. When the item number is found, you can use the same index number to find the matching description in File2.

User’s Guide

151

Page 164

2342.book Page 152 Thursday, July 22, 2004 8:35 AM

Example Frames

Figure 122. Splitting Records into Two Files

Display: WAIT

Instructs the user to wait while the PSC portable completes this process.

Copy: END

Places the constant “end” at the end of the file to mark the last record.

Copy: 1ST REC

Copies the first record in the file into the default register.

Verify: END

Checks to see whether the default register contains the constant “end”.

Copy: 1ST FIL

If the default register doesn’t contain “end”, Copy: 1ST FIL copies the first part of the record to a different file (1st file), and Copy: 2ND FIL copies the other part of the record into another file (2nd file).

Modify: DEL 1ST Deletes the first record in the original (default) file; what was the second record in the file is now the first.

152

Copy: 1ST FIL

The program loops back to Copy: 1ST FIL, and the next record is split into two different files.

Modify: DEL TEMP

This loop continues until the program reaches the final record (containing “end”). At that point, the program knows it has reached the end of the file, and Modify: DEL TEMP deletes the default file to make sure it is clear for the next time it is used. The program then returns to the Main frame.

PT Program Generator (PPG) v5.0

Page 165

2342.book Page 153 Thursday, July 22, 2004 8:35 AM

Referencing Two Different Files

Referencing Two Different Files Tip10.scr, illustrated in Figure 123 on page 153, uses two data files: one that contains item numbers and one that contains item descriptions. Records in both are sorted identically. By referencing data in both files, this example displays the description of an item whose number is entered by the user. Figure 123. Tip10.scr References Two Different Files

User’s Guide

Display: SCAN

Prompts the user to enter an item number or press <F4> to quit.

Input: ITEM

Stores the input entry in the default register.

Verify: <F4>

Checks to see whether the user pressed <F4>. If so, the program returns to the main frame.

Verify: IN FILE

Checks the contents of the default register against the file with the items in it. Figure 124 on page 154 shows the settings in the dialog box for the node.

153

Page 166

2342.book Page 154 Thursday, July 22, 2004 8:35 AM

Example Frames

Figure 124. The Verify: IN FILE Dialog

Display: NO MATCH

If there is no match, Display: NO MATCH instructs the user to enter the item number again and loops back to Input: ITEM.

Copy: INDEX

If there is a match, the indexed position is put into a second register, and Copy: INDEX copies the record at that indexed position from the description file into the default register (refer to Figure 125 on page 154).

Figure 125. The Copy: INDEX Dialogs Copy To Tab

Copy From Tab

Output: POSITION

Positions the cursor on the portable screen.

Output: TO DISP Writes the item description at the cursor position. Display: SCAN

154

The program returns to Display: SCAN, prompting the user to enter an item number again.

PT Program Generator (PPG) v5.0

Page 167

2342.book Page 155 Thursday, July 22, 2004 8:35 AM

Reviewing a File

Reviewing a File Tip11.scr, illustrated in Figure 126 on page 155, lets the user review the contents of a file, one record at a time. Figure 126. Tip11.scr Reviews a File

Copy: END

Copies the constant “end” to the end of the default file to mark the last record.

Copy: INDEX=1

Copies the number 1 into a register named Index. This register will determine which record is displayed.

Verify: END

Looks at the record at the position specified in the Index register. If the record contains “end”, this is the last record in the file, and the program deletes the “end” record and exits to the main frame. If it does not find “end”, the program continues to the Output node.

Output: INDEXED Displays the contents of the record at the position specified in the Index register on the portable’s screen. Figure 127 on page 156 shows the settings in the dialog box for the node.

User’s Guide

155