Subject Re: [IBO] More TIB_DataPump questions
Author Helen Borrie
At 11:37 AM 16/08/2006, you wrote:
>I've been able to get this to work fine as long as I'm doing a
>straight copy from one TIB_Query to another.
>Now, I'm trying to set one of the fields to a constant value if it's
>zero. I'm using code like this:
> IB_DataPump1.DstRow.ByName('SESSION_ID').AsInteger := 123;
>I've tried doing this in AfterFetchRow, BeforeExecuteItems and
>AfterExecuteItems, but none of these places worked.
>1) If the source (not the destination, but the source) doesn't have
>this field, then the destination doesn't either, even though it's in
>the SQL so I get an exception.
>2) If I provide it in the source, then the value it has in the
>source is what I always get.
>I tried AfterFetchRow because of something I read in the help file
>that implied that this was where one could override mappings. I
>even tried changing the row data passed into the event, but I got
>a "read only dataset" exception.
>The other two where shots in the dark. According to the debugger
>the value gets changed, but when the row is viewed in the database,
>the original value from the source is in the field, not what I
>What am I overlooking?

You're trying too hard. Let the database engine do the walking. :-)

Simply make it an output field in your source query.

'12345' as mysessionid
from blah

In this example, the constant comes through as a varchar(5). Adapt
your statement to make sure your constant's type is compatible with
the destination column it's mapped to and you're done.