+ Post New Thread
Results 1 to 4 of 4
MIS Systems Thread, [Sims] Command reporter working examples in Technical; there's no doubt command reporter is an amazingly handy tool, and the scope for its use it phenomenal. however the ...
  1. #1
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,524
    Thank Post
    106
    Thanked 88 Times in 74 Posts
    Blog Entries
    46
    Rep Power
    40

    [Sims] Command reporter working examples

    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.

    Code:
    <?xml version ='1.0' encoding= 'utf-8'?>
    	<ReportParameters>
    		<Parameter id='ad1UZsHiqQlPgT3J/oly2w==' subreportfilter='False'>
    			<Values>
    				<Value>#firstname#</Value>
    			</Values>
    		</Parameter>
    		<Parameter id='imPdWUkx6H4z804UEeUIpg==' subreportfilter='False'>
    			<Values>
    				<Value>#surname#</Value>
    			</Values>
    		</Parameter>
    	</ReportParameters>
    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)

    Code:
    '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.

  2. 2 Thanks to browolf:

    dhicks (28th May 2010), vikpaw (1st June 2010)

  3. #2

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    I posted this up a while back, never got much interest though:

    SIMS ID Interface / CommandReporter Example

  4. #3

    Join Date
    Jul 2010
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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


  5. #4
    browolf's Avatar
    Join Date
    Jun 2005
    Location
    Mars
    Posts
    1,524
    Thank Post
    106
    Thanked 88 Times in 74 Posts
    Blog Entries
    46
    Rep Power
    40
    Quote Originally Posted by reporter View Post
    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"

SHARE:
+ Post New Thread

Similar Threads

  1. [SIMS] Command reporter paramters [Solved]
    By browolf in forum MIS Systems
    Replies: 5
    Last Post: 19th August 2011, 11:02 AM
  2. [SIMS] SIMs and Command Reporter
    By RuAware in forum MIS Systems
    Replies: 43
    Last Post: 25th February 2011, 06:57 PM
  3. command reporter permissions
    By browolf in forum MIS Systems
    Replies: 5
    Last Post: 21st May 2010, 03:56 PM
  4. Looking for a command Reporter based Apllication
    By actionsms in forum MIS Systems
    Replies: 1
    Last Post: 3rd December 2009, 06:06 PM
  5. urgent: Sims.net command line reporter (CLR)
    By russdev in forum MIS Systems
    Replies: 2
    Last Post: 20th September 2007, 02:00 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •