PI ProcessBook has the ability to
connect to any ODBC-compliant DataSource.
Most Relational
Databases today are compliant with that standard.
Before you do this, however, you will need to set up a System
DSN which you can find under the
Administrative Tools in Control Panel under
DataSources. We have set one up called LabData. We have got
a Microsoft Access Database that has manually
entered Lab Results, and we'd like to bring that into
ProcessBook. So, what I do is I
go into Tools and Datasets, and, again,
I select New -- but this time ODBC.
And it's going to ask me what
I want for the Name of the Dataset. I am going to call this
Manual_Lab
_Data.
Spaces are, are not good in these,
in these Names, so I use underscores. And,
this is manually entered lab data. And what I want
to do is to [inaudible] my DataSource
that I have set up, and I can see that I have Lab_Data
there. And, I need to enter a
SQL Query here. Now, if you do not know a good
SQL Query, or if you do not have one readily available,
your IT Department or, or someone there can give you one.
I happen to know the Data Table
I would like to query is called Test_Data,
and the Field I want to get is
Time_Taken, Time underscore Taken.
So, I am going to
type a SQL Query in here, select All from
Test_Data,
where
Test_Data.
Time_Taken
is
Greater Than -- now, at this point, I could put
a Query Date and --
'cause I, I do not want to just get the entire database every time I
update the -- every time I update my ProcessBook screen.
So, I want to, I want to narrow this down very specifically and get only
specific data. So, I am going to use what's called
Placeholders. I am going to say where time_taken is Greater Than
question mark. And,
then I am going to say
where test_data
time-taken is Less Than
question mark. And you will notice that when you use question marks,
the Placeholder Button lights up. And, if you
click on the Placeholder Button, it knows that you have two
Placeholders 'cause you have two question marks. I am going to set
the first Placeholder -- they are numbered by their order of appearance --
I am going to set the first Placeholder to my Start
Time and Set, and my second Placeholder to
my End Time and Set. And what this will do
is wherever I use this Dataset,
for the query that it does to the Database, it will use
the Start Time and the End Time of that
Dynamic Element as
the Query Parameters. So, I get a message that says
is syntax really correct?. I can click OK.
And you can see my Dataset there. And what I will do
is simply modify this Trend that I made earlier
to include my ODBC Dataset.
I want to Trend the Value
Column from that Dataset. And you will notice that it's
going to that Dataset and going to the Time
Taken Table, and it's going to use my Start Time of my Trend
as the first Placeholder, and the End Time as
the second Placeholder. And, I click OK
and OK again. And you can see my
Lab_Data now is being brought into ProcessBook
from my ODBC DataSource. It's
using the Start Time and End Times as the
framing for the query. I could have just said
Select All from Test_Data. However, every time
this Trend Object updated, or every time I open up
my spreadsheet, it's going to return the data from the entire
Table, and that would be
an overly-expensive query when I only
really want an 8-hour section.