50% found this document useful (2 votes)
285 views16 pages

Installation Guide: Tpsys SQL Interface Setup

Uploaded by

yin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
285 views16 pages

Installation Guide: Tpsys SQL Interface Setup

Uploaded by

yin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Installation Guide

TPSys SQL interface setup


English

Hardware and software mentioned in this document are subjected to continuous development and improvement.
Consequently, there may be minor discrepancies between the information in the document and the performance or
design of the product. Specifications, dimensions and other statements mentioned in this document are subject to
changes without prior notice.

MYDATA automation AB, Box 3141, S-183 03 Täby, Sweden.


Phone: +46 8 638 52 00 – Fax: +46 8 638 52 90 – Internet: www.mydata.com
This document or parts of it may not be reproduced without the written permission of MYDATA automation AB .
Infringements will be prosecuted. All rights reserved.
Copyright © MYDATA automation AB, Sweden, 1990 – 2014.

For a fast changing world

P-010-0178-EN Rev. 0006 2014-10 1


MYDATA automation AB Installation Guide TPSys SQL interface setup

Contents
TPSys SQL interface setup ......................................................................................................................... 1

Contents....................................................................................................................................................... 2

1. Introduction ....................................................................................................................................... 3
1.1 Purpose .................................................................................................................................. 3
1.2 Available data ........................................................................................................................ 3

2 Installation......................................................................................................................................... 4
2.1 Add PostgreSQL ODBC driver ............................................................................................. 4

3 Retrieving data .................................................................................................................................. 5


3.1 Windows Data Source Setup ................................................................................................. 5
3.2 Retrieving data from the database ......................................................................................... 6
3.2.1 Data to Excel................................................................................................................. 6
3.2.2 Excel example ............................................................................................................... 8
3.2.3 Data to QlikView ........................................................................................................ 10

4 Edit data .......................................................................................................................................... 14


4.1 ODBC Connection............................................................................................................... 14
4.2 Column changes .................................................................................................................. 14
4.3 Insert query logic ................................................................................................................. 14
4.4 Valid carrier subtypes .......................................................................................................... 14
4.5 Description of columns ....................................................................................................... 15
4.6 Insert carrier query sample .................................................................................................. 16
4.7 Update carrier query sample ................................................................................................ 16
4.8 Create container query sample ............................................................................................ 16
4.9 Delete container query sample ............................................................................................ 16

P-010-0178-EN Rev. 0006 2014-10 2


MYDATA automation AB Installation Guide TPSys SQL interface setup

1. Introduction
1.1 Purpose
This document describes how to set up a Windows XP PC to connect to TPSys SQL databases and retrieve
data from the database into an Excel sheet.

This setup is tested on Windows XP SP3, Excel 2003 and QlikView 9.00 SR4.

In order to use this TPSys 2.9.3 or later is required.

1.2 Available data


The data available are in SQL views. The views are named mydbxxxxview_10 or mydbxxxxview_10_base.

The mydbxxxxview_10_base views contain mainly the table header information and mydbxxxxview_10
views contain data from additional tables.

Example: mydbpcbview10_base view contains one line per PCB in the database (maybe thousands of lines)
but mydbpcbview10 has one line for each mount-line in all PCBs (hundred thousands of lines).

The data in the SQL tables are not possible to access.

P-010-0178-EN Rev. 0006 2014-10 3


MYDATA automation AB Installation Guide TPSys SQL interface setup

2 Installation

2.1 Add PostgreSQL ODBC driver


Download the PostgreSQL ODBC driver from http://www.postgresql.org/

Might be found under Download/ Software Catalogue / Drivers and Interfaces


Product psqlOBDC
Description psqlODBC is the official PostgreSQL ODBC Driver.

http://www.postgresql.org/ftp/odbc/versions/msi/

Select the latest 32 bit version and install it.

Please note that even on 64-bit version of Windows 7 the 32 bit version should be used.

P-010-0178-EN Rev. 0006 2014-10 4


MYDATA automation AB Installation Guide TPSys SQL interface setup

3 Retrieving data

3.1 Windows Data Source Setup


1. Windows 7 64 bit only:
Run c:\windows\sysWOW64\odbcad32.exe

2. Open the Control Panel / Administrative Tools / Data Source (ODBC) / System DSN

3. Add a PostgreSQL Unicode Data Source and give it a name.

4. Then you will be prompted to add some data about the data connection

P-010-0178-EN Rev. 0006 2014-10 5


MYDATA automation AB Installation Guide TPSys SQL interface setup

Data Source: mydata db

Database: mydata_common_db

Server: ip-number or node name to TPSys server

User name: viewreader

