Anup Ritti
Anup Ritti

Reputation: 13

data factor alter row iif condition error: data flow expression should return boolean

I have provided below if condition in update if block. I am getting error: data flow expression should return Boolean. iif(Column_8 == 'Automática','Automatic','Manual')

I tried updating rows present in a column based on a condition.

Upvotes: 1

Views: 587

Answers (1)

Saideep Arikontham
Saideep Arikontham

Reputation: 6104

  • You have to specify only condition in the alter row update if i.e., there has to be a Boolean value for these fields. The expression that you have used returns a string value and hence the error.

  • I have taken the following data in my table:

enter image description here

  • If the data you want to update is your dataflow source, then use derived column transformation with the same iff condition.
iif(col1=='Automática','Automatic','Manual')

enter image description here

  • If this table is your sink and you want to update the column values based on the condition, then try using pre-SQL scripts/ post-SQL scripts.
  • Update if will update the entire sink row based on the source row data (after checking the condition given in alter row). It would not update from any foreign value (as you have tried). So, using the following post SQL scripts to update the values as per requirement.
Update demo set col1='Manual' where col1!= 'Automática';
Update demo set col1='Automatic' where col1='Automática';

enter image description here

  • The final data in table would be as shown below (Id with value 4 and 5 are inserted first and then post SQL script will be applied).

enter image description here

Upvotes: 1

Related Questions