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


I do Serious Adverse Event reporting via OpenClinica. I want to assign unique numbers to the SAE, in the form op SAE-(subjectID)-(SAEnr). I want to display these numbers in the CRF and save them in the database.

I've tried adding SAE-${studySubject}-${eventOrdinal} to the DEFAULT_VALUE and in the RESPONSE_VALUES_OR_CALCULATIONS column, but that doesn't render the information. I understand that tokens aren't parsed if they are in these columns, correct?

What would be the easiest way to do this? Do I need Javascript?


  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    edited July 2016
    Your finding is correct: you can not use tokens in default_value or calculations and yes, you can use javascript to generate an SAE-ID.
    I've attached the xls to download, but the script is this:
    <div id="B"></div>
    <script src="includes/jmesa/jquery.min.js"></script>
    <script> $.noConflict();
    jQuery(document).ready(function($) {
    var fieldAEID = $("#B").parent().parent().find("input");
    //set the item read-ony
    //start with taking the event ordinal/number and adding 2 zero's
    var uniqueAEID = "00" + "${eventOrdinal}";
    //now take only the last 3 characters
    uniqueAEID = uniqueAEID.slice(-3);
    //and put the studysubjectID in front
    uniqueAEID = "SAE-" + "${studySubject}" + "-" + uniqueAEID;
    //define the function that sets the ID
    function setAEID(){
    //only do something if the ID is not correct already
    if (fieldAEID.val() != uniqueAEID){
    //set the value
    //set the status of the item to changed, otherwise it will not be saved
    //when the document is ready, run the function once
    }) </script>
    Hope this helps,
    Gerben Rienk
  • koenvnkoenvn Posts: 9
    It works like a charm. Thank you so much!
Sign In or Register to comment.