Inserting a Linked Project via direct database manipulation.

Z

Zac Maclean

I am creating Project files from an unrelated database, and injecting them into a SQL database made specifically to hold them. I have the process of creating the initial Project file and adding a task. Now I would like to nest some projects inside others. I have read the prdb.htm included in the help, but it isn't specific on whether or not it is Linking or inserting as tasks.

Next, some advice if possible, as to the approach.

When I call to make the level that is going to be a sub-project, should I Create 1 / Insert 1, Create 2 / Insert 2; or Create all / Insert all?

My other database is going to do a good job of setting up the relationships, I am just reading them, and creating the MS Project files for them.



----------Project Database Help File------------ (relavent part)

Creating an inserted project
The process for creating an inserted project in the database is a combination of creating a new task and specifying the value of a custom text field. You must add new records to the MSP_TASKS and MSP_TEXT_FIELDS tables with values for at least the following fields, as well as setting the externally edited flag in the MSP_PROJECTS table:

Table Fields Notes
MSP_TASKS PROJ_ID Refers to a valid ID in the MSP_PROJECTS table.
TASK_UID Contains the ID for the task.
TASK_ID The position identifier of the task in the list of tasks.
EXT_EDIT_REF_DATA Must be set to 1 to indicate that this task is a new task.
MSP_TEXT_FIELDS PROJ_ID Refers to a valid ID in the MSP_PROJECTS table.
TEXT_CATEGORY Set to 0 to indicate a Task.
TEXT_REF_UID Refers to a valid ID in the MSP_TASKS table.
TEXT_FIELD_ID Refers to a valid CONV_VALUE in the MSP_CONVERSIONS table.
TEXT_VALUE The name of the project to be inserted. For example:
<c:\test.mdb>\my project
MSP_PROJECTS PROJ_EXT_EDITED Must be set to 1 for Project to process.
PROJ_EXT_EDITED_TEXT Must be set to 1 for Project to process.

Note When deleting an inserted project from the database, all of the rows for the inserted project from the tables specified above must be deleted to avoid leaving orphaned data in the database, which could cause unpredictable results when the database is opened in Project.

For example, let's say you have two projects stored in a database, and you want to make one of them an inserted project of the other. Assume the two projects are in an .mpd file that you access with a DSN called "Projects" and the project names are Master Project and Subproject. First you need to create a task in Master Project to hold the inserted project. This record in the MSP_TASKS table would appear as follows:

Fields Values
PROJ_ID 1
TASK_UID 5
TASK_ID 5
TASK_NAME My subproject
EXT_EDIT_REF_DATA 1

The TASK_ID and TASK_UID used here are chosen for demonstration purposes and have no significance. The important issue to remember is that they must be unique among all the IDs for the current project. After you have inserted this task, you need to specify the name of the inserted project file. For example, the following is the row to add to the MSP_TEXT_FIELDS table:

Fields Values
PROJ_ID 1
TEXT_CATEGORY 0
TEXT_REF_UID 5
TEXT_FIELD_ID 188743706
TEXT_VALUE 4800

The value of PROJ_ID must refer to a valid ID in the MSP_PROJECTS table. In this case, the TEXT_CATEGORY is 0 because we are setting a task text field. The value of TEXT_REF_UID is taken directly from the TASK_UID column in the MSP_TASKS table. The value of TEXT_FIELD_ID is taken from the CONV_VALUE column in the MSP_CONVERSIONS table from the record where the CONV_STRING equals Task Subproject File. The TEXT_VALUE field gets the actual project name.

In order for Project to read this row, you must set the PROJ_EXT_EDITED_TEXT flag in the MSP_PROJECTS table to 1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top