Topic
  • 4 replies
  • Latest Post - ‏2013-05-09T20:57:14Z by jay81
jay81
jay81
3 Posts

Pinned topic DXL for restoring DPA file

‏2013-05-08T21:34:34Z |

I am trying to restore a dpa file using dxl scripting and I am running into issues with the "restore" command.

I'm starting with a very simple script (detailed below):

ArchiveData archiveData
string filename = "test.dpa"
string message
message = get(filename, archiveData)
if (null message) {
message = restore (archiveData, "TEST PROJECT")
if (message != null) {
ack message
halt
}
}
else
ack message

When I run this script, i constantly get an error message that states "Cannot find target location".  I think this is happening because "TEST PROJECT" does not exist, however if I first create the "TEST PROJECT" project, the script throws a "duplicate project name" error. I'm not sure what I am doing wrong, but nothing seems to be working.

Also, the reason why I chose to use the ArchiveData framework is because I would like to be able to deselect/select only certain modules to be restored.

Any help will be greatly appreciated!

Updated on 2013-05-08T21:39:46Z at 2013-05-08T21:39:46Z by jay81
  • llandale
    llandale
    3035 Posts
    ACCEPTED ANSWER

    Re: DXL for restoring DPA file

    ‏2013-05-09T15:19:03Z  

    Guess1:  Add a slash:

    • message = restore (archiveData, "/TEST PROJECT")

    Guess2: You lack "C" rights to the database root folder.

    -Louie

  • Tony_Goodman
    Tony_Goodman
    271 Posts

    Re: DXL for restoring DPA file

    ‏2013-05-09T13:47:32Z  

    Wrong function name!

    You need to use restoreProject, which takes an extra string parameter for the description.

    string res = restoreProject("c:/test.dpa", "New Project Name", "New Project Description")

    This creates the new project in the current folder.

  • llandale
    llandale
    3035 Posts

    Re: DXL for restoring DPA file

    ‏2013-05-09T15:19:03Z  

    Guess1:  Add a slash:

    • message = restore (archiveData, "/TEST PROJECT")

    Guess2: You lack "C" rights to the database root folder.

    -Louie

  • jay81
    jay81
    3 Posts

    Re: DXL for restoring DPA file

    ‏2013-05-09T20:56:00Z  
    • llandale
    • ‏2013-05-09T15:19:03Z

    Guess1:  Add a slash:

    • message = restore (archiveData, "/TEST PROJECT")

    Guess2: You lack "C" rights to the database root folder.

    -Louie

    Guess1 is a winner! I never thought of adding the slash as the documentation does not have an example of the usage of string restore(ArchiveData archive [,string archiveName], [bool serverArchive])

    Thanks!

  • jay81
    jay81
    3 Posts

    Re: DXL for restoring DPA file

    ‏2013-05-09T20:57:14Z  

    Wrong function name!

    You need to use restoreProject, which takes an extra string parameter for the description.

    string res = restoreProject("c:/test.dpa", "New Project Name", "New Project Description")

    This creates the new project in the current folder.

    I can definitely restore projects directly by referencing the file name, however I was hoping to use the restore function that allows the usage of the data type ArchiveData.  This allows me to restore only portions of project, instead of every single module in the archive.