Beruflich Dokumente
Kultur Dokumente
You will then be given the following dialog to complete, just as you are during the installation of the Primavera SDK.
2/9/12 Pimaea SDK Pogamme' Gide
5/27 haffeaoc.ne/Pogamme' Gide.hm
Delaed Loading (en o Table of Conen)
Delaed Loading is a mechanism for loading global data onl when it is requested. The installation of Primavera SDK installs PMSDK.ini file in the
\Primavera Common\PMSDK\Engines folder where delaedLoadMode can be turned ON or OFF. B default delaedLoadMode is turned ON. With
delaed loading ON, the time to establish a connection is reduced due to the fact that not all of the global data is loaded into memor. Also,
response/loading time is reduced when updating the scope_level for projects since onl global data associated with that project is loaded.
Deleting Data
To remove records from a table, use DELETE. For items that require many business rules to fire, a stored procedure is available that handles deletion of
children and associated records to ensure data integrity. Refer to the following example of deleting with a specified wildcard:
SQL> DELETE FROM USERS WHERE e_id = 7896
Field Tpe/Data Tpe Mappings
The generated HTNL tables contain a column called field type. The
following table lists the data types that map to all fields in the system.
Field Tpe Data Tpe
Primary Key !nteger
Foreign Key !nteger
Sequence !nteger
Text String
Currency Double
YesfNo String
HTNL Nemo
Start Date Date Type
!nteger !nteger
Static String
GU!D String
Duration Double
Floating Double
2 Decimals Double
Rsrc CostfQty Double
Finish Date Date Type
Quantity Double
Percent Double
variant Double
Date Range String
2/9/12 Pimaea SDK Pogamme' Gide
12/27 haffeaoc.ne/Pogamme' Gide.hm
Price/Qty Double
Special Note for Setting End-Date Fields via the SDK:
There is a special consideration when assigning end-date values that fall on day boundaries via the SDK. When assigning an end date value that falls
exactly on a day boundary, use the date of the following day, and omit the time value or use midnight. This only applies when assigning a value to an
end date field, which includes activity end date (TASK table) as well as end dates in the TASKRSRC, PROJWBS, PROJECT, and other tables.
For example, if a task starts on Jan 10th, Monday, and ends on Jan 12th, Wednesday, the task lasts for exactly three days. The end date should be
"1/13/2001 00:00". This will be displayed in the GUI as "1/12/2000", since midnight of the following day is interpreted as ending on the previous day's
date. If you are specifying a mid-day timestamp, there is no need to increment the end-date's day.
Files installed by the Primavera Software Development Kit (SDK)
(return to Table of Contents)
The \Primavera Common\PMSDK contains several sub-folders:
\Primavera Common\PMSDK\Cache - (not used)
\Primavera Common\PMSDK\Doc - contains SDK HTML documentation files
index.html - root HTML help file
GeneralTables&Fields.htm - detailed listing of tables/fields exposed via the SDK
Programmer's Guide.htm - detailed documentation on using the SDK
SpreadTables&Fields.htm - detailed listing of spread tables
StaticFieldsDefinitions.htm - detailed listing of static values used in the SDK
ExtendedTables&Fields.htm - summary listing of Extended tables
SYSTABLES.htm - meta table in html format
SYSCOLUMNS.htm - meta table in html format
SYSOPTIONS.htm - meta table in html format
\Primavera Common\PMSDK\Driver - contains the Open Access (C++) driver
datatype.dbf - configuration database used by Open Access
drivinfo.dbf - configuration database
for Data Access Manager
(DAM) for Open Access; parameters are extracted/set
in the oainfo.ini file.
EngineProperties.dll - The DLL which contains the UI for the DSN setup dialog
oadrd.ini - contains connection properties as they are created
oainfo.ini - Data Access Manager (DAM) settings used by Open Access
oaisql.lic - driver license file
OpenRDA.ini - Open Access server configuration file
PrmDPAPI.dll - Primavera ODBC Data Provider for WIN32 (main driver file)
\Primavera Common\PMSDK\Engines - contains the main engine file(s) and the SDK configuration file
PMSDK.dll - main engine file (dll)
PMSDK.ini - used to set delayedLoadMode
Working with the Primavera SDK (Examples) (return to Table of Contents)
Generic Eamples (SQL) (return to Table of Contents)
When a connection is established with the Primavera SDK Data Source, the scope_level in the project table is set to 1 by default. This permits access to
global data. Subsequently, as the scope_level is increased from 1 to 7, detailed data are loaded in memory. In addition to setting the scope_level,
project data must be accessed with the appropriate access permissions. The access_level should be set to either 1 (shared mode) or 2 ( exclusive
mode) to modify project-related data.
Creating an Enterprise Project Structure (EPS) node (return to Table of Contents)
To view EPS data, default scope_level of 1 is sufficient. An EPS node is always created under another EPS node. To create a lower-level EPS node, the
wbs_id of another EPS node as the parent_wbs_id. The PROJWBS table flags each entry as a PROJECT, EPS, or WBS node in the node_type field.
Since the root EPS node does not have a parent, it can be accessed from the PROJWBS table using the following query:
SELECT bs_id from PROJWBS WHERE parent_bs_id IS NULL
2/9/12 Pimaea SDK Pogamme' Gide
13/27 haffeaoc.ne/Pogamme' Gide.hm
To create an EPS node with a wbs_short_name of Maintenance Projects under the root EPS use the create_eps() stored procedure:
CALL create_eps (436, Maintenance Projects)
The wbs_id for the newly created entry is an autogenerated field and can be obtained from SYSTABLES by querying the last_assigned_key field:
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = PROJWBS
Note: If another EPS node exists with the same wbs_short_name, a numerical value is appended
and stored as Maintenance Projects-1.
Ceaing a Pojec (en o Table of Conen)
The sample code below creates a Project with proj_short_name as System Integration. The proj_short_name is stored as a unique value for each
entry in the PROJECT table. Project level data can be modified with a default scope_level.
The create_project() stored procedure also requires a wbs_id of a valid EPS node. The new project is created under the specified EPS node.
In the following example, 23454 is a valid EPS node with wbs_id = 23454.
CALL create_project(23454, 'System Integration')
Note: If another project exists with the same proj_short_name, a numerical value is appended
and stored as System Integeration-1.
To modify the default values, select the project using the following query. The proj_id can also be determined using the last_assigned_key from
SYSTABLES.
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = PROJECT
SELECT proj_id FROM PROJECT WHERE proj_short_name = 'System Integration'
UPDATE PROJECT set proj_short_name = 'Sample Project' WHERE proj_id = 3564;
Note: Every project also has a corresponding entry in the PROJWBS table.
Ceaing a WBS node (en o Table of Conen)
A WBS node can be inserted directly in the PROJWBS table. However, a WBS node must be associated with a project. The example below assumes that
a project called System Integration with proj_id = 3564 exists in the database. Note that the appropriate scope_level is required to insert a WBS node.
INSERT INTO PROJWBS (wbs_id, proj_id) VALUES (0, 3564)
A WBS node associated with System Integration is created above. SYSTABLES can then be queried to determine the wbs_id for the new entry as
follows:
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = PROJWBS
(ame en ale of 34832)
UPDATE PROJWBS set wbs_name = IT Systems WHERE wbs_id = 34832
The update statement above modifies the wbs_name to IT Systems. Multiple WBS nodes can be associated with the same project.
Ceaing a Tak (en o Table of Conen)
To add tasks to the TASK table associate them with a WBS node. Select the appropriate WBS node from the PROJWBS table as described below.
UPDATE PROJECT SET scope_level=7 WHERE proj_id = 3564
SELECT wbs_id FROM PROJWBS WHERE proj_id = 3564 AND wbs_short_name = IT Systems
The new task is added to System Integration under the WBS node called IT Systems with a wbs_id = 4893. Since the wbs_short_name is unique
within each project, the above query returns a unique value. Once the location of the task has been established by either selecting an existing WBS node
or creating a new WBS node, the new task can be inserted in the TASK table. To access the data stored in the TASK table, the appropriate scope level
needs to be set for the project as described.
UPDATE PROJECT set scope_level = 7 WHERE proj_id = 3564
INSERT INTO TASK (task_id, wbs_id) VALUES (0,4893)
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = TASK
(ame en ale of 33682)
2/9/12 Pimaea SDK Pogamme' Gide
14/27 haffeaoc.ne/Pogamme' Gide.hm
UPDATE TASK SET task_name = Install Upgrades WHERE task_id = 33682
Once the task has been created, the task_id can be obtained from the SYSTABLES using the last_assigned_key value as described in the examples
above.
Ceaing a Reoce (en o Table of Conen)
To create a resource, add a new record to the RSRC table as follows. No parameters are required to insert the record in the RSRC table.
INSERT INTO RSRC (rsrc_id) VALUES (0)
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = RSRC
(ame en ale of 2348)
UPDATE RSRC SET rsrc_name = Bob Smith WHERE rsrc_id = 2348
Ceaing a Reoce Aignmen (en o Table of Conen)
To create a resource assignment, add a record to the TASKRSRC table. A resource must be associated with an existing task and the scope_level
required to create resource assignments must be set to 7. The sample SQL query below inserts a record in the TASKRSRC table and associates a
resource with rsrc_id = 8695 and an activity with task_id = 75447. The newly created taskrsrc_id can be obtained from SYSTABLES using the
last_assigned_key.
INSERT INTO TASKRSRC (task_id, rsrc_id) VALUES (75447, 8695)
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = TASKRSRC
Ceaing Tak Dependencie (en o Table of Conen)
The SQL statements below assign a dependency Finish-to-Start between two tasks with task_id =75447 and 76474. The task with task_id =75447 is
the predecessor task. To assign a relationship between these tasks, add a record to the TASKPRED table. The fields required to insert a record in
TASKPRED table are task_id, pred_type.
The pred_type should be one of the following values:
PR_FS - Finish to Start
PR_SF - Start to Finish
PR_SS - Start to Start
PR_FF - Finish to Finish
INSERT INTO TASKPRED (task_id, pred_task_id, pred_type) VALUES (75447, 76474, 'PR_FS')
Ceaing a Calenda (en o Table of Conen)
Add a record to the CALENDAR table to create a new calendar.
Calendars can be one of the following three types:
CA_Base - Global Calendar
CA_Rsrc - Resource Calendar
CA_Project - Project Calendar
To add a Global Calendar, the calendar type and an associated project must be specified when a record is inserted. The following code creates a Global
Calendar and then finds the id of the created calendar.
INSERT INTO CALENDAR (clndr_type) values('CA_Base')
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = 'CALENDAR'
(ame en ale of 2345)
The calendar name can be updated to Development Calendar for a clndr_id = 2345 that is obtained from SYSTABLES as follows:
UPDATE CALENDAR SET clndr_name = 'Development Calendar' WHERE clndr_id = 2345
Resource and project calendars can also be created using the specified clndr_type. Each Project and Resource Calendar can inherit the properties of
the Global Calendar. Update the base_clndr_id field with the preferred base calendar to reflect any changes as shown below.
INSERT INTO CALENDAR (clndr_type, proj_id) VALUES ('CA_Project', 3564)
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = 'CALENDAR'
(ame a en ale of 2578)
2/9/12 Pimaea SDK Pogamme' Gide
15/27 haffeaoc.ne/Pogamme' Gide.hm
UPDATE CALENDAR SET base_clndr_id = 2345 WHERE clndr_id = 2578
Similarly, a Resource Calendar can be created as described below. Once the calendar is created, obtain the clndr_id from SYSTABLES and update the
fields as required.
INSERT INTO CALENDAR (clndr_tpe) VALUES ('CA_Rsrc')
Creating an Activit Code (return to Table of Contents)
When dealing with activity codes, you need to consider Activity Code Types and Activity Code Values. Each Activity Code Type may have several values
associated with it. For example, a code for Project Phase may have the values Requirements and Design.
The table ACTVTYPE contains the activity code.
SELECT actv_code_tpe_id, proj_id, actv_short_len, actv_code_tpe FROM ACTVTYPE
actv_code_type_id proj_id actv_short_len actv_code_type
75 7 Location Code
76 307 7 Sub Contractor
Codes can be either global or project specific. For example, the Location code entry above is global and the Sub Contractor code entry above is
specific to proj_id 307. The following queries can be used to create a project-level activity code:
INSERT INTO ACTVTYPE (actv_code_tpe_id, proj_id) VALUES (0, 3564)
A global activity code is created if an association to proj_id is removed. The actv_type_id can then be obtained from SYSTABLES.
The table ACTVCODE contains the possible values for a given activity code.
SELECT actv_code_id, actv_code_tpe_id, short_name, actv_code_name FROM ACTVCODE WHERE actv_code_tpe_id = 75
actv_code_id actv_code_type_id short_name actv_code_name
1200 75 ATLC Atlanta corporate center
1201 75 SLCE Salt Lake City engineering
1202 75 RTC Roanoke test center
1203 75 BDC Birmingham development
The table above shows the following valid code values for Location Code are Atlanta corporate center, Salt Lake City engineering, Roanoke test
center, and Birmingham development. Activity code values can be assigned to an activity code by adding records to the ACTVCODE table as shown
below. The value for actv_code_type_id is assumed to be 234.
INSERT INTO ACTVCODE (actv_code_id, actv_code_tpe_id) values (0,234)
The table TASKACTV contains the assignments of activity code values to tasks, as shown in the following query.
SELECT task_id, actv_code_tpe_id, actv_code_id, proj_id FROM TASKACTV
task_id actv_code_type_id actv_code_id proj_id
32568 75 1202 307
32569 75 1202 307
32570 75 1202 307
32571 75 1200 307
32572 75 1200 307
An activity code value can be assigned to a task by inserting the value in the TASKACTV table. The task_id = 75447 and actv_code_id = 1200 and
actv_code_type_id = 75.
INSERT INTO TASKACTV (task_id, actv_code_id, actv_code_tpe_id) VALUES (75447, 1200, 75)
Creating a User (return to Table of Contents)
When creating new users, you must consider account users and user rights. The USERS table contains a listing of all users in the system. These are
global data, so they require scope level 1.
To display a list of users in the system:
SELECT user_id, user_name FROM USERS
To add a user:
2/9/12 Pimaea SDK Pogamme' Gide
16/27 haffeaoc.ne/Pogamme' Gide.hm
INSERT INTO USERS(user_id,prof_id,actual_name) VALUES (0,12,Bob Smith)
SELECT last_assigned_key FROM SYSTABLES WHERE api_table_name = 'USERS'
(ame a en ale of 25)
To edit an existing user:
UPDATE USERS SET user_name = 'Bob' WHERE user_id = 25
To delete a user:
DELETE FROM USERS WHERE user_name = 'Bob'
Each user has a security privilege identified by the prof_id, which links the USERS table to the PROFILE table.
When creating new users in using the Primavera SDK, you can update the security profile of each inserted user.
A user must have a security profile.
SELECT user_id, prof_id, user_name FROM USERS WHERE user_name = 'admin'
user_id prof_id user_name
25 12 admin
This above select returns a prof_id of 12.
SELECT prof_id, prof_name FROM PROFILE WHERE prof_id = 12
prof_id prof_name
12 <Admin Superuser>
Activating Baselines for Loaded Project (return to Table of Contents)
When an SDK session begins, all projects baseline fields reflect the current plan. The users preferences are not used to activate any project baselines
as in the GUI this is the programmers responsibility.
To activate a baseline, first locate the desired baseline row in the PROJBASE table. Then, issue an update statement to activate that baseline. Note
that the associated project should be loaded with scope_level=7 already.
UPDATE PROJBASE SET current_baseline_flag = Y WHERE proj_id = 123
MS Access Eample (return to Table of Contents)
1)In MS Access, go to File, New Database and create a Blank Database
2)Go to File, Get External Data >, Link Tables
3)Under Files of type set to ODBC Databases()
4)Click the Machine Data Source tab and select your Primavera SDK data source
5)If prompted to Login, login as a super-user (i.e., Admin/Admin):
6)Select desired tables to link to:
2/9/12 Pimaea SDK Pogamme' Gide
17/27 haffeaoc.ne/Pogamme' Gide.hm
Note: In MS Access, you can link to a table even if you do not set the scope level accordingly. This will result in tables not displaying accurate
information until the scope level is set to a correct level. To set the scope_level in Access you need to create an Update Query. The following is
an example of an Update Query in Access that will set the scope_level for all projects to 7 (SCOPE_LEVEL_ALL):
Note: When linking to any of the spread tables (see SpreadTables&Fields.htm) in MS Access, you will be prompted to ensure data integrity
by choosing fields that uniquely identify each record. For each of the spread tables you will select the first four fields.
For example, when linking to the spread table TASKRSRC_SPREADS you will need to select the fields:
taskrsrc_id, spread_tpe, start_date and normal format to allow MS Access to uniquely identify each
record in the table.
Visual Basic/ADO Eample (return to Table of Contents)
ActiveX Data Objects (ADO) (return to Table of Contents)
Open Database Connectivit (ODBC) is a widel accepted Application Programming Interface (API) for database access. It is based on the Call-Level
2/9/12 Pimaea SDK Pogamme' Gide
18/27 haffeaoc.ne/Pogamme' Gide.hm
Ineface (CLI) pecificaion fom X/Open and ISO/IEC fo daabae API and e Sced Qe Langage (SQL) a i daabae acce
langage.
OLEDB i Micoof' aegic lo-leel ineface o daa aco he oganiaion. OLEDB i an open pecificaion deigned o bild on he cce of
ODBC b poiding an open andad fo acceing all kind of daa.
ADO i deigned a an ea-o-e applicaion leel ineface o Micoof' nee and mo poefl daa acce paadigm, OLEDB. OLEDB
poide "high-pefomance" acce o an daa oce, inclding elaional and non-elaional daabae, e-mail and file em, e and gaphic,
com bine objec, and moe. ADO i implemened ih a mall foopin, minimal neok affic in ke Inene cenaio, and a minimal
nmbe of lae beeen he fon-end and daa oce, o poide a ligheigh, high-pefomance ineface. ADO i ea o e becae i i called
ing a familia meapho, he OLE Aomaion ineface, aailable fom j abo an ool and langage on he make oda. And ince ADO a
deigned o combine he be feae of, and eenall eplace RDO and DAO, i e imila conenion ih implified emanic o make i ea
o lean fo oda' deelope.
ADO i adanageo ince i ha a e imple pogamming model. Belo i a diagam hoing he objec and ho he elae o one anohe:
Summary of ADO Nodel:
The Connecion Objec
The Connection object represents a connection to the data source and allows you to execute commands. To execute any kind of command, you use the
Execute method of the Connection object. !f the command returns rows, a default Recordset object is created and returned. To specify a more complex
Recordset, you create a new Recordset object, associate it with the Connection, and open the cursor.
The Command Objec
The Command object represents a command (also known as a query or statement) that can be processed by the data source. Commands can return
rows or not, and if the provider is capable, can also handle parameters. The Command object is actually optional in the ADO model because some data
providers cannot supply command execution, but the object is supported if the provider supports commands.
Commands can be simple SQL statements (or some other language the data provider recognizes) or calls to stored procedures in the database.
Commands can then be executed using the Command's Execute method, or you can create a Recordset object and associate it with the Command
object when opening the cursor.
The Command object includes a collection of Parameter objects, which is described below. !f the provider can support commands with parameters, the
Parameters collection will contain one parameter object for each parameter in the command. As opposed to past models, you can create Parameter
objects and explicitly add them to the Parameters collection, thus allowing you to use well-known parameterized commands to avoid the sometimes
very expensive operation of having the provider populate the Parameters collection automatically based on the system catalog.
The Paamee Objec
The Parameter object represents a parameter of a Command. As noted in the Command description, you can explicitly create Parameter objects and
add them to the Parameters collection to avoid the often unnecessary and expensive task of going to the system catalog to automatically populate the
parameter binding information.
The Recode Objec
The Recordset object is by far the most complex (the others are simplified considerably). This is not surprising, however, because all the cursor
functionality is represented in this object. The Recordset object looks much like it does in existing models today, but a number of improvements have
been made, such as removing unnecessary elements, adding optional arguments that reduce the number of lines of code for common scenarios, and
changing defaults that didn't make sense in today's technologies.
The Field Objec
The Field interface represents a column in a Recordset that you can use to obtain values, modify values, and learn about column meta-data. This object
is almost identical to past models, but includes some new functionality.
2/9/12 Pimaea SDK Pogamme' Gide
19/27 haffeaoc.ne/Pogamme' Gide.hm
The Error Object
The Error object represents an error returned from a data source. This object is actually optional because it is only needed when data sources can
return multiple errors for a single method call. If a provider does not return multiple errors for a single function call, the provider just raises the error
through the normal COM mechanisms that all COM servers do when called from languages like Visual Basic.
3) Then, switch to the Postopen event and add the following code:
Windows
files. The use of extensions means you no longer need to be familiar with the ProgID for a given script engine. Windows
Script Host handles this for you by maintaining a mapping of script extensions to ProgIDs, launching the appropriate engine for a given script.
Windows Script Host is integrated into Windows 98, Windows 2000 Professional, and Windows 2000 Server. Version 2.0 includes the VBScript and
JScript scripting engines. In the future, other software companies may provide ActiveX scripting engines for languages such as PerlScript, TCL, REXX,
and Python.
Sample WSH JScript/ADO code:
The following sample JScript code displays the current number of projects found in a
Primavera SDK data source connection:
<package>
<Job id="getProjectCount">
<Script language ="JScript">
//create ADO connection object...
var cn = new ActiveXObject("ADODB.Connection");
//open connection...
cn.Open(<Sstem Data Source Name>, <username>, <password>);
var NumRecAff;
var adCmdUnknown = 8; //ado constant
//execute SQL command
var rs = cn.execute("SELECT COUNT(*) FROM PROJWBS WHERE NODE_TYPE='PROJECT'",NumRecAff,adCmdUnknown);
WScript.echo("Project Count: " + rs.Fields.Item(0).Value);
rs.Close();
rs = null;
cn.Close();
cn = null;
</Script>
</Job>
</package>
[ Save the code above into a file called getProjectCount.wsf ]
Double-click on the getProjectCount.wsf file to get the output:
OR from the command line, enter the following:
>cscript //job:getProjectCount getProjectCount.wsf
Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.
Project Count: 26
2/9/12 Pimaea SDK Pogamme' Gide
22/27 haffeaoc.ne/Pogamme' Gide.hm
OR from the command line, enter the following:
>wscript //job:getProjectCount getProjectCount.wsf
Java Eample (using JDBC-ODBC) (return to Table of Contents)
import java.sql.*;
class sdk_jdbc_odbc
{
public static void main (String[] args)
{
String url = "jdbc:odbc:<Data Source>";
String query = "SELECT PROJ_ID FROM PROJECT";
try
{
//load the jdbc-odbc bridge driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//establish connection
Connection con = DriverManager.getConnection(url,"<userName>","<passord>");
//create a statement object so we can submit SQL statements to the driver
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
printResultSet(rs);
rs.close();
stmt.close();
con.close();
}
catch (SQLException ex)
{
while (ex != null)
{
System.out.println("SQLException: " + ex.getMessage());
ex = ex.getNextException();
}
}
catch (java.lang.Exception ex)
{
ex.printStackTrace();
}
}
private static void printResultSet(ResultSet rs) throws SQLException
{
int numCols = rs.getMetaData().getColumnCount();
while (rs.next())
{
for (int i =1; i<=numCols; i++)
{
if (i == numCols)
System.out.print(rs.getString(i));
else
System.out.print(rs.getString(i) + ",");
}
System.out.println();
}
}
}
[ Save code above to a file called sdk_jdbc_odbc.java. ]
From the command line, enter the following to compile the .java file: >javac sdk_jdbc_odbc.java
From the command line, enter the following to execute the .class file: >java sdk_jdbc_odbc
Primavera SDK Log File(s) (return to Table of Contents)
The Primavera SDK automatically generates a log file in the TEMP folder called PrmSDK.log.
2/9/12 Pimaea SDK Pogamme' Gide
23/27 haffeaoc.ne/Pogamme' Gide.hm
To determine the TEMP folder type set at a command prompt:
Example:
>set
TEMP=C:\TEMP (for WinNT)
OR
TEMP=C:\WINDOWS\TEMP (for Win95/98)
The Primavera SDK logs actions/methods that are performed by the application (VDB) to service a request. The log also provides the success/failure of
the actions/methods performed, as well as any errors that may have taken place in processing a request.
Note: You can control the level of detail that is written to the log file using the Options for logging messages setting found in the
Primavera Software Development Kit Setup dialog. The setting can be set to terse, verbose, or none.
Sample ee (less detail) output (establishing a connection):
010313:18:41:56.361 - VDB.Connect:
da=PMSDK_PE;Driver=PrimaveraPMSDK;engine=P3e;lf=C:\temp\PMSDK.LOG;lo=terse;pg=1;pp=pubuser;pu=pubuser; as
"admin" successful
Sample eboe (more detail) output (establishing a connection):
010313:18:44:52.865 - VDB.Connect: "admin" using
params=da=PMSDK_PE;Driver=PrimaveraPMSDK;engine=P3e;lf=C:\temp\PMSDK.LOG;lo=verbose;pg=1;pp=pubuser;pu=pubuser;
010313:18:44:54.737 - USESSION - GETNEWKEY
010313:18:44:54.808 - SELECT * from users WHERE user_id=25
010313:18:44:54.818 - SELECT * from profile WHERE prof_id=12
010313:18:44:54.828 -
010313:18:44:54.828 - REFRESHING - All Tables
010313:18:44:54.828 - REFRESHING - PREFER
010313:18:44:54.828 - SQL - SELECT * FROM prefer ORDER BY prefer_id
etc.
Sample eboe output (establishing a connection with an invalid password):
010313:18:47:49.278 - VDB.Connect: "admin" using
params=da=PMSDK_PE;Driver=PrimaveraPMSDK;engine=P3e;lf=C:\temp\PMSDK.LOG;lo=verbose;pg=1;pp=pubuser;pu=pubuser;
010313:18:47:50.771 - Logon failed: invalid password
010313:18:47:50.771 - ERROR => Logon failed: invalid password
VDB.Connect; hResult=0x80040011 (PMSDK_E_BAD_LOGON: username/password or license invalid); EOleSysError=SDK
failed to logon to driver
010313:18:47:50.791 - VDB.Disconnect
SQL (aggregate/scalar) functions supported by the Primavera SDK/OA
(en o Table of Conen)
Aggegae fncion ppoed
<set-function-spec> ::= COUNT ( * )
| AVG ( [ALL | DISTINCT] < value-expression > )
| MIN ( [ALL | DISTINCT] < value-expression > )
| MA ( [ALL | DISTINCT] < value-expression > )
| SUM ( [ALL | DISTINCT] < value-expression > )
| COUNT ( [ALL | DISTINCT] < value-expression > )
Examples:
SELECT AVG(cost_per_qty) FROM RSRC
SELECT MIN(cost_per_qty) FROM RSRC
SELECT MA(cost_per_qty) FROM RSRC
SELECT SUM(cost_per_qty) FROM RSRC
SELECT COUNT(*) FROM RSRC
2/9/12 Pimaea SDK Pogamme' Gide
24/27 haffeaoc.ne/Pogamme' Gide.hm
Detail:
Function/Snta: Description: Sample SQL: Sample Output:
String
ASCII(string_exp) Returns the ASCII code v alue of the leftmost character
of string_exp as an integer.
select rsrc_name from rsrc where
ascii(rsrc_name)=67
rsrc_name
Capital Projects
Construction Department
Customer Relations
CHAR(code) Returns the character that has the ASCII code v alue
specified by code. The v alue of code should be between
0 and 255; otherwise, the return v alue is data source
dependent.
select char(65),rsrc_name from rsrc Col1 rsrc_name
A Capital Projects
A Construction Department
A Operating Engineer
CONCAT(string_exp1,
string_exp2)
Returns a character string that is the result of
concatenating string_exp2 to string_exp1. The resulting
string is DBMS-dependent. For example, if the column
represented by string_exp1 contained a NULL v alue, DB2
would return NULL but SQL Serv er would return the
non-NULL string.
select concat(rsrc_id,rsrc_name) from rsrc Col1
1Capital Projects
1159Construction Department
1160Operating Engineer
LCASE(string_exp)
LOWER(string_exp)
Returns a string equal to that in string_exp, with all
uppercase characters conv erted to lowercase.
select lcase(rsrc_name) from rsrc
select lower(rsrc_name) from rsrc
Col1
capital projects
construction department
operating engineer
LEFT(string_exp, count) Returns the leftmost count characters of string_exp. select left(rsrc_name,2) from rsrc Col1
Ca
Co
Op
LENGTH(string_exp) Returns the number of characters in string_exp, excluding
trailing blanks.
select length(rsrc_name) from rsrc Col1
16
23
18
LOCATE(string_exp1,
string_exp2[, start])
Returns the starting position of the first occurrence of
string_exp1 within string_exp2. The search for the first
occurrence of string_exp1 begins with the first character
position in string_exp2 unless the optional argument, start,
is specified. If start is specified, the search begins with
the character position indicated by the v alue of start. The
first character position in string_exp2 is indicated by the
v alue 1. If string_exp1 is not found within string_exp2,
the v alue 0 is returned.
select locate('a',rsrc_name,1) from rsrc Col1
2
17
5
LTRIM(string_exp) Returns the characters of sring_exp, with leading blanks
remov ed.
REPEAT(string_exp, count) Returns a character string composed of string_exp
repeated count times.
select repeat('x',10) from <table> Col1
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
RTRIM(string_exp) Returns the characters of string_exp with trailing blanks
remov ed.
UCASE(string_exp)
UPPER(string_exp)
Returns a string equal to that in string_exp, with all
lowercase characters conv erted to uppercase.
select ucase(rsrc_name) from rsrc
select upper(rsrc_name) from rsrc
Col1
CAPITAL PROJECTS
CONSTRUCTION DEPARTMENT
OPERATING ENGINEER
Function/Snta: Description: Sample SQL: Sample Output:
Date/Time
CURDATE( ) Returns the current date. select concat(rsrc_name,curdate()) from rsrc Col1
Capital Projects2000-12-12
Construction Department2000-12-12
Operating Engineer2000-12-12
2/9/12 Pimaea SDK Pogamme' Gide
25/27 haffeaoc.ne/Pogamme' Gide.hm
CURTIME( ) Returns the current local time. select concat(rsrc_name,curtime()) from rsrc Col1
Capital Projects11:15:00
Construction Department11:15:00
Operating Engineer11:15:00
DAYNAME(date_exp) Returns a character string containing the data source
specific name of the day (for example, Sunday
through Saturday or Sun. through Sat. for a data
source that uses English, or Sonntag through
Samstag for a data source that uses German) for the
day portion of date_exp.
select day name(plan_start_date) from project Col1
Thursday
Friday
Saturday
Friday
Monday
DAYOFMONTH(date_exp) Returns the day of the month based on the month
field in date_exp as an integer v alue in the range of
131.
select day ofmonth(plan_start_date) from project Col1
19
2
7
4
HOUR(time_exp)
Returns the hour based on the hour field in time_exp
as an integer v alue in the range of 023.
select hour(target_start_date) from task Col1
8
8
11
10
MINUTE(time_exp)
Returns the minute based on the minute field in
time_exp as an integer v alue in the range of 059.
select minute(target_start_date) from task Col1
0
0
12
MONTH(date_exp)
Returns the month based on the month field in
date_exp as an integer v alue in the range of 112.
select month(target_start_date) from task Col1
7
9
9
12
MONTHNAME(date_exp) Returns a character string containing the data source
specific name of the month (for example, January
through December or Jan. through Dec. for a data
source that uses English, or Januar through
Dezember for a data source that uses German) for
the month portion of date_exp.
select monthname(target_start_date) from task Col1
July
August
August
September
NOW( ) Returns current date and time as a timestamp v alue. select concat(rsrc_name,now()) from rsrc Col1
Capital Projects2000-12-12 11:45:12
Construction Department2000-12-12
11:45:12
SECOND(time_exp) Returns the second based on the second field in
time_exp as an integer v alue in the range of 059.
select second(target_start_date) from task Col1
0
0
0
YEAR(date_exp) Returns the y ear based on the y ear field in date_exp
as an integer v alue. The range is data source
dependent.
select y ear(target_start_date) from task Col1
1999
2000
Function/Snta: Description: Sample SQL: Sample Output:
Numeric
MOD(integer_exp1, integer_exp2)Returns the remainder (modulus) of integer_exp1 div ided
by integer_exp2.
select mod(task_id,10) from task Col1
1
2
3
4
Function/Snta: Description: Sample SQL: Sample Output:
Sstem
DATABASE( ) Returns the name of the database corresponding to
the connection handle. (The name of the database is
also av ailable by calling SQLGetConnectOption with
the SQL_CURRENT_QUALIFIER connection
option.)
select database() from <table> Col1
da=PMSDK;Driv er=
Primav eraPMSDK;
engine=P3e;
lf=C:\temp\PMSDK.LOG;
lo=terse;pg=1;pp=pubuser;
pu=pubuser;
USER( ) Returns the user name in the DBMS. (The user
name is also av ailable by way of SQLGetInfo by
specify ing the information ty pe:
select user() from <table> Col1
admin
2/9/12 Pimaea SDK Pogamme' Gide
26/27 haffeaoc.ne/Pogamme' Gide.hm
SQL_USER_NAME.) This can be different than the
login name.
FAQ {return to Table of Contents)
What is the SDK?
see Overview section.
What is the Universal Framework?
The Universal Framework exposes the appropriate interfaces and connects to the core VDB logic. Since there will be disparate languages and models between the VDB and UF, an
encapsulated interface paradigm is required to handle the different memory layout and allocation strategies used by Object Pascal, C++, etc.
What is the preferred means of accessing data via the SDK?
ADO is the preferred method. see ADO section.
Is there a preferred language for using the SDK?
Any programming language that can use ADO is fair game.
Is there an Object Model for the SDK?
The SDK is essentially used by applying appropriate SQL statements to the exposed tables. The Object Model in the case of the SDK is essentially the logical schema of the exposed
logical tables. The SDK is a layer that resides over the VDB via the Universal framework. The VDB validates business rules for the SDK.
Can more than one DSN {Data Source Name) exist for the SDK?
Yes. You can create as many System DSNs as you like.
How is the user name and password configured?
Through the Project Management product. The username and password are the same as the application user.
If you execute a SQL statement such as 'DELETE FROM TASK WHERE TASK_ID = 33210' what occurs? That record is removed from the TASK table, but are
any other references to that task removed from other tables as well {i.e., TASKRSRC which stores resources assigned to that activity)? Can you explain
how this takes place?
All DELETE statements cascade to outer tables. Outer tables means rows in other tables which are dependent upon the row being deleted will be deleted along with the master
row. In the case of deleting a TASK row, all associated TASKRSRC rows would be deleted, as well. Additionally, all associated TASKPRED, RSRCHOUR, TASKMEMO, etc. rows would
be deleted. The schema documentation should reflect these relationships among tables.
What files are required for the SDK?
see Files Installed section.
Where can I get the latest version of ADO?
ADO is part of Microsoft's Data Access Components (MDAC). You can download the latest version of MDAC from Microsoft's Data Web site. http://www.microsoft.com/data/
How do I know which version of MDAC I have installed on my computer?
The only way to know the version is to look at the msdadc.dll file version.
How do I determine {through code) what version of MDAC is installed on a computer?
1) Using the ProgID "ADODB.Connection", get it's CLSID from the system registry.
e.g. HKEY_CLASSES_ROOT\ADODB.Connection\CLSID
=> {00000514-0000-0010-8000-00AA006D2EA4}
2)Using the CLSID, get the path under "HKEY_CLASSES_ROOT\CLSID\<CLSID>\InprocServer32" from the system registry.
e.g. HKEY_CLASSES_ROOT\CLSID\{00000514-0000-0010-8000-00AA006D2EA4}\InprocServer32
=> C:\Program Files\Common Files\System\ADO\msado15.dll
3)Get the internal file version of the DLL.
e.g. C:\Program Files\Common Files\System\ADO\msado15.dll
=> 2.10.4202.1
Troubleshooting {return to Table of Contents)
Installation
In order to install the Primavera SDK on WinNT/2000, you need to log in to the PC as an Administrator.
If you are not logged in to the PC as an Administrator you will receive the following message:
2/9/12 Pimaea SDK Pogamme' Gide
27/27 haffeaoc.ne/Pogamme' Gide.hm
Connecion
1) Make sure that you are using a System DSN. see ODBC Data Source Admin section.
2)Make sure the Database Alias (BDE) that the System DSN is set to is valid.
Tip: Download the following from http://www.inprise.com/devsupport/bde/utilities.html
Database connection checker (Sie 136,482 btes)
http://www.inprise.com/devsupport/bde/files/conect32.zip
This program will allow you to check connections to SQL, ODBC, and Standard databases;
also verifies that tables can be opened by BDE32.
3)Make sure you are logging into the SDK as an <Admin Superuser>.
4)Make sure you can log into the GUI application (if installed).
5)Make sure you can log directly into the physical database:
Oracle - use SQL+
MS SQL - use Query Analyzer
Interbase - use BDE Administrator
6)Make sure the appropriate physical database client is installed.
7)Make sure the appropriate database client service is running.
8)Make sure you can ping the database server.
Ping verifies connections to a remote computer or computers. This command is available only if the TCP/IP protocol has been installed.
>ing <serer name>
Daa Acce
Most data access issues involve not having the appropriate scope_level and/or access_level set for a project.
See the sections on scope level and access level.
Pefomance
Avoid using SQL SELECT * FROM <table> statements to improve performance. Use more efficient SQL statements like
SELECT task_id, task_code FROM TASK to improve performance when using the Primavera SDK.
When working with very large data sets you may (potentially) improve performance by increasing the CacheMemSize setting in the
OpenRDA.INI file.
Documentation/URL Sources (en o Table of Conen)
Primavera: http://www.primavera.com/
Primavera SDK installed documentation: \Primavera Common\PMSDK\Doc
Borland: http://www.inprise.com/
MDAC: http://www.microsoft.com/data/
Microsoft ActiveX Data Objects (ADO): http://www.microsoft.com/data/ado/default.htm
Microsoft Windows Scripting Technologies: http://msdn.microsoft.com/scripting/
Java: http://java.sun.com/
MSDN: http://msdn.microsoft.com/default.asp
Open Access: http://www.atinet.com/