Please join your peers on either March 26 (8pm GMT) or March 28 (8am GMT) to watch as user extraordinaire and forum legend @"lindsay.stevens" demonstrates OpenClinica Insight.

See preview and register at

Insight makes it easy to ask questions of ALL of your clinical and operational data and visualize answers via interactive reports and dashboards. The idea is simple, but the results are powerful: ask your questions, choose your visualizations, then return often for updated, interactive results that link you to all of the underlying data.


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: 772 ✭✭✭
    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.