I am inside script task of SSIS. Need to do following transformations:
switch(LeadTime)
{
case: 1
WM1 = DAY1
WM2 = DAY2
WM3 = DAY3
WM4 = DAY4
WM5 = DAY5
WM6 = DAY6
WM7 = DAY7
case: 2
WM1 = DAY1 + DAY2
WM2 = DAY2 + DAY3
WM3 = DAY3 + DAY4
WM4 = DAY4 + DAY5
WM5 = DAY5 + DAY6
WM6 = DAY6 + DAY7
WM7 = DAY7 + DAY1
case: 3
WM1 = DAY1 + DAY2 + DAY3
WM2 = DAY2 + DAY3 + DAY4
WM3 = DAY3 + DAY4 + DAY5
WM4 = DAY4 + DAY5 + DAY6
WM5 = DAY5 + DAY6 + DAY7
WM6 = DAY6 + DAY7 + DAY1
WM7 = DAY7 + DAY1 + DAY2
..................
case: 7
WM1 = DAY1 + DAY2 + DAY3 + DAY4 + DAY5 + DAY6 + DAY7
WM2 = DAY2 + DAY3 + DAY4 + DAY5 + DAY6 + DAY7 + DAY1
WM3 = DAY3 + DAY4 + DAY5 + DAY6 + DAY7 + DAY1 + DAY2
WM4 = DAY4 + DAY5 + DAY6 + DAY7 + DAY1 + DAY2 + DAY3
WM5 = DAY5 + DAY6 + DAY7 + DAY1 + DAY2 + DAY3 + DAY4
WM6 = DAY6 + DAY7 + DAY1 + DAY2 + DAY3 + DAY4 + DAY5
WM7 = DAY7 + DAY1 + DAY2 + DAY3 + DAY4 + DAY5 + DAY6
}
Is it possible to build a good loop around all this and getting the same result? Need help with the logic of this
This is what I could come up with
case: 7
for(int i=0;i<LeadTime;i++)
{
WM1 += Array[i];
WM2 += Array[i];
...
WM7 += Array[i];
}