I have a complicated derived column. In a Crystal report it is this:
if isnull( {YSA.YSAbA}) then
(
stringVar accountPart1 := "1";
stringVar accountPart2;
stringVar accountPart3;
stringVar accountPart4;
if left({YAAREP.A7KMCD},2) = 'aa' then
accountPart4 := '01'
else if left({YAAREP.A7KMCD},2) = 'bb' then
accountPart4 := '02'
else if left({YAAREP.A7KMCD},2) = 'cc' then
accountPart4 := '03';
select {YAAREP.A7KNCD}
case "39000": accountPart3 := "115" //this is freight
case "35000": accountPart3 := "110"
case "36000": accountPart3 := "105"
default: accountPart3 := "105";
if "SERVICE" in {YAAREP.A7KMCD}
//if MIKE RYAN
then accountPart2 := "3300";
if {YAAREP.A7KNCD} = "39000" //this is freight
then accountPart2 := "4300";
if cdbl({YAAREP.A7KNCD}) > 44000 then
accountPart2 := left({YAAREP.A7KNCD},4);
if cdbl({YAAREP.A7KNCD}) > 44000 then
accountPart3 := right({YAAREP.A7KNCD},3);
accountPart1 + "-" + accountPart2 + "-" + accountPart3 + "-" + accountPart4
)
else {@.PrintDefaultSalesGL}
How should I do this in an SSIS? Or do I need to show how do this in SQL Query?
Thanks for the help!
Ashley:
I would avoid using the Derived column for what you are trying to do. Not that it cannot be done; it is just that I have not figured out a way to make the cell where you type the logic larger. Consequently, you end up having to keep typing a horizontal string and pretty soon you lose track of which elements stay together. It is great for "short" logic but for what you are trying to do I would just do it using SQL in SSIS.
desibull
|||Or put it in a script component.
No comments:
Post a Comment