Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Retrieving a date from a user calendar table Post Reply Post New Topic
Author Message
FOSTANEK
Newbie
Newbie


Joined: 31 Aug 2011
Location: United States
Online Status: Offline
Posts: 2
Quote FOSTANEK Replybullet Topic: Retrieving a date from a user calendar table
    Posted: 31 Aug 2011 at 10:33am
Good day.
 
We created a table of working days (excludes sat., sun. and holidays)
The table looks like this:
....
MM/DD/YYYY   RowNumber
08/26/2011   5,620
08/29/2011   5,621
08/30/2011   5,622
...
 
The table has dates from 1990 through 2068.
I want to calculate a date using an offset that comes from a master table, but retrieving only a work day.
example:
08/29/2011 with an offset of 1 should yield 08/26/2011.  I can retrieve the correct value using sub-report by calculating 5622 - 1 = 5621 and linking back to the table.  I prefer NOT to use a sub-report as I have no luck with sharing variables.
I have tried (all unsuccessfully);
SQL Expression
Functions
commands
 
Any ideas?
Thanks for your consideration!


Edited by FOSTANEK - 31 Aug 2011 at 11:02am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 31 Aug 2011 at 12:38pm

You might have to use a command to get your calendar data - this would take the form of:

Select datefield, datefield - 1 as offset_date
from calendar
 
Join to the datefield, use the offset_date in your report.
 
-Dell
IP IP Logged
FOSTANEK
Newbie
Newbie


Joined: 31 Aug 2011
Location: United States
Online Status: Offline
Posts: 2
Quote FOSTANEK Replybullet Posted: 01 Sep 2011 at 4:14am
Thanks for your reply,
 
Can I pass a report variable to the command?
I created a command,
declare @calcid int
select datevalue
from user_Calendar_By_Workday
where idnumber = @calcid
 
CALCID is a variable that hold the original ROW-ID minus a variable offset.  I do not have the COMMAND joined to anything.  The command returned NULL using the above statements.  If I replace the WHERE with a constant instead of @CALCID, it does return a valid date.
 
FOSTANEK


Edited by FOSTANEK - 01 Sep 2011 at 4:16am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.020 seconds.