Friday, March 23, 2012

Merge 2 columns from the same table

Hi *,

I have a table with 2 columns A1 and Firm. A1 holds "dirty data" and there are no NULL values. Firm holds "clean data" for some of the rows in A1 but not for all. So there are quite a few NULL values in this column. I want to replace the value in A1 if there is any data in Firm (value <> NULL).

Rigth now, I solve this issue with a simple VB.NET script:

Public Class ScriptMain
Inherits UserComponent

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
If Row.Firm_IsNull Then
Row.Standard = Row.A1
Else
Row.Standard = Row.Firm

End If
'
End Sub

End Class

Any ideas how to solve this issue without custome code?

Thanks!

It sounds to me like you can use Derived Column transformation:

Repalce A1:

With an expression like

ISNULL(Firm) ? A1 : Firm

Rafael Salas

No comments:

Post a Comment