Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you use a group without a database? 1

Status
Not open for further replies.

triceratops

Programmer
Dec 19, 2000
16
0
0
US
I'm trying to group on a date field and use a subreport to show data for the prior two weeks. The data doesn't exist for all dates, so I can't just use that database and group on its date field.

I want to group on date fields, but don't have any database containing all the dates I need. Its looking like I need to generate a database of dates just so I can get this report.

Am I missing something?

Thanks.
 
The way I handle this sort of thing is to create a formula field. The code would be something like this:

If isnull({dateField}) then todate("01/01/2001")
else {dateField}

This is a way of forcing a default in code without changing any databases.

K
 
I think the problem is that this formula will only work when there IS a record with a null value. What if there are only records with other dates. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Ah, I see, that would be a bigger problem. Crystal has several preset date groupings but I don't remember if biweekly is one of them. If so, that would work, otherwise you would have to build your own table.

K
 
Ken has the problem correct. I need to have dates in the report for which
there are no corresponding records.

-Randy
 
Triceratops: A slightly longwinded answer BUT it should suffice:-

1. Create multiple sections e.g. Details A, Details B, Details C etc.. for 14 'slots'
2. Place a duplicate copy of the subreport'in each 'slot'
3. Create a group based upon your Date field with a break every 2 weeks
4. Create 14 formula fields of the form Date -1, Date -2 etc. - this will create a date for each of the previous 14 days
5. Link each subreport in turn with the appropriate formula field - this will select any records for that day

You don't mention what data you need to return but if it is limited in scope then you could consider the use of shared variables to 'send' the values from each subreport and show them in the main report subsection. This would then mean that you could effectively 'hide' the subreports completely - if you need to know how drop me a line.

You will have to suppress all unwanted sections of the subreports to avoid large areas of blank sections where there are no records returned and also turn off the borders to the subreports to ensure these also do not appear David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
that's clever, David. I believe that will work.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top