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: DXL Calendar
Topic Summary:
Created On: 11-Nov-2002 15:08
Status: Post and Reply
Linear : Threading : Single : Branch
1 2 Next Last unread
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.
Answer This question was answered by Paul Worrall, on Friday, March 11, 2005 4:49 PM

Answer:
Antonio's version above goes back to being a day out (it says today is Friday 10th, should be Thursday)
 11-Nov-2002 15:08
User is offline View Users Profile Print this message


Hazel Woodcock

Posts: 38
Joined: 4-Oct-2002

Has anyone written a script to bring up a calendar from which a date can be selected for insertion into an attribute?
I am looking for something that will start with the current month and allow me to select future months if I need to. The background to this is a simple To Do list with a due date.

Hazel

-------------------------
Hazel Woodcock
Report this to a Moderator Report this to a Moderator
 7-Jun-2004 10:18
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Hazel,

I have programmed an DBE, which You can use for Your Dialog.
The test_calendar.dxl file shows, how it can be used ...

Greetings
Reik Schröder
Siemens AG Berlin

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 8-Jun-2004 06:55
User is offline View Users Profile Print this message


Dirk Plaschke

Posts: 103
Joined: 17-Sep-2002

Hi, Reik.

Very nice script ;-)

But we should initialise the skip list 'vars' (line 220 of calendars.inc) and comment out the first include (dates.inc) before running (for DOORS 5.2/7.1), otherwise there will be the error 'ambiguous identifier (null)' in line 221.

dirk plaschke.
(Siemens AG, Bln-E)

-------------------------
Dirk Plaschke
Report this to a Moderator Report this to a Moderator
 8-Jun-2004 08:53
User is offline View Users Profile Print this message


Pieter DE WAARD

Posts: 73
Joined: 11-Jul-2003

Can you post the correction? Much appreciated, as I would like to see what this script does.

Thanks

-------------------------
Pieter de Waard
www.nhindustries.com
Report this to a Moderator Report this to a Moderator
 8-Jun-2004 10:38
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Sorry for error messages - was copy and paste problem ;-))

Here are the right code versions ....

Reik Schröder
Siemens AG Berlin (Bln-S50)

calendar.inc
calendar.inc  (8 KB)
test_calendar.dxl
test_calendar.dxl  (0 KB)
calendar.inc
calendar.inc  (8 KB)
test_calendar.dxl
test_calendar.dxl  (0 KB)



-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany

Edited: 6-Sep-2006 at 09:11 by Reik Schroeder
Report this to a Moderator Report this to a Moderator
 2-Mar-2005 13:42
User is offline View Users Profile Print this message


Asaf Kivity

Posts: 54
Joined: 25-Mar-2003

I had a problem with the calendar. some of the dates are insensitive, and therfore cannot be chosen. usually those in the end of the month. did anyone succeeded in fixing that?

Thanks,
Asaf Kivity
ManageWare
Report this to a Moderator Report this to a Moderator
 2-Mar-2005 16:03
User is offline View Users Profile Print this message


Antonio Norkus

Posts: 109
Joined: 28-Jun-2003

Some fixes in the following version of calender.inc

- Changed abbreviation of Wednesday to "Wed"
- Added extra row of days, since days were being missed out for months starting on Saturday or Sunday
- Fixed bug where call to calendarGetDaysInMonth was passing in an incorrect month value
Report this to a Moderator Report this to a Moderator
 2-Mar-2005 16:53
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

I fixed some bugs in this a while ago. I haven't looked to see if we fixed the same ones!


-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 10:02
User is offline View Users Profile Print this message


Antonio Norkus

Posts: 109
Joined: 28-Jun-2003

Tony,

your version is based on a version taken before Reik did some bug-fixing.

Cheers,
Antonio.

Edited: 3-Mar-2005 at 10:03 by Antonio Norkus
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 14:30
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

What a clever script! One small problem though: It tells me that today is Friday 3rd March (should be Thursday).
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 16:35
User is offline View Users Profile Print this message


Karen Hidalgo

Posts: 55
Joined: 4-Nov-2003

I agree -- clever script! I was able to fix the day problem by modifying the constant:

Original:
const string calendar_days__[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}

Fix:
const string calendar_days__[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}

I also modified the code so that the Sunday column would also be in red:

Original Lines (appears in 2 places in the code):
if (x>5) realColor (canv, realColor_Red)
else realColor (canv, realColor_Black)

New Lines:
if ((x>5) || (x==0)) {
realColor (canv, realColor_Red)
} else {
realColor (canv, realColor_Black)
}



-------------------------
Karen Hidalgo<BR>Northrop Grumman - TASC<BR>karen.hidalgo@ngc.com

