1 Reply Latest reply on Aug 14, 2017 3:31 PM by Michael Dekoning

    Report Generator for Created Date

    Darius Teichroew

      I would like to run a query for files in a particular folder that were created on a particular date. Can anyone help me with what is probably pretty simple code? User input will be the date and the folder.

       

      Thanks!

        • Re: Report Generator for Created Date
          Michael Dekoning

          Darius,

          Import this into your Report Generator-

           

          @[AddedToProjectOnDate]

          §Name [Files added to a folder on a given date]

          §Company [Mike DeKoning]

          §Description

          [This query will return the files added to a folder on a given date.]

          §Version [1.1]

          §Arguments

          [

          ProjectID pProjId [1] [Select folder, i.e. "$\Documents" or browse for a folder.]

          String stdate [1] [Enter start date as M/D/YYYY, i.e. 1/1/2017.]

          ]

          §Sql

          [          

          declare @stdate nvarchar(15)

          set @stdate = {stdate}

          SELECT  Documents.Filename

          FROM    TransitionHistory INNER JOIN

                  Documents ON TransitionHistory.DocumentID = Documents.DocumentID INNER JOIN

                  DocumentsInProjects ON Documents.DocumentID = DocumentsInProjects.DocumentID INNER JOIN

          Transitions ON Transitions.TransitionID = TransitionHistory.TransitionID INNER JOIN

          Workflows ON Workflows.InitialTransitionID = Transitions.Source

          WHERE   DocumentsInProjects.Deleted = 0 AND

          TransitionHistory.Date BETWEEN CONVERT(DATETIME, @stdate , 102) AND

          DATEADD(d,1,@stdate) and Documents.Deleted = 0 AND

          DocumentsInProjects.ProjectID = {pProjId}

          ]