Import Expressions: If field = Yes, insert date

  • 133Views
  • Last Post 01 April 2019
  • Topic Is Solved
0
votes
Marc Kleefstra posted this 30 March 2019

Trying to import a csv file where, if column 1 = Yes, I insert todays date into a SF date field. This isn't working: ([Attended]) == "Yes" ?  (GETDATE) : ""

0
votes
Dmitriy Muzurov posted this 01 April 2019

 Hello Marc,

 

Thank you for contacting our Skyvia Team.

 

We see that there is an error message: "The data types "DT_DBTIMESTAMP" and "DT_WSTR" are incompatible for the conditional operator. The operand types cannot be implicitly cast into compatible types for the conditional operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator."

 

This error is related to the fact that due to data type limitations, it is not possible to put an empty string into a field with 'date' data type.

 

We would recommend either trying such expression:

([Attended]) == 'yes' ? GETDATE() : NULL(DT_DBDATE)

 

This expression will put NULL instead of some date to the field when a condition is not met.

 

Or changing data type of "Training_Completed__c" field to DT_WSTR and this variant:

([Attended]) == 'yes' ? (DT_WSTR,10)GETDATE() : ""

 

We are looking forward to hearing from you.

Close