WinSPC Knowledgebase Home | Glossary | Favorites | Contact | Login WinSPC Knowledgebase Home | Glossary | Favorites | Contact | Login
Search the WinSPC Knowledgebase Browse by Category
How do I setup and use a Text File device?
Article Details

Last Updated
11th of May, 2017

Applies to
WinSPC 7.2, WinSPC 8.0, WinSPC 8.1, WinSPC 8.2, WinSPC 8.3, WinSPC 9.0

WinSPC has the ability to parse and read data into variables from various text files layouts (including comma separate variable (CSV)).  Using the masking capabilities from within Device setup you will be able to read numerous text file layouts.  WinSPC will be able to process a single file, or multiple files from a directory with similar format layouts.

NOTE: In WinSPC 9 and above, CSV files can now be processed using either a text file device or Microsoft Excel File device.

Setting up a text file device is as simple as setting up device's connection tab, setting up the text file device's reading tab  and setting up the text file device's mask tab.

Text File Device type creation

  1. Log into WinSPC as the Admin user or a user that has permissions to create Devices.
  2. Create a new (or edit an existing) Device.  To create a new Device use one of the following methods:
    • Right click on the Devices folder located in the left hand window of the Admin screen, and select New à Device.
    • Alternately you can click on the New Device icon located in the toolbar.
    • Or, from the menu bar select File à New à Device.
  3. Type in a device name and hit the Enter key.

 

Connection tab setuptext device connection.jpg

  1. Double click on the newly created Device name to bring up the properties.  Alternately you can right click on the newly created Device name, and select Properties.
  2. From the Device Type dropdown box, select Text File.  
  3. The Connection tab, select which option for the File to read type.
    • This file: Select this option for a single file or if name of the file is not subject to change.
    • Any file in this folder: Select this option for multiple files or if the name of the file is subject to change.
  4. Click on the corresponding Browse… button (as chosen above) and navigate to the location and select the appropriate text file if This file: was selected, otherwise if Any file in this folder: was selected, select the directory location.
  5. Select a After processing option to specify what WinSPC is to do with the text file once it has been processed.  The options are:
    • ...close the file: - Select this option if you want the file closed without being deleted or moved.
    • …delete this file: - Select this option if you want the file deleted.
    • …move the file to here: - Select this option if you want the file moved. Then, click the Browse… button and specify the folder to which to move the files to.
  6. To enable the use of Channel Numbers, check the Use Channel Number.  Next under the Channel Number Is area select Numeric if the channel text consists only of number values, otherwise select Alphanumeric for a mix of alphabetical and numerical text.

 

Reading tab setuptext device reading.jpg

Here, reading refers to the portion of the text file that is to be processed by WinSPC each time the file is read. (This is different from the manner in which reading is used elsewhere in WinSPC) Readings, as used here, usually (though not always) contain one or more records. A record consists of a value for each variable and tag to be collected from the text file.

  1. Click on the Reading tab of Device Setup.
  2. Click on the Get Reading button to display the contents of the text file in the viewing area.
  3. In the Data Capture area box select the method to use when reading the text file. The four Data Capture options are as follows:
    • File at Once -If the reading comprises the entire text file, select this option.
    • Terminator - If the reading has a terminator that unambiguously demarcates it, select this option and specify the terminator in the space provided.  
    • Lines - If the reading begins with the text file's first line and ends a fixed number of lines later, select this option and specify the number of lines in the space provided.  
    • Length - If the reading begins with the text file's first character and ends a fixed number of characters later, select this option and specify the number of characters in the space provided.  
  4. In the Data Format area box select one of these three formatting options:
    • Header only - Select this option if the reading consists only of a header. Header refers to that part of the reading which contains non-repeating content.   Usually the informational section of the file.
    • Body only - Select this option if the reading consists only of a body. Body refers to that part of the reading which contains repeating content; rows of identically structured records.  Usually the sample data, Tags and Channel number.
    • Header and body - Select this option if the reading consists of both a header and a body.  Enter a  Header Length to  specify the length in lines of the header section.
  5. In the Data Format area box select one of these three formatting options:
    • Terminator – Select this option if each record has a terminator that unambiguously demarcates the end.  Next specify the terminator in the space provided.
    • Lines – Select this if each record is a fixed number of lines in length.  Next specify the number of lines in the space provided.
    • Length – Select this if each record is a fixed number of characters in length.  Next specify the number of characters in the space provided.

Mask tab setup


