Page 1 of 1

Transformer Logic Error

Posted: Wed Jun 15, 2005 1:17 pm
by Raftsman
I asked a question about setting defaults when joining two tables (HASH and DB2) and some codes aren't found.

I coded the transform as this and keep getting an error.

Two questions:

Can I set two variables in the Then and else statements
Can I remove the else and end and the code will pass through to the function call with the new values. Thanks

If IsNull(DSLink15.Wloc_Cd)
Then DSLink15.Sav_Strt_tm = '02:00:00.000000'
DSLink15.Sav_End_tm = '02:00:00.000000'
Else
DSLink15.Sav_Strt_tm
DSLink15.Sav_End_tm
End
ConvertToTimeZone(DSLink2.PSG_ACTVT_SDTTM,DSLink15.Sav_Strt_tm,DSLink15.Sav_End_tm,"PST")

Posted: Wed Jun 15, 2005 1:24 pm
by chucksmith
Create two stage variables, each with an IF THEN ELSE. Drop the END.

Put the ConvertToTimezone() call in your derivation.

Posted: Wed Jun 15, 2005 3:49 pm
by ds_developer
This isn't a direct answer to your question, but an observation on the IF THEN ELSE you posted:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
   DSLink15.Sav_Strt_tm = '02:00:00.000000' 
   DSLink15.Sav_End_tm = '02:00:00.000000'
Else 
   DSLink15.Sav_Strt_tm 
   DSLink15.Sav_End_tm 
End 
ConvertToTimeZone(DSLink2.PSG_ACTVT_SDTTM,DSLink15.Sav_Strt_tm,DSLink15.Sav_End_tm,"PST")
In the THEN clause do not try to set the value of the source field, just supply the value you want.

As Chuck suggested, use 2 stage variables:
SaveStartTime
SaveEndTime

The derivation of SaveStartTime would be:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
  '02:00:00.000000' 
Else 
  DSLink15.Sav_Strt_tm 
End 
The derivation of SaveEndTime would be:

Code: Select all

If IsNull(DSLink15.Wloc_Cd) Then
  '02:00:00.000000' 
Else 
  DSLink15.Sav_End_tm 
End
Then the derivation of the target field would call ConvertToTimeZone (using the stage variables).

Hope this helps,
John

Posted: Thu Jun 16, 2005 9:14 am
by Raftsman
Thanks for the input. I made the changes and all is correct.