[JavaScript] On Render

This recipe demonstrates the usage of JavaScript in the different places of the report template.

The JavaScript can be used in the following places:

  1. Render If
  2. On Render Begin. For example,value1= “”;
    if (Data.getString(“Forum”) == “H”){
    value1=“High Court”;
    }
    else if (Data.getString(“Forum”) == “S”){
    value1=“Subordinate Court”
    }
    else if (Data.getString(“Forum”) == “F”){
    value1=“Foreign Court”;
    }
    else value1 =“Default Value”;
    setText(value1 + “_0”);
  3. On Render End. For example,if (result.getLogicalElementCount()>0)
    {
    field = result.getLogicalElement(0);
    if (Data.getString(“Forum”) == “H”){
    val=“High Court”;
    }
    else if (Data.getString(“Forum”) == “S”){
    val=“Subordinate Court”
    }
    else if (Data.getString(“Forum”) == “F”){
    val=“Foreign Court”;
    }
    else val =“Default Value”;
    field.setText(val + “_0”);
    }
  4. The “Script” Field Type of the Field component. For example,switch(Forum){
    case “H”:value=“High Court”;break;
    case “S”:value=“Subordinate Court”;break;
    case “F”:value=“Foreign Court”;break;
    default:
    value="";break;
    }
    value = value + “_0”;

To download the necessary files for this recipe, refer to the attached ZIP file.
OnRender.zip (4.5 KB)