Good Day Everyone..

Table doc1
ID=1
Reccurence = "Monthly"
DuePatten = "26"


Table doc2
History_ID =
Date_Due =

table doc2, column Date_Due must read the data from ID, Recurrance and Duepattern for generate date_due.

output table doc2 must be generate like per below :

History_ID Date_Due
1 26/1/2011
1 26/2/2011
1 26/3/2011
1 26/4/2011
1 26/5/2011
1 26/6/2011
1 26/7/2011
1 '
1 '
1 '
1 '
1 26/12/2011


i tried few ways but still not able to find the correct way.

Please advice.

thanks and regards

Recommended Answers

All 3 Replies

Can you describe the problem a bit better, and what is it that you want?!
But as far as I understood, you get some data from DB:
ID=1
Reccurence = "Monthly"
DuePatten = "26"

Now based on this you want to create an array of dates, am I right?
What do you want dateTime value or strings? If stirng, any special format?

Take a look at this example:

//your putputs to create dataTable:
            int ID = 1;
            string Reccurence = "Monthly";
            string DuePatten = "26";
            //if Duepattern is a string, I will change it to integer:
            int _DuePattern = int.Parse(DuePatten);

            DataTable table = new DataTable("myTable");
            table.Columns.Add("History_ID", typeof(int));
            table.Columns.Add("Date_Due", typeof(DateTime));

            DataRow row;
            if (Reccurence == "Monthly")
            {
                for (int i = 1; i <= 12; i++)
                {
                    DateTime date = new DateTime(DateTime.Now.Year, i, _DuePattern);
                    row = table.NewRow();
                    row["History_ID"] = ID;
                    row["Date_Due"] = date;
                    table.Rows.Add(row);
                }
            }

Hello Mitcha.. Good day to you.

I'm developing site for my department..
i have created recurrance and due pattern base on user requirement. Recurrance= 'Daily', 'Weekly' 'Monthly', 'yearly' ' 'Quarterly' 'half year' and so one.. some task shcheduled recurrance= "Monthly" and duepattern "28" it means..
dddmmyyy scheduled every month 28th. and same goes to others yearly,quarterly and so on.we have thousand over job base on daily,weekly,monthly.. and so on.

since my colleague created 2 tables doc1 and doc2

doc1 data table
doc2 for generate the date_due base on doc1


example
doc1
ID Recurrance duepattern
1 monthly 26
2 monthly 28
3 yearly 5


output of the doc must be like per below
History_ID Date_Due
1 26/1/2011
1 26/2/2011
1 26/3/2011
1 "
1 "
1 "
1 26/12/2011

2 28/1/2011
2 28/2/2011
2 28/3/2011
2 28/4/2011
2 28/5/2011
2 "
2 "
2 28/12/2011

3 5/1/2011
3 5/1/2012
3 5/1/2013
3 5/1/2014
3 "
3 "
and so on.

Hope its makes sence.


thanks and regards.

Can you describe the problem a bit better, and what is it that you want?!
But as far as I understood, you get some data from DB:
ID=1
Reccurence = "Monthly"
DuePatten = "26"
Now based on this you want to create an array of dates, am I right?
What do you want dateTime value or strings? If stirng, any special format?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.