We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

Schedule csv notes extraction


I would like to schedule the csv notes extraction. Can you please tell me how to do that ?

Thanks a lot !



  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Romain,
    The following vbs-script should do the trick. You can schedule it on a (windows) machine by ceating a scheduled job with two parameters: username and password.
    The main part is of course the URL, for example
    [your domain]//[your oc]/DiscrepancyNoteOutputServlet?fmt=csv&studyIdentifier=[your study]&discNoteType=-1&fileName=dnotes0_defaultstudy
    You can look at the source of the normal dialog window to see which parameters can be set. In general -1 is used for "all".
    Kind regards,
    Gerben Rienk
    Option explicit
    Dim objHTTP
    Dim strURLStart
    Dim strURL
    Dim strReq

    'the next 3 variables are for writing the output to disk
    Dim outFile
    Dim objFSO
    Dim objFile

    Set objFSO=CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile(outFile,True)

    If WScript.Arguments.Count <> 2 then
    WScript.Echo "Missing parameters. This script needs: "_
    & VbNewLine & "username and password "_
    & VbNewLine & "to run correctly."
    Set objHTTP = CreateObject("MSXML2.XMLHTTP")
    'change this to match your situation
    strURLStart = "http://www.tds-edc.com/oc311/"
    strURL = strURLStart & "j_spring_security_check?j_username=" & WScript.Arguments(0)
    strURL = strURL & "&j_password=" & WScript.Arguments(1)
    objHTTP.Open "POST", strURL, False

    'modify the next line for another study or dn_type or status, etc.
    strURL = strURLStart & "DiscrepancyNoteOutputServlet?fmt=csv&studyIdentifier=defaultstudy&discNoteType=-1&fileName=dnotes0_defaultstudy"

    'send the request
    objHTTP.Open "GET", strURL, False
    'and write the result to disk
    objFile.Write objHTTP.responseText

    End if

  • RCHENURCHENU Posts: 207 ✭✭
    Thanks a lot Gerben.
    I used MSXML2.ServerXMLHTTP instead of MSXML2XMLHTTP (because of my https connection maybe...) and it works.

    Thanks again for your fast reply.

  • RCHENURCHENU Posts: 207 ✭✭

    @GerbenRienk : I have a strange behaviour today, I'm using this script to extract automatically notes and it was working very well for my two instances (production database and test database).
    Today it doesn't work anymore only for the test database and I have the error:

    Sorry, but the page you are looking for has not been found. Please use the menu options in the navigation bar above to navigate to where you want to go. If you continue to get this error, please click the 'Report Issue' in the navigation bar above and let us know how you are getting to this page

    Do you have any idea why it doesn't work anymore suddenly and only for one instance ???

    I'm stuck !
  • RCHENURCHENU Posts: 207 ✭✭
    Matter of fact, the problem is not the script.
    I can't even download the notes manually when I click the arrow "Download discrepancy notes for all subjects" then "Download notes", I have the 404 error. Still for one instance. Do you know which parameters were altered ???


  • RCHENURCHENU Posts: 207 ✭✭
    I reboot tomcat and I have this error (see attached) instead of 404 error, on both instance now !!!
    Any help is welcome since the production database is impacted now
  • RCHENURCHENU Posts: 207 ✭✭
    I attached the most up-to-date log.
    If you have any idea...

    Many thanks,

    log.txt 18.2K
  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Romain,
    Can you login in the normal way? If not, can you then stop tomcat, (re-)move all logs, start tomcat again, try to produce the error and then zip all logs and post them?
    Many thanks,
    Gerben Rienk
  • haenselhaensel Posts: 602 ✭✭✭
    Hi Romain

    Since it has worked already it is very unlikely but I want to be sure that it isn't that trivial.

    The error indicates that there was no ResoureBundle found for your environment (in this case it is the terms.properties). Did you made any changes to your settings regarding the language to use? Do you use different browsers for testing? Can you set your browser language to English just to check if the error vanishes?

    Caused by: java.lang.NullPointerException
    	at org.akaza.openclinica.i18n.util.ResourceBundleProvider.getResBundle(ResourceBundleProvider.java:130)
    	at org.akaza.openclinica.i18n.util.ResourceBundleProvider.getTermsBundle(ResourceBundleProvider.java:85)
    	at org.akaza.openclinica.bean.core.Term.getName(Term.java:101)
    	at sun.reflect.GeneratedMethodAccessor212.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
    	... 31 more
  • RCHENURCHENU Posts: 207 ✭✭
    Thanks both of you for your answers. I had to make it works on Friday. I tried a lot of things but I eventually desinstalled/reinstalled java, dropped the webapps and work directories and reinstall everything step by step. I'm not sure to understand what was going wrong but it seems to work now. I keep you posted if it goes wrong again...
    Thank you,
  • haenselhaensel Posts: 602 ✭✭✭
    Good luck.
Sign In or Register to comment.