title: How to use TRIM in nested if conditional expression in SSIS derived column
body: <p>I have a source table with two columns - Sndr_Ref and Check_Num</p>
  
  <p>I have a target table with one column - Txn_Code (nvarchar(50),null)</p>
  
  <p>Here is the logic I need to implement -</p>
  
  <ol>
  <li>If Sndr_Ref = [some value] and Check_Num = null, then load Txn_Code = 10</li>
  <li>If Check_Num = [some value] and Sndr_Ref = null, then load Txn_Code = 2</li>
  <li>If both Sndr_Ref and Check_Num = [some value], then load Txn_Code = 10</li>
  <li>If both Sndr_Ref and Check_Num = Null, then load Txn_Code = Null</li>
  </ol>
  
  <p>I created a derived column in my SSIS package which I mapped to Txn_Code. Here is the expression of my derived column -</p>
  
  <pre><code>Sndr_Ref == "" ? (Check_Num == "" ? (DT_WSTR,50)NULL(DT_WSTR,50) : "2") : "10"
  </code></pre>
  
  <p>The above expression is inserting 10 in all records. No nulls or 2 are being inserted. I checked the source table and there should be some records with 10, 2 and nulls in target column. I just found out that my source reference columns (Sndr_Ref and Check_Num) have widespaces. Could you please help how can I trim those widespaces in my above logic and set the value to null if they are blank?</p>