+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
MIS Systems Thread, CLR /Params String in Technical; i Know a few people have been looking at CommandLineReporter for a while and ive had a lot of success ...
  1. #1
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17

    CLR /Params String

    i Know a few people have been looking at CommandLineReporter for a while and ive had a lot of success automating my reports using the /pramdef and /paramfile switches in my coding.

    if im understanding this correctley though i should be able to use /params:"ABCD" (from the help file in cmd) to supply the code directly in my script rather than having to refer to another file.

    "ABCD" is a string containing xml which defines the parameters for the report.
    See the thrid party access to the sims.net SDK for details on the format of this Xml string.
    Does anyone know this format? Do i need to buy into the SDK to use a string as opposed to using a paramfile?

    The functionality of using commandlinereporter is the same, just a little easier if i can use a string instead of having to prep a file before running the rest of my code.

  2. #2
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    I've managed to generate a couple of error messages whilst trying various strings of data.

    Code:
    /params:"<start>2011-11-29T13:39:04</start><End>2011-12-01T13:39:04</End>"
    Gives me
    there are multiple root elements. Line1,Position36.
    <commandreportererror>error processing report parameters</commanreportererror>
    If i use the whole of the parameters text from the pramadef file i've generate
    Code:
    </xs:schema><Parameter id="2+72SH9eK7pakgv9wRq/6w==" subreportfilter="True"><Name>Date</Name><Type>DateRange</Type><PromptText>Date is between</PromptText><Values><DateRange><Start>2011-11-01T13:39:04</Start><End>2011-12-01T13:39:04</End></DateRange></Values></Parameter></ReportParameters>
    i get
    unexpected end tag. line1, position 3.

  3. #3

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    You need to bare in mind that passing a string at command line means you'll need to be careful where you put quotes as the command line will assume that any quotes define the start and end of a string unless you 'escape' them properly. An easier method is to use a single apostrophe (') rather than double quotes (") anywhere you see them in the original PARAMDEF; these still conform to XML and so will still work, i.e.

    Code:
    <Parameter id="2+72SH9eK7pakgv9wRq/6w==" subreportfilter="True">
    
    would become
    
    <Parameter id='2+72SH9eK7pakgv9wRq/6w==' subreportfilter='True'>
    Also, you still need to include all of the XML tags; I notice in your first example you aren't including the <ReportParameters> and </ReportParameters> opening and closing tags for example

    Also, the schema is not essential so you can drop it if you like.

    EDIT: just to give a working example from your own code sample, try this:

    Code:
    Your sample:
    </xs:schema><Parameter id="2+72SH9eK7pakgv9wRq/6w==" subreportfilter="True"><Name>Date</Name><Type>DateRange</Type><PromptText>Date is between</PromptText><Values><DateRange><Start>2011-11-01T13:39:04</Start><End>2011-12-01T13:39:04</End></DateRange></Values></Parameter></ReportParameters>
    
    Should read:
    <ReportParameters><Parameter id='2+72SH9eK7pakgv9wRq/6w==' subreportfilter='True'><Name>Date</Name><Type>DateRange</Type><PromptText>Date is between</PromptText><Values><DateRange><Start>2011-11-01T13:39:04</Start><End>2011-12-01T13:39:04</End></DateRange></Values></Parameter></ReportParameters>
    The error you were getting (unexpected closing tag error) was because you were including </xs:schema>, which is the closing tag for the XML schema which you haven't included so CLR correctly reports an unexpected closing tag
    Last edited by LosOjos; 2nd December 2011 at 11:53 AM.

  4. #4
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    Code:
    /params:"<Values><DateRange><Start>2011-12-01T00:00:00</Start><End>2011-12-02T00:00:00</End></DateRange></Values>"
    This runs, give no errors but seems to ignore the report filter. I checked this by amending the dates in the code and the report output is always the same.

  5. #5

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    Quote Originally Posted by pubgrub277 View Post
    Code:
    /params:"<Values><DateRange><Start>2011-12-01T00:00:00</Start><End>2011-12-02T00:00:00</End></DateRange></Values>"
    This runs, give no errors but seems to ignore the report filter. I checked this by amending the dates in the code and the report output is always the same.
    It's because you're missing essential tags; it's technically correct as the XML validates, but SIMS won't read it as it's missing tags. Change it to this:

    Code:
    /params:"<ReportParameters><Parameter id='you'll need to get this from your paramdef' subreportfilter='again, look at your paramdef'><Values><DateRange><Start>2011-12-01T00:00:00</Start><End>2011-12-02T00:00:00</End></DateRange></Values></Parameter></ReportParameters>"

  6. Thanks to LosOjos from:

    pubgrub277 (2nd December 2011)

  7. #6
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    Thanks LosOjos.
    The first one was a misscopy&paste. with the schema tag.

    Your correct about the quotes and im now getting different files now when using you suggested code.
    Code:
    <ReportParameters><Parameter id='2+72SH9eK7pakgv9wRq/6w==' subreportfilter='True'><Name>Date</Name><Type>DateRange</Type><PromptText>Date is between</PromptText><Values><DateRange><Start>2011-11-01T13:39:04</Start><End>2011-12-01T13:39:04</End></DateRange></Values></Parameter></ReportParameters>
    at least now i can skip having to prepare a /paramafile when automating the report and pass the values direct to the script.

    Thanks for you help. Much appreciated.

  8. #7

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    You may be on to a non starter here anyway to be honest. Try my suggestion and let me know if it works please

    The reason I say this is that when you change the date range in SIMS, the parameter ID changes in the paramdef. I've not had this confirmed by Capita (waiting more information from @David_Grashoff as we speak) but I suspect that the ID has to be changed programatically for date filters to work as any I have tried have simply returned the pre-set dates from the original report in SIMS
    Last edited by LosOjos; 2nd December 2011 at 12:06 PM.

  9. #8
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    sorry i was busy posting/working both times when you replied. i have seen you excellent correction and understand what i need. Many thanks
    again

  10. #9
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    Quote Originally Posted by LosOjos View Post
    You may be on to a non starter here anyway to be honest. Try my suggestion and let me know if it works please

    The reason I say this is that when you change the date range in SIMS, the parameter ID changes in the paramdef. I've not had this confirmed by Capita (waiting more information from @david_Grasshoff as we speak) but I suspect that the ID has to be changed programatically for date filters to work as any I have tried have simply returned the pre-set dates from the original report in SIMS

    No it works perfectly. changing the date manually in a .bat file at the moment but am scripting something else to amend how that runs.
    I don't plan on amending the report in sims only using the scripts to export the data.

  11. #10

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    Quote Originally Posted by pubgrub277 View Post
    No it works perfectly. changing the date manually in a .bat file at the moment but am scripting something else to amend how that runs.
    I don't plan on amending the report in sims only using the scripts to export the data.
    Mind if I ask which field it is you're filtering in SIMS? I've tried this with attendance dates and it only ever runs the dates I originally set in SIMS...

  12. #11
    pubgrub277's Avatar
    Join Date
    Jul 2010
    Location
    Newcastle
    Posts
    88
    Thank Post
    4
    Thanked 17 Times in 10 Posts
    Rep Power
    17
    Quote Originally Posted by LosOjos View Post
    Mind if I ask which field it is you're filtering in SIMS? I've tried this with attendance dates and it only ever runs the dates I originally set in SIMS...
    I'm running a report on Behaviour records. The filter is for records between dates, hence start and end date.
    Is your report in another thread on here? i seem to remember reading it earlier for weekly attendance?
    can't see why it wouldn't work in the same vein as this.

  13. #12

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    It's on here somewhere (struggling to find the thread at the moment) and you're right, it should theoretically work as it's just a date range the same as your behaviour one. I'm increasingly suspecting there are a few compatibility issues between CLR and SIMS but proving it is nigh on impossible... I sent my files over to @David_Grashoff a couple of weeks back to take a look so hopefully I'll hear something back soon...

  14. #13

    vikpaw's Avatar
    Join Date
    Sep 2006
    Location
    Saudi Arabia
    Posts
    6,009
    Thank Post
    680
    Thanked 1,398 Times in 1,158 Posts
    Rep Power
    353
    I'm sure we discovered an issue on here with certain types of date field, especially, using Date Between, in certain areas of SIMS. Yet in other areas it purports to work. I could have sworn you were involved in that thread @LosOjos

  15. #14

    vikpaw's Avatar
    Join Date
    Sep 2006
    Location
    Saudi Arabia
    Posts
    6,009
    Thank Post
    680
    Thanked 1,398 Times in 1,158 Posts
    Rep Power
    353

  16. #15

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,494
    Thank Post
    1,452
    Thanked 1,197 Times in 812 Posts
    Rep Power
    711
    Right, an update for you all:

    emails have been going back and forth between myself and a very helpful member of the SIMS Partner Support team for the past week or so and finally I have it working - although I'm afraid the solution doesn't really answer what the problem is in the first place!

    I have found that no matter what I do, passing date parameters on the command line with the CLR "/params" argument does not work. It fails for me every single time. However, if instead of outputting the parameters to the command line, I output the exact same parameters to an XML document and pass that file's name as an argument with the CLR "/paramfile" option, it works.

    Whether this is a CLR bug or some oddity introduced by passing such a long string at the command line I do not know (but have offered to do some more testing on the matter if it will help).

    In the meantime though, I recommend that anybody using CLR uses XML files and "/paramfile" as using the "/params" option seems unstable.

  17. Thanks to LosOjos from:

    vikpaw (12th December 2011)

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. [Video] 42 stringed guitar.
    By mattx in forum Jokes/Interweb Things
    Replies: 0
    Last Post: 21st August 2009, 02:10 PM
  2. Mysql - pre-pend to string
    By danIT in forum Coding
    Replies: 3
    Last Post: 9th January 2009, 06:17 PM
  3. urgent: Sims.net command line reporter (CLR)
    By russdev in forum MIS Systems
    Replies: 2
    Last Post: 20th September 2007, 02:00 PM
  4. need to extract text from a string in excel
    By projector1 in forum How do you do....it?
    Replies: 7
    Last Post: 14th February 2007, 01:41 PM

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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