Edited: 3-Mar-2005 at 16:52 by Karen Hidalgo
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 17:32
User is offline View Users Profile Print this message


Antonio Norkus

Posts: 109
Joined: 28-Jun-2003

I don't see a problem with the start day...out of curiousity Paul and Karen, are you in the US? It may be that the depending on the locality of the OS, "today" returns different values.
What value do you get printed from the following DXL?

print dateOf(1) ""

I get "01/01/70 01:00:01" which looks as though it's an hour out...surely it should be "01/01/70 00:00:01"!
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 18:49
User is offline View Users Profile Print this message


Karen Hidalgo

Posts: 55
Joined: 4-Nov-2003

Yes, I am in the US. The value I get when I print

print dateOf(1)""

is

12/31/69 19:00:01

-------------------------
Karen Hidalgo<BR>Northrop Grumman - TASC<BR>karen.hidalgo@ngc.com
Report this to a Moderator Report this to a Moderator
 3-Mar-2005 19:10
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Karen,

I just ran into this myself. I was attempting to write a function to return a date/time that repesents the midnight that begins the current day.

The following should have worked:

int todayInt = intOf( today )
Date midnightBeforeNow = dateOf( todayInt - ( todayInt % ( 60*60*24 ) ) )
print midnightBeforeNow "\n"

It returns a result of five hours behind, which is how many hours I am behind Greenwich Mean Time (GMT).

I compensated for that, as below, but that only gives the correct answer if run it from a compter set for Eastern Time (EST).

int todayInt = intOf( today )
Date midnightBeforeNow = dateOf( todayInt - ( todayInt % ( 60*60*24 ) ) + 60*60*5 )
print midnightBeforeNow "\n"

I believe the dateOf() function is compensating for GMT, perhaps when it should not.

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 4-Mar-2005 11:47
User is offline View Users Profile Print this message


Antonio Norkus

Posts: 109
Joined: 28-Jun-2003

OK...here's a version that adjusts for GMT.

Karen...this version colours Saturday and Sunday red.

Michael...you may want to use the function in there that gets the current GMT adjustment, rather than hard coding it.



Edited: 4-Mar-2005 at 11:58 by Antonio Norkus
Report this to a Moderator Report this to a Moderator
 7-Mar-2005 06:00
User is offline View Users Profile Print this message


Chun Ho

Posts: 6
Joined: 21-May-2004

Hi,

My group had ran into the same problem some time back and used the following simple fix to the dayOfWeek function. Note the +4 in the function instead of +3.


Edited: 7-Mar-2005 at 06:01 by Chun Ho
Report this to a Moderator Report this to a Moderator
 7-Mar-2005 12:02
User is offline View Users Profile Print this message


Antonio Norkus

Posts: 109
Joined: 28-Jun-2003

OK...If someone new to the forum were to want the calendar functionality...what the hell would they download from this thread? There are multiple copies of calendar.inc and numerous bug fix extracts.

Here is a version of calendar.inc, with the bugs mentioned in this thread fixed and described. If you find a bug in this version and have a fix, please update this version and add a comment as to what has been fixed, so that the DXL community can benefit from the bug-fix and also know which version they have got.


Edited: 7-Mar-2005 at 12:03 by Antonio Norkus
Report this to a Moderator Report this to a Moderator
 10-Mar-2005 09:46
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Answer Answer
Antonio's version above goes back to being a day out (it says today is Friday 10th, should be Thursday)
Report this to a Moderator Report this to a Moderator
 14-Mar-2005 21:31
User is offline View Users Profile Print this message


Jeremy Eble

Posts: 30
Joined: 20-Sep-2002

I fixed the reintroduced problem of the day offset, and noticed that May 2005 and later was incorrect (I'm in the US). I scrapped the whole notion of the GMT adjustment and used some VB code as a basis for restructuring the dayOfWeek function so that it works based upon the normal differences between the first days of the month, including allowing for leap year. Since this is not reliant on the dateOf(1) function, hopefully this will be correct for the entire world.


-------------------------
Jeremy Eble
Software Engineer
Teragon Consulting LLC
jeremy.r.eble@lmco.com
Report this to a Moderator Report this to a Moderator
 21-Mar-2005 15:39
User is offline View Users Profile Print this message


Thanh Lam

Posts: 17
Joined: 3-Feb-2005

Jeremy, Can you please explain what this line does in the dayOfWeek routine? const int MONTHDAYS[] = {5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3} //separation of first days by month Sorry, I'm new to the DXL development and tried to understand you code. Thanks!
Report this to a Moderator Report this to a Moderator
Telelogic DOORS » DXL Exchange » DXL Calendar

1 2 Next Last unread
Topic Tools Topic Tools
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.