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 an ODBC device to pull from multiple fields in my database?
Article Details

Last Updated
6th of November, 2018

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

In WinSPC 8.0 or later, you can use a single ODBC (database) device to collect data from multiple fields in your database and store those values into separate variables.  The configuration of the ODBC Device to do this is done almost exactly as you would have configured an ODBC device in previous versions.  The only modification to this setup is done in the "Collection Plan Setup" window, where the "Location" field is now active and you can select any field that is returned by the ODBC device.  This allows you to setup one ODBC Device, assign it to multiple variables in your collection plan, then set each variable to pull its data from a different field from the ODBC device.

To demonstrate this, let's assume that you have a database table that contains the following information:
  • A field containing a unique record ID
  • Three fields containing three characteristics that you measure (Length, Width, Height)
  • A field for your Lot Number (which will be a "Tag" in WinSPC).
  • A field for your Serial Number (which will be a "Tag" in WinSPC).
  • A field for your Production Date.
So your database table might look something like this:

sampledb.jpg

In WinSPC, you would have already setup a part that contains three variables and two tags and might look something like this:

odbc_partsetup.jpg

NOTE: Windows must be first configured to see your database as an ODBC DSN. It is recomended that when this is configured that you set the database up as a System DSN if possible. Microsoft provides instructions on how to create an ODBC DSN in the following article:
http://msdn.microsoft.com/en-us/library/ca6axakh(v=vs.80).aspx
 
Next, we need to setup an ODBC device.  To do so:
  1. Click on the "New Device" button in the toolbar to create a new device and give it a name.  In this example, we will use "Production Access Database" as the device name.
  2. Edit the properties of the device (right click on the new device, select "Properties").
  3. Select "ODBC Data Source" from the "Device Type" drop down at the top of the window. 

    odbcdevice_connectionproperties.jpg

  4. Select the configured data source from the "ODBC Data Source Name" drop down.  This data source is configured from within your Windows Control Panel and varies based upon the specific operating system you are using.  If needed, also fill in the "User Name" and "Password" fields to provide the necessary credentials to connect to the database.
  5. Once the above items are filled out, move to the second tab ("ODBC Settings").

    odbcdevice_odbc1properties.jpg

  6. On the "ODBC Settings" tab, select the table or view from the "Table / View" drop down.  Alternatively, you can write your own SQL command using the "SQL Text" option.  Once you have done either of these, move to the third tab ("ODBC Settings (Cont.)").
  7. On the "ODBC Settings (Cont.)" tab, we need to select the fields from the database that WinSPC will use for the different options for the ODBC Device. 

    odbcdevice_odbc2properties.jpg

  8. In this example, we will not select a "Data field", as that configuration will be done later, in the "Collection Plan Setup" window.  We will, however, select a "Date/Time field" (to control the date/time of the data in WinSPC), the "Ordering field" (to control the order in which the data is read into WinSPC), and a "Sequence number field" (to tell WinSPC to remember what data it has already collected).  So now our "Device Setup" might look something like this:

    odbcdevice_odbc2properties_dbexample.jpg

  9. Note that we do not need to configure the "Data field" option here.  Now we can save the device setup by clicking "OK".
  10. Next, we need to point each of the variables to this device in the "Collection Plan Setup" window.  Edit the properties for the collection plan containing the variables (by right clicking on the collection plan and selecting "Properties"). 

    cp_sampledb.jpg

  11. For each variable that you want to use the ODBC device for in data collection, click on the "Browse..." button underneath the "Collect With" option to select the device.
  12. Next, select the field you want to use from the "Location" drop down.
  13. Repeat this process for each variable that needs to be associated with the device, selecting the appropriate database field from the "Location" drop down.

    cp_sampledb_withdeviceandlocation.jpg

  14. The collection plan is now configured to use one ODBC Device to collect data to multiple variables.



Attachments
No attachments were found.
Related Articles
Visitor Comments
No visitor comments posted. Post a comment
Post Comment for "How do I setup an ODBC device to pull from multiple fields in my database?"
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.