programming logic O

0 votes

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];
}
Jun 11, 2022 in C# by jyoti
• 1,240 points
295 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C#

0 votes
1 answer

Object Oriented Programming Basic Concept(C#)

Use this link https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers protected internal: The type or ...READ MORE

answered Jun 17, 2022 in C# by jyoti
• 1,240 points
658 views
0 votes
0 answers

Compress existing PDF using C# programming using freeware libraries

I've been looking for ways to compress ...READ MORE

Jun 11, 2022 in C# by jyoti
• 1,240 points
558 views
0 votes
0 answers

Object Oriented Programming Basic Concept(C#)

We are aware that the default modifier ...READ MORE

Dec 12, 2022 in C# by Roshan
• 300 points
482 views
0 votes
3 answers

Trying to upload files using Selenium(C#)

You can try using Javascript Executor to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,140 points
5,716 views
+6 votes
5 answers

can't remove SSIS variables using remove method on PowerShell

you're missing the additional $environment.Alter() after your ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,300 points
2,635 views
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,110 views
+6 votes
16 answers

How do backend of these really cool games work?

Most of the games these days don't ...READ MORE

answered Jul 19, 2018 in Career Counselling by Kalgi
• 52,350 points
11,297 views
0 votes
1 answer

R programming logic

Use gsub to match the substring that we want ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,840 points
737 views
0 votes
1 answer

How to practice programming with Hadoop?

Well there are multiple ways to solve ...READ MORE

answered Mar 30, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
2,929 views
+1 vote
2 answers

How is Blockchain programming languages different than usual programming?

The programming syntax of most of the ...READ MORE

answered Mar 30, 2018 in Blockchain by Christine
• 15,790 points
1,115 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP