6 Replies Latest reply on Jul 11, 2014 12:54 PM by Pete Yodis

    Capturing a document's folder name and storing as a variable

    Pete Yodis

      I am looking to capture a document's folder location (just the name of that folder, not the full path) and store it as a variable on it's datacard so that it can be used for the location of that document's PDF output in a mirrored set of folders.  I would like this variable to update when the file is moved to a different folder, as well.  Any thoughts?

        • Re: Capturing a document's folder name and storing as a variable
          Brian McEwen

          Pete, 

           

          One of the Dispatch conditions is "On Add"  I haven't used that one but since moving files is treated like an Add that might work to trigger Dispatch to update the variable.  [[edit: Nope, it doesn't work that way. Only triggers on initial add I think. They should have an On Move condition. ]]

           

          I have something similar set up already.  I created a FilePath variable that I store on file datacards.  A Version Free variable is great for this since I don't care about the History, and I'm not mapping it.  I use it for searches, and it is also handy for Control Logic on data cards: can have certain controls show up based on file extension, without having different cards for different extensions - I have only 2 data cards.

           

          It updates with a Transistion Action, and I have a Dispatch script that will update it on Check-in... but I'm thinking I should test the On Add condition instead.  I can also manually run my FilePath Update Dispatch with a right click.

           

          However, for your use, to locate PDF output... are you using the Convert Task?  It has Source Folder Path, Vault Root Folder Path, and Source File Name as options in the "Output File Details" - that doesn't get you what you want? 

            • Re: Capturing a document's folder name and storing as a variable
              Pete Yodis

              Thanks Brian,

               

              "However, for your use, to locate PDF output... are you using the Convert Task?  It has Source Folder Path, Vault Root Folder Path, and Source File Name as options in the "Output File Details" - that doesn't get you what you want?"

               

              No, it doesn't get me what I want out of the box.  I need to save the PDF file in a set of mirrored folders.  I need to modify the task using at least S-061104.  I would need the variable for the folder path that the document is in.

               

              I was thinking I might have to use dispatch to update the variable any time the file is moved.

               

              How does your FilePath variable grab the document's folder location?

                • Re: Capturing a document's folder name and storing as a variable
                  Brian McEwen

                  Getting the path into FilePath variable: 

                   

                  The starting step is on the data card.  I have an Edit box  (it is tiny, or it could just be hidden) and the Default Value is a Special Value of File Path - that fills it in automatically when a new file or folder is created.  I use ControlLogic to grey it out if it contains "\".  That prevents editing by typing.

                   

                  With a folder I don't know if there is anything you can use to trigger Dispatch.  So on creating the folder it will be set correctly, but you know stuff is going to change... and I don't see a way to update other than manually running Dispatch periodically on groups of folders (or doing something with API no doubt).  By the way I edited my previous post - Dispatch "On Add" condition does not work the way I hoped.

                    • Re: Capturing a document's folder name and storing as a variable
                      Pete Yodis

                      Brian,

                       

                           I used an edit box with the Special Value of 'File Path', however it shows the next folder up from what I want and not the direct subfolder.  For example, my file is in .....\Released Drawings\10-3XXX-XX.  I want the variable to display 10-3XXX-XX on the data card and it is displaying 'Released Drawings'.  I do not know why.  Any ideas?

                        • Re: Capturing a document's folder name and storing as a variable
                          Pete Yodis

                          I am now using dispatch to update the data card with the folder name that the document resides in.  Worked with my reseller on this one.  Shout out to Cristian Fustos at Design Point Solutions.  Here are the screen shots of the dispatch script.

                          dispatch script to catch folder name.JPGset variables.JPGset card variables.JPG

                           

                          I can either do this with a right click function per document, or I have also configured the dispatch to run whenever a file is added to the vault.  Our users will have to remember to run the dispatch if they move a file from one folder to another.  I don't know of a way to automate this.

                  • Re: Capturing a document's folder name and storing as a variable
                    Brian McEwen

                    I wouldn't be surprised if the standard convert task does not get you there (if you are using it). 

                     

                    Check this out Re: Automatic folder selection

                    And search Knowledge Base for S-061104, includes a pdf you can download  (lot of hits on this forum too if you search the same).