Topic
  • 4 replies
  • Latest Post - ‏2012-11-27T17:52:43Z by llandale
SystemAdmin
SystemAdmin
3180 Posts

Pinned topic Folder create() command intricacies

‏2012-11-21T17:24:55Z |

Hello,

I am attempting to create a folder within a current project using the create command, but it does not seem to actually create the folder. I have the following setup:
 

string ProgramName = "Program"
string FolderName = "New Folder"
 
string Location = "/Project/Folder1/Folder2/Folder3"
//Creates the concatenated path to a folder that already exists.
string ProgramDev = Location "/" ProgramName
 
//Set the location of the folder to be created
current = folder ProgramDev
 
//This will create the folder using the user entered name
//I leave the second string empty because I am not going to fill in the description.
Folder create(string FolderName)
 
infobox "Folder created, Please Close Create Folder Prompt"

 


I am attempting to use the hierarchy setting the location of creation then giving it the name. When I run this code it runs without reporting errors but I go to the path location and the folder is not created. Is there something I am missing? Trying to do babysteps here for a larger copy/paste modules for multiple reproductions. Any thoughts?

Thanks
Andrew

 

Updated on 2014-01-06T14:44:35Z at 2014-01-06T14:44:35Z by iron-man
  • MichaelGeorg
    MichaelGeorg
    53 Posts

    Re: Folder create() command intricacies

    ‏2012-11-22T14:40:58Z  

    Hello awcook1,

    actually I also don't know what happens if you execute:

    Folder create(string FolderName)
    


    Normally I would think that you should get a DXL error, because the second parameter in create function for folders isn't optional and therefore mustn't be omitted. So perhaps the DXL compilier gets as confused as I by your cast of the string variable FolderName into a string. (>ou don't need to do a cast here)

    If you want to create a folder without a description you can do that by:

     

    Folder f = create(FolderName, "")
    

     


    or better by:

     

     

     

    Folder f
    string ErrorMessage = create(FolderName, "" , f)
    if(ErrorMessage != "") {
        //deal with error - e.g. with  print ErrorMessage
    }
    


    in this way you will recognize if the operation fails.
    Just as a hint:
    That you have created a folder does not mean you can see it in your DOORS Explorer. So to make the new folder(s) visible you need to update your DOORS Explorer via view menu.

    - Michael

     

    Updated on 2014-01-06T14:45:40Z at 2014-01-06T14:45:40Z by iron-man
  • llandale
    llandale
    2986 Posts

    Re: Folder create() command intricacies

    ‏2012-11-26T17:29:07Z  

    Hello awcook1,

    actually I also don't know what happens if you execute:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Folder create(string FolderName) </pre>


    Normally I would think that you should get a DXL error, because the second parameter in create function for folders isn't optional and therefore mustn't be omitted. So perhaps the DXL compilier gets as confused as I by your cast of the string variable FolderName into a string. (>ou don't need to do a cast here)

    If you want to create a folder without a description you can do that by:

     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Folder f = create(FolderName, "") </pre>

     


    or better by:

     

     

     

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Folder f string ErrorMessage = create(FolderName, "" , f) if(ErrorMessage != "") { //deal with error - e.g. with print ErrorMessage } </pre>


    in this way you will recognize if the operation fails.
    Just as a hint:
    That you have created a folder does not mean you can see it in your DOORS Explorer. So to make the new folder(s) visible you need to update your DOORS Explorer via view menu.

    - Michael

     

    refreshDBExplorer()
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: Folder create() command intricacies

    ‏2012-11-26T21:14:35Z  
    I was missing the refreshDBExplorer() command, Thanks
  • llandale
    llandale
    2986 Posts

    Re: Folder create() command intricacies

    ‏2012-11-27T17:52:43Z  
    I was missing the refreshDBExplorer() command, Thanks
    It is a written function, not a language perm.