Topic
  • 5 replies
  • Latest Post - ‏2014-11-21T17:21:29Z by MikeMelon
jhays
jhays
1 Post

Pinned topic Script to automate creation of DOORS Project Archive

‏2014-04-01T14:30:12Z |

Anyone have a script that could be scheduled to create a DOORS Project Archive automatically?

  • SudarshanRao
    SudarshanRao
    50 Posts

    Re: Script to automate creation of DOORS Project Archive

    ‏2014-04-03T05:13:22Z  

    It would be quite simple script, with a loop (for project in database do) and the archive function within it. But, since in DOORS you can have project within a project, simply archiving all projects may mean that you'd end up duplicating data.

    So you may want to consider having all items at root level to be of type project, and then archiving only the root level projects.

    Even after you convert folders at root level to projects, the script logic would pretty much remain the same, except the loop - you'd need for item in folder do loop.

  • llandale
    llandale
    3035 Posts

    Re: Script to automate creation of DOORS Project Archive

    ‏2014-04-03T18:11:05Z  

    It would be quite simple script, with a loop (for project in database do) and the archive function within it. But, since in DOORS you can have project within a project, simply archiving all projects may mean that you'd end up duplicating data.

    So you may want to consider having all items at root level to be of type project, and then archiving only the root level projects.

    Even after you convert folders at root level to projects, the script logic would pretty much remain the same, except the loop - you'd need for item in folder do loop.

    Or bypass projects with parent projects:

    • if (!null getParentProject(item(fullName(p))) then continue
  • Chris Annal
    Chris Annal
    24 Posts

    Re: Script to automate creation of DOORS Project Archive

    ‏2014-04-04T16:45:40Z  

    It's been a while since I posted a script to this forum - so I'm not sure if the formatting will hold, but below is a script that will archive all the projects in a DOORS database (except those that are currently locked because someone has a module open). It will email the results, listing all the projects that it archived and also list those that weren't archived because they were locked. It will give you the DOORS username of the culprit who was locking you out.

    It's written to export the archived projects to a folder named "DOORS_Projects" on your C drive, so you'll have to create that folder if it doesn't exist. I would run this as a batch process, using a Windows scheduled task on the PC that runs it - so you can run it at night and get the results the next morning.

    Good Luck!!

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    //Archive Projects - CheckLocks
    /*
    Archive projects, after first checking to make sure they aren't locked - email results
    */

    //Created 09/07/2011 - Saab Sensis Corp - C. Annal
    /*******************************************************************************
     * Global constants
     */
    // These must be changed to correspond to the user's email address, corporate email server and account
    // that will send the email. The fromDescription and subject will appear as the "From" and
    // "Subject" of the email.
    const  string targetAddress = "<your email address>"
    const  string  emailServer = "<corporate_email_server>"
    const  string  emailAccount = "DOORS"
    const string  fromDescription = "DOORS"
    const string  subject = "Archive Results"

    /*******************************************************************************
     * Global Variables
     */
    Lock lockItem
    LockList lcklist
    string sProjectName
    string message  = ""
    Project pX
    Buffer bx1=create, bx2=create

    /*******************************************************************************
     * Function Declarations
     */
    bool bLockedByAnyUser=true, bLocked

    /*******************************************************************************
     * Script
     */

    for pX in database do { 
    sProjectName = name pX  
    Project parent = getParentProject(pX)
    if(null parent && !isDeleted pX){
       lcklist = getLocksInFolder(pX,true,bLockedByAnyUser)
       bLocked=false
    for lockItem in lcklist do {
       bLocked=true;
       string lckuser = lockItem.user
       bx1+=sProjectName " locked by " lckuser "\n";
       break
    }// End for lockItem in lcklist do
       if(bLocked)continue
       bx2+= sProjectName " was processed \n"
       string proj_archive = archive (sProjectName,"c:\\DOORS_Projects\\"(sProjectName)".dpa",false,true,allBaselines,false) 
    if (!null proj_archive)
     {
      ack proj_archive
      halt
     }// End !null proj_archive
    }// End if(null parent && !isDeleted pX)
    }// End for pX in database do
    message = bx1 "\n" bx2""
    sendEMailNotification(
     fromDescription,
     targetAddress,
     subject,
     message)
    //halt

    Updated on 2014-04-14T16:32:00Z at 2014-04-14T16:32:00Z by Chris Annal
  • Chris Annal
    Chris Annal
    24 Posts

    Re: Script to automate creation of DOORS Project Archive

    ‏2014-04-14T16:23:57Z  

    It's been a while since I posted a script to this forum - so I'm not sure if the formatting will hold, but below is a script that will archive all the projects in a DOORS database (except those that are currently locked because someone has a module open). It will email the results, listing all the projects that it archived and also list those that weren't archived because they were locked. It will give you the DOORS username of the culprit who was locking you out.

    It's written to export the archived projects to a folder named "DOORS_Projects" on your C drive, so you'll have to create that folder if it doesn't exist. I would run this as a batch process, using a Windows scheduled task on the PC that runs it - so you can run it at night and get the results the next morning.

    Good Luck!!

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    //Archive Projects - CheckLocks
    /*
    Archive projects, after first checking to make sure they aren't locked - email results
    */

    //Created 09/07/2011 - Saab Sensis Corp - C. Annal
    /*******************************************************************************
     * Global constants
     */
    // These must be changed to correspond to the user's email address, corporate email server and account
    // that will send the email. The fromDescription and subject will appear as the "From" and
    // "Subject" of the email.
    const  string targetAddress = "<your email address>"
    const  string  emailServer = "<corporate_email_server>"
    const  string  emailAccount = "DOORS"
    const string  fromDescription = "DOORS"
    const string  subject = "Archive Results"

    /*******************************************************************************
     * Global Variables
     */
    Lock lockItem
    LockList lcklist
    string sProjectName
    string message  = ""
    Project pX
    Buffer bx1=create, bx2=create

    /*******************************************************************************
     * Function Declarations
     */
    bool bLockedByAnyUser=true, bLocked

    /*******************************************************************************
     * Script
     */

    for pX in database do { 
    sProjectName = name pX  
    Project parent = getParentProject(pX)
    if(null parent && !isDeleted pX){
       lcklist = getLocksInFolder(pX,true,bLockedByAnyUser)
       bLocked=false
    for lockItem in lcklist do {
       bLocked=true;
       string lckuser = lockItem.user
       bx1+=sProjectName " locked by " lckuser "\n";
       break
    }// End for lockItem in lcklist do
       if(bLocked)continue
       bx2+= sProjectName " was processed \n"
       string proj_archive = archive (sProjectName,"c:\\DOORS_Projects\\"(sProjectName)".dpa",false,true,allBaselines,false) 
    if (!null proj_archive)
     {
      ack proj_archive
      halt
     }// End !null proj_archive
    }// End if(null parent && !isDeleted pX)
    }// End for pX in database do
    message = bx1 "\n" bx2""
    sendEMailNotification(
     fromDescription,
     targetAddress,
     subject,
     message)
    //halt

    The only formatting issue with my code above (as far as I can tell) is that there is a single line of code that appears on two separate lines. This should all appear on the same line...

    string proj_archive = archive (sProjectName,"c:\\DOORS_Projects\\"(sProjectName)".dpa",false,true,allBaselines,false)

    ...for that part of the code above, the "double slashes" appear as a comment line just before the "(sProjectName)".dpa

     

    ...sorry, the "new" format still confuses me.

    Updated on 2014-04-14T16:32:57Z at 2014-04-14T16:32:57Z by Chris Annal
  • MikeMelon
    MikeMelon
    37 Posts

    Re: Script to automate creation of DOORS Project Archive

    ‏2014-11-21T17:21:29Z  

    Hi Chris,

    This is an excellent DXL script. It is working very well. I will be customizing the script slightly to meet my DOORS project needs.

    Again thanks a bunch for this great DXL script to archive DOORS projects.

    Best regards,

    Mike