in this second part of primavera p6 databases and data cleansing series, we will discuss the data structure of an xer file, and how the xer file parser & builder works. as the xer file parser is a manual process (it does not honour p6 business rules), it is handy for the user to have a working knowledge of the p6 database. that’s why in this p6 tutorial we will show a general overview of p6’s data structure, and basic concepts in p6’s database management ( tables, fields , primary key).
1) a quick understanding of primavera’s p6 data structure
1.1) how is data stored in the p6 pmdb database?
primavera p6 stores data in a more then 170 tables, every tables contains fields, and every field stores records.
the tables are referenced to each other by relations between primary key and foreign key,
for a description of all the tables check this primavera documentation , unzip the file, then read the file called pmschema.html.
fortunately, you don’t need to understand the relations between all 170 tables (whew!). in reality there are only around 20 most used tables that you need really to be familiar with.
calculated fields are not stored in primavera’s database as they are calculated on the fly based on other stored fields. for example, resource spread data are not stored in the database at all.
for illustration only, here an example of a p6 database diagrams (showing only some tables) that illustrates the many interconnections.
nb: generated by pl/sql developer (using a demo version)
1.2) an example – where data is written in the p6 db
we will use a simple example to show how data you input into p6 client are stored in the database.
let’s take project codes as an example.
let’s say you define a new project code in p6. you then define values for your new project code.
now let’s see how p6 stores the data in the database with the help of excel.
the project code definitions are stored in a table called pcattype. here’s what that table looks like.
the project code values are stored in a table called pcatval. here’s what the pcatval table looks like.
the foreign key 93 references these values to the same primary key in the table pcattype, which essentially links the project code values to their project code across tables.
now if in the xer file parser you delete the primary key 93 and you leave it in the table pcatval, you will create an orphaned record, and your xer file will be corrupted and cannot be imported. but more on that later.
2) how primavera p6 exchanges data
xer is the most used format to exchange data with other p6 databases, as xml had some limitations ( limited to one project, less data is exported comparing to xer). in version 8.3, those limitation are removed and there are option to change global data attributes including
- move global codes and calendars to project level.
- map codes, udfs, 世界杯时间比赛时间 and calendars to existing value.
2.1) what is an xer file?
the xer file is one of the formats used by primavera to exchange schedule data. it is a cvs type file with tab as a delimiter. in simple english, it is just a text file with tabular data that you can open and modify in any text editor or program that read a cvs file.
2.2) how to view an xer file using excel
you can view the content of an xer file using the notepad editor, or better using excel as it you give a better overview of the data structure.
- open a new sheet, go to data then get external data from text, select your xer file then accept all default.
the first row stores the revision of p6 in which the xer was created (7), the date of the export, and the name of the user.
you will notice that the column a has 4 different attributes:
- %t : table
- %f : field
- %r : record.
- %e: last row in the xer file.
now when you filter only %t you will have the list of tables:
2.3) what data is exported in an xer file?
when you export a project in a xer file, the data is mapped up to 66 tables, usually not all the features are used in a p6 a schedule – generally speaking an “average” xer file has less than 20 tables. only the data present in the “modify import configuration” can be exported.
3) the xer file parser utility
3.1) what is the xer file parser?
the first part of this tutorial was to show that an xer file can be opened and modified by any editor, but it is not the best solution, as the data is combined in one sheet, and it is very easy to make a mistake thus corrupting your xer. instead primavera has created a versatile utility (though not well known).
the xer file parser can be used for many purposes
- to correct a corrupted file, the best known example is an xer file with orphan records, as it can be imported to p6
- clean an xer file
- other uses that probably was not intended by the developer (like importing a wbs from excel)
3.2- how does it work?
the xer parser is a vba macro for excel that reads an xer file and, based on the values of the first column (%t,%r,%f,%e), will either;
- generate a summary sheet with all the tables.
- write every table to a different sheet. then eventual after you made any modification, you can build a new xer file. notice that the parser will not overwrite the original file.
the other functionally is diagnostic; it performs three tests and generates a report with the result
- check for null ( the primary key should not be null)
- check for duplicates ( the primary key should be unique)
- cross check for fk ( check the reference pk exist)
wrap up
in this part we had a general view of how p6 data store data and how the xer parser & builder works, in the next series we will show you how to use the parser to clean your xer files (global code to project codes, and how to map udf etc).
thing for you to try
just read the primavera p6 database schema and you will see that the data in an xer file is not that complicated to comprehend – you don’t need to be a database administrator! but you should at least understand the terminology.