![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Auto send emails when date attribute value in a module is due Topic Summary: Created On: 13-Dec-2007 10:13 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have a little question on DXL.
I'm trying to auto generate emails from DOORS when contract date of a document is about to expire in 7 days to notify the stakeholders. I plan to setup a batch process everyday with a DXL to look throughout the DOORS database, look for an attribute called 'Module Expiry Date' in all the modules that have it, and send a mail whenever this date is within 7 days of the current date. I have managed to write the below script (Am yet to include the code for sending emails in it). Using this, I can send emails when the current date & contract expiry date are in the same month of same year. The problem occurs when the current date is somewhere in the last week of a month and Module Expiry Date is somewhere in the first week of the next month. I know my date format should be changed to something else. Currently it is dd,month,yyyy. Maybe, it should be dd-mm-yy? to handle this better. My code is attached. Any light on this matter would be great! Regards cvp |
|
![]() |
|
![]() |
|
Don't use string manipulation to handle dates.
This will break if the user changes their locale. I would use integers to do this - a date can be represented as an integer and has a value equal to the number of seconds since Rolf Harris was at number one with "Two Little Boys". Here is an example Date expiry = "20 December 2007" int iExp = intOf expiry int i = intOf(today) int secondsInDay = 60 * 60 * 24 int SEVEN_DAYS = secondsInDay * 7 int timeToGo = iExp - i if (timeToGo <= SEVEN_DAYS) { print "Module expires in " (int timeToGo / secondsInDay + 1) " days!\n" } ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
Dear
|
|
![]() |
|
![]() |
|
Dear
|
|
![]() |
|
![]() |
|
Dear Tony
Thanks for responding ![]() I collect the Module expiry Date in each module in a string (string s=m."Expiry Date"). How do I change this to Date from String? Regards cvp |
|
![]() |
|
![]() |
|
Dear Tony
Forgive me for the stupid question. I have made a small modification to the code you gave me & my final code is below. Thanks & Regards cvp |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.