Jump to content

Recommended Posts

Posted

Hello all!

 

I'm familar with using CommandReporter to run various scheduled reports (used for our staff Intranet), however I now need to run a report than queries information based on the previous days date.

Here is what I have so far:

 

The batch file that the scheduled task runs each morning is:

 

"C:\Program Files\SIMS\SIMS .net\CommandReporter.exe" /user:j.bloggs /password:123456 /report:"Title of my report" /PARAMFILE:"E:\Intranet\studentreportparam.xml" /output:"E:\Intranet\"

 

The XML parameter file that this refers to contains:

 

End DateDateEnd Date is after2015-05-13T13:22:38

 

Now this all works fine and I get a nice CSV report of all students where the end date is after 13th May 2015.

 

Now the tricky bit and the part i'm totally stuck with! ... How in the Date field of the parameter file can I automatically place in the previous days date so that I never have to manally touch the scheduled task process?

I've looked at other examples using VBS and Powershell but they seem to fail each time and so I'm turning to all the edugeek genius's out there for assistance!

 

Thank you :-)

Posted

Good news, after some further hours of lots and lots of playing/testing I have cracked it with a VBS Script! :-)

 

I will post below in case it helps anyone in the future...

 

 

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set ParamFile = fso.CreateTextFile("stuonreportparams.xml", true)

Dim strParams
'Create start of XML parameters
strParams = "End DateDateEnd Date is after"

'Calculate start date
strDate = DateAdd("d",-1,Date)
strStart = Year(strDate) & "-" & Month(strDate) & "-" & Day(strDate) & "T00:00:00"

strParams = strParams & strStart
strParams = strParams & ""

'execute command reporter
ParamFile.Write(strParams)
ParamFile.Close
WshShell.Run """C:\Program Files\SIMS\SIMS .net\commandreporter.exe"" /user:j.bloggs /password:123456 /report:""My Intranet Report"" /output:studentreport /paramfile:stuonreportparams.xml"

  • Thanks 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...