Monday, March 12, 2012

Repeating Information

Hi

I am trying to make a letter in Crystal Reports 10 that pulls up details for all our customers whose technical support contracts are due to expire between two set dates.

The letter is populated with Address and Contact details of the customer from a table called Profile and the contract expiry date is pulled from another table linked to the customer called Config.

I have managed to set this up and it pulls up all our customers who are due to expire and places their info into an individual letter.

The only problem is that each letter is duplicated another 5 times so that I am getting 6 letters for each customer.

Does anyone know what is going wrong?

The code I am using is quite simple.

In the select expert I have:
{@.Expiry date ( as a date)} in {?Date Range} and
{Config.SupportExpDate} <> " "

I have created a formula for the expiry date:
If
(
Numerictext({Config.SupportExpDate}[1 to 4])
and
Numerictext({Config.SupportExpDate}[6 to 7])
and
Numerictext({Config.SupportExpDate}[9 to 10])
)

then

Date ( toNumber({Config.SupportExpDate}[1 to 4]),
toNumber({Config.SupportExpDate}[6 to 7]),
toNumber({Config.SupportExpDate}[9 to 10]))

The date range is created using 2 formulas for start and finish:

Maximum({?Date Range})

&

Minimum({?Date Range})

Anybody got any ideas where I'm going wrong?Assuming that u execute the report from VBasic, the below logic shd work out..

Say the Customer table has a Unique field, for instance field "Cust_id" is unique in yr table, then we can pull only unique of Cust_id into report. This can be done by using the below qry...

CrystalReport1.DiscardSavedData = True
CrystalReport1.SQLQuery = "Select distinct(cust_id),......"
CrystalReport1.Action = 1|||Another thing to check for is to see if, in your Datasource, you haven't linked your fields properly (if using more than one table).

No comments:

Post a Comment