6 Replies Latest reply on Jan 10, 2011 12:33 PM by TimRogers

    Export as Auto-Generated File Name??

    TimRogers

      Title

      Export as Auto-Generated File Name??

      Post

      I want to export a list as either a pdf or excel and have the file name auto-generate as the current date?

      Anyone know of a way to do this?

      Thanks

        • 1. Re: Export as Auto-Generated File Name??
          philmodjunk

          Do it all the time for a PDF:

          Set Variable [$FilePath ; Value: "file:" & Get ( DesktopPath ) & Substitute ( Get ( CurrentDate) ; "/" ; "-" ) & ".PDF"

          / can't be used in a filename so the subsitute replaces it with - in the date.

          This example saves to the desktop. You can use an explicity file path or a different Get function to save it to any number of other locations.

          • 2. Re: Export as Auto-Generated File Name??
            TimRogers

            Thanks,

            That worked perfect for saving to the desktop. But when I modify that to:

            Set Variable [$FilePath ; Value: "filewin:C:\Documents and Settings\Rock Creek\My Documents\Daily Cashouts\PDF Dailies\\" & "Daily.Cashouts." & Substitute ( Get ( CurrentDate ) ; "/" ; "-" ) & ".pdf"

            It tells me "the file specified could not be created on the disk. Use a different name, create more space... blah blah blah blah"

            The disk is perfectly fine....  Do I have something wrong setup in specifying that directory??

             

            appreciate the help!

            • 3. Re: Export as Auto-Generated File Name??
              Sorbsbuster

              Why have you two backslashes after 'Dailies'?

              • 4. Re: Export as Auto-Generated File Name??
                TimRogers

                There's an issue with ending a quoted phrase with a backslash. I'm not exactly sure what the issue was (and forgive me, at the moment I'm not near a computer with that file for the exact error) But when I did have one backslash after dailies it would highlight the decimal in ".PDF" and give me the error that it was not a valid number?

                Searching this error on the forum gave me the solution to use two backslashes.

                This seems to work, as with that above code it does attempt to save that file with just the one backslash... It just won't let me.

                • 5. Re: Export as Auto-Generated File Name??
                  philmodjunk

                  Inside quotes, the backslash \ is an "escape" character so that you can use \" to place quotation marks inside the quoted text. To get a backslashp to be just a back slash, you have to enter it twice: \\. But you need to do that everywhere you've used a backslash.

                  For a simpler filepath expression, use the forward slash instead:

                  "filewin:C:/Documents and Settings/Rock Creek/My Documents/Daily Cashouts/PDF Dailies/" & "Daily.Cashouts." & Substitute ( Get ( CurrentDate ) ; "/" ; "-" ) & ".pdf"

                  • 6. Re: Export as Auto-Generated File Name??
                    TimRogers

                    Thank you sir!

                    It is now working perfectly. I appreciate you time and patience helping out a newbie and illiterate like myself!!

                    Cheers.