Mask (or Masking) is a way to identify the locations of the data values, tag values and channel number within a file and to ignore (masking off) the rest of the file that is unnecessary information. 

 text decive at a glance.jpg

  1. Click the Mask tab.
  2. The Mask Data area displays the contents of the file to be masked.  The Header portion will either be highlighted in brown or blue depending which Locations tab is currently selected.  The Locations tab will be explained at a later step in this article.  The Body will be highlighted in green or purple, also depending on the Location tab selection.
  3. View As Text is the default view in the Mask Data area, but if you prefer to view it in a hexadecimal format, select the View As Hex option.
  4. Masking Header readingstext device.jpg
    1. Click on the Header tab located in the Locations area box to mask for header information.
    2. If Channel Number was selected on the Connections tab and the Header has a channel number, then single-click the in the Value cell for the Channel row and using the Locate By options, to the right, to unambiguously identify the location of the channel number in the header. For more information on how to do this, see Using The Locate By Options below.
    3. If the input file has one or more data values for variables, identify the location of each header variable that WinSPC is to process. To do this:
      1. In the Type column, select the Data option from the dropdown box.
      2. Click on the text Header Data under the Location column and enter a new Location name that the variable will reference in Data Collection. See Best Practice Tip:.text device best practices.jpg
      3. In the same row, single-click the Value cell.  Next select the needed Locate By options to the right and unambiguously identify the location of the variable. For more information on how to do this, see Using The Locate By Options below.  Select (or click depending on Locate By options selected) the field containing the value for this variable from the Header selection located in the Mask Data area box.
      4. If the header contains other variable data, click the green plus sign ( + ) to add another New Header Data row.
      5. Repeat this step for each remaining variable value located in the header.
    4. If the input file has one or more Tag values in the header, identify the location of each header tag value that WinSPC is to process. To do this:
      1. Select the Header tab from the Locations area (if not already selected).
      2. If a new row is needed, then Click on the green plus sign ( + ).
      3. Select Tag from the Type dropdown box from the newly created row.
      4. Click in the Location cell and enter a name for the Tags location.  See Best Practice Tip:.
      5. Click in the Value cell and, using the Locate By options to the right to unambiguously identify the location of the tag. For more information on how to do this, see Using The Locate By Options below.
      6. Repeat this step for each remaining Tag located in the header.
    5. Masking Body readings

      1. If Channel Number was selected on the Connections tab and the Body contains the channel number, then use the following steps to define the Channel Number mask.

        1. Select the Body tab from the Locations area.
        2. Single-click the in the Value cell for the Channel row and using the Locate By options, to the right, to unambiguously identify the location of the channel number in the body. For more information on how to do this, see Using The Locate By Options below.
      2. If variable data is located in the body section of the file, then use the following steps to define the variable data:

        1. Select the Body tab from the Locations area (if not already selected).
        2. In the Type column, select Data from the dropdown box.
        3. Click on the text Body Data under the Location column and enter a new name for the location of the first variable data value in the body.  See Best Practice Tip:
        4. In the same row, single-click the Value cell and, using the Locate By options to the right to unambiguously identify the location of the variable. For more information on how to do this, see Using The Locate By Options below.
        5. If the body contains another variable, click the green plus sign ( + ) to add another New Body Data row.
        6. Repeat this step for each remaining variable value located in the body.
      3. If the input file has one or more Tag values in the body, identify the location of each body tag value that WinSPC is to process. To do this:
        1. Select the Body tab from the Locations area (if not already selected).
        2. If a new row is needed, then Click on the green plus sign ( + ).
        3. Select Tag from the Type dropdown box from the row.
        4. Click in the Location cell and enter a name for the Tags location.  See Best Practice Tip:.
        5. Click in the Value cell and, using the Locate By options to the right to unambiguously identify the location of the tag. For more information on how to do this, see Using The Locate By Options below.
        6. Repeat this step for each remaining Tag located in the body.
      4. Once you've masked all the header and body locations that WinSPC is to process, click the Test button. This populates the Value columns on both the Header tab and Body tab with values from the reading. If any value is incorrectly populated, modify the Locate By selections for that location and retest until all values are correctly populated.
      5. To delete a row, select any field in the row click the red minus ( - ).  In the Confirm dialog that appears, if you are sure you want to delete the selected location, click OK.
    6. Click the OK button to save the device.  The text file device is now set up and collection plans can be set up to use it.

 

Using the Locate By options

The Locate By options are listed in hierarchical order. This means that each option other than the first option functions within the context of any checked option above it. For example, if a location has only the Offset and Length options checked and the offset is set to 10 characters while the length is set to 4 characters, the location occupies character positions 11-14 in the reading. In many cases, it is necessary to use multiple Locate By options to unambiguously identify the location of an element (i.e. channel number, variable or tag).  text device locate by.jpg

  • Line: Select this option if the header or body contains multiple lines and the element always appears on the same line in the header or body. Once selected, click the line containing the element. This causes the line number to appear in the Location area to the right of the Locate By options.
  • Delimiter: Select this option if a specific character, such as a comma or semicolon, is used exclusively to separate the fields in a line and the element always occupies the same field. Once selected, enter the delimiter in the space provided and then single-click the element. This causes the field number for the element to be displayed in the Location area.  Note that the length of the fields themselves is irrelevant.  The unit of data that precedes the first delimiter in a line is field one; the unit of data that precedes the second delimiter is field two, and so on.
  • Prefix: Select this option if a specific character or set of characters consistently precedes the element; for example, the letters CH.  Once selected, enter the character(s) in the space provided. This option commonly requires another option to demarcate the end of the element.
  • Offset: Select this option if the first character of the element is always offset the same number of positions from the beginning of the reading, the beginning of a line that has been defined, a delimiter that has been defined or a prefix that has been defined. Once selected, click the first character of the element. This causes an Offset number to be populated in the Location area. If the Prefix option is selected, this Offset number indicates the number of positions the first character of the element is offset from the end of the prefix. If the Prefix option is not selected but the Delimiter option is, this Offset number is the number of positions the first character of the element is offset from the delimiter that precedes the field. If neither the Prefix nor the Delimiter option is selected but the Line option is, this Offset number is the number of positions the first character of the element is offset from the beginning of the defined line. If neither the Prefix option, the Delimiter option, nor the Line option is selected, this Offset number is the number of positions the first character of the element is offset from beginning of the header or body.
  • Length: Select this option if the element is always the same number of characters long.  With this option selected, highlighting the element in the text area by clicking-and-dragging over it will capture the length and display it in the Location section. The hierarchical logic explained for the Offset option above extends to this option.

Notice that as you work with these different options, the highlighted portion of the reading in the Mask Data area changes.

Attachments
No attachments were found.
Related Articles
Visitor Comments
No visitor comments posted. Post a comment
Post Comment for "How do I setup and use a Text File device?"
To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Your Name:
   Email Address:
* Your Comment:
* Enter the code below:
 

All Content 2012 DataNet Quality Systems. All Rights Reserved.