Password: viewsonly

3.2 Retrieving data from the database

3.2.1 Data to Excel


1. Start excel and select a cell where you want your data to appear.

2. Select Data/Import External Data/New Database Query …

P-010-0178-EN Rev. 0006 2014-10 6


MYDATA automation AB Installation Guide TPSys SQL interface setup

3. Select the datasource you configured in chapter 3 above and press ‘ok’
Note the unchecked check box.

4. In the appearing window press the ‘Options’ button and set the check boxes as below and press ‘ok’:

5. From the ‘Add Tables’ window, select the datatype of your interest (say component) and add it to
the query and the press the ‘Close’ button.

6. Select the wanted columns from the component tables and drag them to the area below the tables.

P-010-0178-EN Rev. 0006 2014-10 7


MYDATA automation AB Installation Guide TPSys SQL interface setup

7. Close Microsoft Query and import the data in excel by clicking ‘OK’

8. The data is now in the sheet:

3.2.2 Excel example


Find out what packages are used in a specific pcb (FortKort Original)

1. Start Excel and make a new database query.

2. Select the datasource and add 3 views:


- component
- package
- pcb

3. Connect (by dragging) component.package to package.name

4. Connect component.name to pcb.article

P-010-0178-EN Rev. 0006 2014-10 8


MYDATA automation AB Installation Guide TPSys SQL interface setup

5. Add a criteria to the pcb:s

6. Limit the result to unique names:

7. Select package.name and drag it to the white area below:

8. Close Microsoft Query and inserts the result into excel and get the result:

P-010-0178-EN Rev. 0006 2014-10 9


MYDATA automation AB Installation Guide TPSys SQL interface setup

3.2.3 Data to QlikView


The example below shows how to get some package, component, PCB, layout and MYLabel Carrier data to
QlickView. This is just an example and it may not be that useful as it is. It is possible to add more data by
modifying the SQL statements in the Script window to make it display the data you like to see.

1. Start QlikView and select File / New

2. Select File / Edit Script...

3. Connect to QDBC

4. Select the mydata db created in Retrieving data

5. Windows Data Source Setup on page 5

P-010-0178-EN Rev. 0006 2014-10 10


MYDATA automation AB Installation Guide TPSys SQL interface setup

6. Enter below SQL statements in Main

ODBC CONNECT TO [mydata db];

SQL SELECT name as component,


feedertype,
comment as component_comment,
package
FROM mydata_common_db.mydbcompview_10.component;

SQL SELECT name as board_name,


article as component,
location
FROM mydata_common_db.mydbpcblview_10.pcb;

SQL SELECT name as layout_name,


board_name,
comment as layout_comment
FROM mydata_common_db.mydblytlview_10.layout
where ispcb = 1;
ODBC CONNECT TO [mydata db];

SQL SELECT name as package, ztoolset, hydratoolset, pickwaittimeoffset,


placewaittimeoffset
FROM "mydata_common_db"."mydbpackview_10".package;

SQL SELECT articlename as component,


// layout as layout_name,
boardsassembled,
layoutsassembled,
totaltime,

P-010-0178-EN Rev. 0006 2014-10 11


MYDATA automation AB Installation Guide TPSys SQL interface setup

totalassemblytime,
assemblytime,
assembled,
baddimension,
badeltest,
badpicked,
badplaced,
badother
FROM "mydata_common_db"."mydbmanlview_10".management;

SQL SELECT CarrierId,


ComponentName as component,
BatchId,
MagazineName,
Feeder,
CarrierType,
CarrierSubtype,
Angle,
Quantity,
Location
FROM
"mydata_common_db"."mydbcarrview
_10".carrier_magname;

7. Save and the press Reload

8. Wait while data is read and Add All the Available Fields to Fields Displayed in Listboxes

9.

P-010-0178-EN Rev. 0006 2014-10 12


MYDATA automation AB Installation Guide TPSys SQL interface setup

10. Move the Listboxes on the screen so you can see the data.

11. Now you can play with the data according to normal QlikView rules.

P-010-0178-EN Rev. 0006 2014-10 13


MYDATA automation AB Installation Guide TPSys SQL interface setup

4 Edit data
It is possible to change carrier data only. It is done by using ODBC and calling UPDATE or INSERT query
on the mydbcarrview_10.carrier_magname table view. Some of the parameters are ignored and some of
them are generated. This is described in the column description chapter.

4.1 ODBC Connection


Use the same parameters as for reading the database but using another user and password

User name: carrierviewwriter

Password: mydata

4.2 Column changes


There are two minor changes in the new carrier table. All defined values for magazinename column are now
uppercase. It means Unloaded is now UNLOADED and Discarded is DISCARDED. Alarm column has been
removed since it is not used any more.

