Start a conversation

Check if all fields are filled in

If you want to check whether certain fields are filled in, you can use the template below. In this template, there are 2 fields: 

Variable name Field label
dem_pat_gender Gender
dem_pat_yob Year of Birth

Replace the labels and variable names in the template with your own. 

var req_labels = ["Gender", "Year of Birth"];
var req_fields = ["{dem_pat_gender}", "{dem_pat_yob}"];
var incomplete = false;
var missingVars = "";
if(incomplete === true){
    "Fields are missing: " + missingVars;
function checkCompleteness(value, index, array) {
  if(value ==  "'NA'" ){ 
      incomplete = true;
      missingVars  += req_labels[index];
      missingVars  += ", ";

If not all fields are filled in, the calculation will show "Fields are missing: ", followed by the field labels of the fields that are empty. If all fields are filled in, the calculation will have the value "Yes". You can choose to add a data validation message if the calculation field value is not equal to "Yes".

Choose files or drag and drop files
Was this article helpful?
  1. Castor Support Team

  2. Posted
  3. Updated