title: I am getting an error value not found in databricks
body: <p>I am new to DataBricks. I have following code in scala the adds a new column to existing dataframe it checks for a specific column value and if it is <code>null</code> assigns <code>0</code> otherwise <code>1</code>.</p>
  
  <pre><code>val sv_string = "select * from temp_tbl_ASBReports r left join temp_tbl_ASBInvestigations i on r.nh_parentasbcase = i.nh_asbcaseid"
  
  val df_asbreportssv = spark.sql(sv_string)
  
  df_asbreportssv.withColumn("InInvestigation",when((df_asbreportssv("nh_parentasbcase").isNull), "0").otherwise("1"))
  </code></pre>
  
  <p>It throws the following error:</p>
  
  <pre><code>error: not found: value when
      df_asbreportssv.withColumn("InInvestigation",when((df_asbreportssv("nh_parentasbcase").isNull), "1").otherwise("0"))
  </code></pre>
  
  <p>Could you please help?</p>