Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 13-Dec-2007 10:13
User is offline View Users Profile Print this message


cv p

Posts: 12
Joined: 13-Dec-2007

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
Report this to a Moderator Report this to a Moderator
 13-Dec-2007 10:42
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 13-Dec-2007 11:32
User is offline View Users Profile Print this message


cv p

Posts: 12
Joined: 13-Dec-2007

Dear
Report this to a Moderator Report this to a Moderator
 13-Dec-2007 11:32
User is offline View Users Profile Print this message


cv p

Posts: 12
Joined: 13-Dec-2007

Dear
Report this to a Moderator Report this to a Moderator
 13-Dec-2007 11:35
User is offline View Users Profile Print this message


cv p

Posts: 12
Joined: 13-Dec-2007

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
Report this to a Moderator Report this to a Moderator
 13-Dec-2007 11:51
User is offline View Users Profile Print this message


cv p

Posts: 12
Joined: 13-Dec-2007

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.