1

I am trying to check if an output column of my script component is NULL. I tried to use the Row.Column_IsNull, but when I try to do the following:

If Row.Column_IsNull = True Then
// do something
End If

I get an error " Property Row.Column_IsNull is WriteOnly".

1 Answer 1

2

What the problem is

The key error in the above was is WriteOnly. When you are referencing columns in Script Components as Transformation, you can specify whether they are ReadOnly, ReadWrite.

enter image description here

When acting as Source, you don't have that option. It's WriteOnly (logically) and they don't even give you the option of the above dialog. So, when you're in your Source and attempt to access write only properties like the following code demonstrates, it breaks.

Public Overrides Sub CreateNewOutputRows()
    Output0Buffer.AddRow()

    ' this is logically wrong
    If Output0Buffer.Column_IsNull Then

    End If
End Sub

The resolution is that you need to inspect whatever you are assigning into OutputBuffer0.Column prior to making the assignment (or create a separate boolean flag) to keep track of whether the current value was populated.

What the problem isn't

Keeping this here since I already ran down this rabbit hole

Since _IsNull is boolean, you can skip the explicit test and simply use

If Row.Column_IsNull Then

Originally, I had thought this was the classic C-like language issue of assignment (=) vs equality (==) but as @John Saunders was kind enough to point out, this was VB.

That said, the supplied code should work (it does for me).

Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
    Dim x As String
    If Row.Src_IsNull = True Then
        x = "" ' do nothing
    End If
End Sub
Sign up to request clarification or add additional context in comments.

4 Comments

Actually, the OP is using VB.NET, so there is no == operator.
In VB the equality operator is "=". :(
I also tried to check in that way, but still I got the same message.
@Thiago Corrected my dumbness (I blame the VB ;) )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.