Solved

record dependent on other records

Posted on 2003-11-28
4
201 Views
Last Modified: 2013-12-24
Hello Experts,

I need to write a scheduling program, where a task can be dependent on another task. Each record will have a start date, number of days, and end date(end date is a calculation of start date + number of days.), dependent on(True or false), and Dependent on Record Number(The ID of the task that the record is dependent on).

Now if phase two is dependent on phase one, The phase two date can not be less than phase one end date.

Now my issue is if the user where to go back and edit the phase one date, say extend it by 15 days, I would need for the phase two to automatically move forward so that its start date does not occure prior to the phase one end date. (This would work the same way Microsoft Project works).

Thanks,
AJ
0
Comment
Question by:aj10101
4 Comments
 

Expert Comment

by:ECohen
ID: 9839953
This probably needs to be done at the user interface level.  Since you will know what task the user is basing the second task on, you'll be able to police for this.  If  the user tries to input a dependent date in the past, you simply won't allow that to go into the database.  There are several ways I could think of to carry out the check, but the bottom line is you'll just test against the date of the original task, and then let the user continue only if the date for part two is after the date from the initial task.  You will find the datecompare() function in Coldfusion useful for doing this.  The basic syntax is DateCompare("date1", "date2" [, "datePart"]) -- but you'll need to decide what datepart to use, maybe minutes, hours or days...depending what you've got in mind.  

HTH.

0
 
LVL 17

Expert Comment

by:anandkp
ID: 9841500
i guess u can have the schedules set up in your CFSCHEDULE !

for your records of phase one & two.
u can have a trigger at teh back end [MSSQL] / u cld also use procedures for this.

so that everytime the user updates the date of the phase one- the dates of phase 2 are automatically shifted.

hth

let me know ...

K'Rgds
Anand

0
 
LVL 4

Accepted Solution

by:
procept earned 500 total points
ID: 9841731
Hi,

you can join the table with itself to accomplish this. Assuming that your table is called "myTable" and your fields are called "ID", "start_date", "days", "depOn", "depRecID", the following should work with MS SQL:

UPDATE myTable
SET start_date = DateAdd(d, t2.days, t2.start_date)
FROM myTable t1, myTable t2
WHERE t1.depOn = 1
AND t2.ID = t1.depRecID
AND DateAdd(d, t2.days, t2.start_date) > t1.start_date

HTH,

Chris



0
 

Author Comment

by:aj10101
ID: 9843353
Thanks procept,

That seems like an elegant solution. I will play with it this weekend.

Best regards,
AJ
0

Featured Post

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
503 Service Unavailable Error for a service in IIS 7.5 2 110
Asp.net Hosting Plan security, reliable, stable 1 72
JKS to store upstart data 2 85
http to https 3 43
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now