4.3 Insert query logic


When new carrier is inserted through view TPSys tries to find similar carrier and fill values that are not set
same as in similar carrier. Search function finds carrier with same component name (of the same carrier type
and subtype if set) in the carrier database (carrier archive database and component database if not found)
and use values from last used carrier that is found.

4.4 Valid carrier subtypes


Carrier type:

 UNKNOWN
“”
 TAPE_MAG
“8mm”, “12mm”, “16mm”, “24mm”, “32mm”, “44mm”, “56mm”, “72mm”, “88mm”, “104mm”, “120mm”, “136mm”,
“152mm”, “custom”
 VIB_MAG
“below10mm”, “above10mm”,
 TRAY_MAG
“”
 GFI_MAG
“”

P-010-0178-EN Rev. 0006 2014-10 14


MYDATA automation AB Installation Guide TPSys SQL interface setup

4.5 Description of columns


Column name Insert (Set/NULL) Update Validation

carrierid Must not exist in the database. Ignored

componentname Used / Not allowed Ignored

batchid Used / Set empty Used

magazinename Set to UNLOADED / Set to UNLOADED Used Valid transitions are: UNLOADED -> DISCARDED, UNLOADED -> SHELVED,
SHELVED -> UNLOADED
feeder Set to default / Set to default Ignored

trayposition Set to default / Set to default Ignored

carriertype Used / From similar last used Ignored Valid values: UNKNOWN, TAPE_MAG, VIB_MAG, TRAY_MAG, GFI_MAG

carriersubtype Used / From similar last used Ignored Has to be used in combination with carriertype and has to be valid for specific
carriertype set in that value (See 4.4)
angle Used / From similar last used Used

quantity Used / From similar last used Used Has to be greater than -1

step Used / From similar last used Used

amplitude From similar last used / From similar last used Ignored

duration From similar last used / From similar last used Ignored

frequency From similar last used / From similar last used Ignored

steplengthtrim From similar last used / From similar last used Ignored

xoffset From similar last used / From similar last used Ignored

servoadjustment From similar last used / From similar last used Ignored

autorefill Used / From similar last used Ignored

hydrareachable From similar last used / From similar last used Ignored

location Used / Set “Unknown” Used

owner Used / Set empty Used

yacc From similar last used / From similar last used Ignored

zacc From similar last used / From similar last used Ignored

quantityatnew Used / From similar last used Used Has to be greater than -1

quantityatload Set to default / Set to default Ignored

hasbeenloaded Set to default / Set to default Ignored

supplierpartnumber Used / From similar last used Ignored

timeatfirstload Set to default / Set to default Ignored

maxtotaltime Used / From similar last used Used It is possible to change this value only for carriers without running timer

timeatwarning Set to default / Set to default Ignored

timeatpause Set to default / Set to default Ignored

previouspauses Set to default / Set to default Ignored

timeatlocation Set to default / Set to default Ignored

previousfeeder From similar last used / From similar last used Ignored

lastchanged Generated / Generated Generated

created Used /Generated Ignored

aux1..9 Used / From similar last used Used

P-010-0178-EN Rev. 0006 2014-10 15


MYDATA automation AB Installation Guide TPSys SQL interface setup

4.6 Insert carrier query sample


If the location does not exist, a new custom container is created. If it exists, the carrier is automatically
inserted in that container.
INSERT INTO mydbcarrview_10.carrier_magname (carrierid, componentname, batchid,
carriertype, location, created, aux1)
VALUES ('04143214', 'Component 1' , 'batch 125' , 'TRAY_MAG', 'Shelf1', '2011-10-10
00:00:00', 'Created from view');

4.7 Update carrier query sample


Perform the same sequence as create from view. If the location does not exist, a new custom container is
created. If it exists, the carrier is moved to the new location.
UPDATE mydbcarrview_10.carrier_magname
SET quantity = 102, location = 'Stock 25'
WHERE carrierid = '004828';

4.8 Create container query sample


To create a container, see the query below for mandatory fields.
INSERT INTO mydbcontview_10.container(
modifiedtime, modifiedcount, id, barcode, name, ismslcompliant,
isshelved, comment)
VALUES (NULL, NULL, NULL, 'barcode01', 'name01', 0, 0, 'comment01');

4.9 Delete container query sample


To delete container(s) only the container ID(s) is required. The example below shows how to delete two
containers (IDs 36 and 37) using a single query:
DELETE FROM mydbcontview_10.container
WHERE id IN (36,37);

P-010-0178-EN Rev. 0006 2014-10 16

You might also like