Jump to content

Recommended Posts

Posted

there's no doubt command reporter is an amazingly handy tool, and the scope for its use it phenomenal. however the helpfile is appalling limited, there's basically no examples and the dos errors you get from getting it wrong are obscure or meaningless.

 

some examples of working scripts/paramfiles would be helpful i feel.

 

here's the one I've have working, I'm plugging in the values with a vbscript.

 



	
		
			#firstname#
		
	
	
		
			#surname#
		
	

 

the sims report is one that fetches a list of class teachers for a given pupil

 

sims report is

data area: student - population on roll

data fields: forename & surname; for classes of each student: class name of class, class teacher of class, subject of class

filter students where

surname is [?] surname

and forename is [?] forename

use the default sort order surname, legal forename

default output excel

 

the vbscript gets the input of the pupil and sims login details, runs the report, analyses the results and creates an outlook email with the names of the class teachers ignores non-subject related teachers . (outlook auto-checks them)

 

'using cscript
'===============
'args = WScript.Arguments.Count

'If args < 2 then
'  WScript.Echo "usage: cscript scrape.vbs [firstname] [surname]"
'  WScript.Quit
'end If

'firstname=wscript.arguments.item(0)
'surname=wscript.arguments.item(1)

'using wscript
'=============



firstname = inputbox("Type in firstname")
surname = inputbox("Type in surname")

  Const ForReading = 1, ForWriting = 2
  Dim fso, f
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.OpenTextFile("paramfile.base", ForReading)
  ReadAllTextFile =   f.ReadAll
  f.close
  
if (fso.fileexists("teachers.csv")) then fso.deletefile("teachers.csv")
if (fso.fileexists("paramfile.xml")) then fso.deletefile("paramfile.xml")   

mystring = replace(readalltextfile, "#firstname#", firstname)
mystring2 = replace(mystring, "#surname#", surname)

Set MyFile = fso.CreateTextFile("paramfile.xml", True)
myfile.writeline(mystring2)
myfile.close

'wscript.echo("Checking Sims...")
DIM objShell
set objShell = wscript.createObject("wscript.shell")

simsuser=inputbox("type in sims username")
simspass=inputbox("type in sims password")

iReturn = objShell.Run("""C:\Program Files\SIMS\SIMS .net\commandreporter.exe"" /user:" & simsuser & " /password:" & simspass & " /report:""find teachers for student""  /PARAMFILE:""paramfile.xml"" /OUTPUT:""teachers.csv""",0,true)

if fso.fileexists("teachers.csv") <> true then
  wscript.echo "sims details incorrect"
  wscript.quit
end if

Set f2 = fso.OpenTextFile("teachers.csv", ForReading)
readallcsv = f2.readall
if len(readallcsv) < 40 then
wscript.echo "No Data found"
wscript.quit
end if
f2.close
Set f2 = fso.OpenTextFile("teachers.csv", ForReading)

'wscript.echo readallcsv

skipline=f2.readline
'wscript.echo("Assembling teacher list...")

Do While f2.AtEndOfStream <> True
 retstring = f2.ReadLine
 removequotes = replace(retstring,"""","")
 linearray = split(removequotes,",")
 teacher=linearray(2)
 teacherstr=split(teacher," ")
 teachername=left(teacherstr(1),1) & " " & teacherstr(ubound(teacherstr))
 
 if  len(linearray(3)) > 2 then 
emailstr=emailstr & teachername & ";" 
 end if
Loop
f2.Close
fso.deletefile("teachers.csv")
fso.deletefile("paramfile.xml")

iReturn = objShell.Run("""c:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"" /c ipm.note /m " & """" & emailstr & """")

 

if other people can post examples of working with commandreporter, it would be pretty helpful.

  • Thanks 2
  • 1 month later...
Posted

Hey, I've been going round in circles for ages trying to achieve a similar thing to you - how do I go about generating a parameters xml file to pass to a report thru the command line?

 

Any help would be much appreciated!

 

Thanks

 

;)

Posted
Hey, I've been going round in circles for ages trying to achieve a similar thing to you - how do I go about generating a parameters xml file to pass to a report thru the command line?

 

Any help would be much appreciated!

 

Thanks

 

;)

 

you can get the parameter defs in a file with a command like

CommandReporter /USER:user1 /PASSWORD:abcd /REPORT:"SomeReport" /PARAMDEF /OUTPUT:"c:\paramdefs.xml" /QUIET

 

near the bottom of that xml file is a section with id codes of the parameters for the report. use them to make a file like my first bit of code. I only know what to do with really simple reports tho. I totally failed to figure out how to use date things.

 

you can then call the report with the new paramfile like

CommandReporter /USER:user1 /PASSWORD:abcd /REPORT:"SomeReport" /QUIET /PARAMFILE:"c:\paramfile.xml"

  • 5 years later...
Posted

HI, Sorry for digging up an old thread, i am trying to run a report using the command line reporter. I have the Param file but i need to specify the data as todays date. How do i do that?

 

I can see where i can enter a date but i need it to be the date or run time.

 

Thanks

Posted
HI, Sorry for digging up an old thread, i am trying to run a report using the command line reporter. I have the Param file but i need to specify the data as todays date. How do i do that?

 

I can see where i can enter a date but i need it to be the date or run time.

 

Thanks

 

I wrote a script for someone a while back that would dynamically set the date, perhaps that'll get you started?

 

http://www.edugeek.net/forums/mis-systems/66215-sims-net-reporting.html#post593543

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...