Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Report shows up with no data. Post Reply Post New Topic
Page  of 2 Next >>
Author Message
relucas81
Newbie
Newbie


Joined: 06 May 2014
Location: United States
Online Status: Offline
Posts: 6
Quote relucas81 Replybullet Topic: Report shows up with no data.
     Posted: 06 May 2014 at 5:24am
Greetings all,
I am modifying a quote report that comes out of E2 by Shoptech.
I'm using Crystal Reports V. 14.0.2.364RTM.

The simple formula I wrote is this.
IF isnull({Quote.ContactName}) then " "
Else({Contacts.Cell_Phone})

The problem is that in E2 if a contact has not been selected that it will display a blank report with only the hard coded data.

If a contact is not selected then the table "Contacts" cannot complete the link thus causing a blank report.
(So I theorize)

Is there a way to get it to stop evaluating the formula if {Quote.ContactName} is Null?

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 06 May 2014 at 11:28am
Unfortunately, you'll need to contact the folks at ShopTech to get assistance with this. We have no way of knowing how their reports are set up or how they're using the SDK to display reports, which might affect what you're trying to do.

-Dell
IP IP Logged
relucas81
Newbie
Newbie


Joined: 06 May 2014
Location: United States
Online Status: Offline
Posts: 6
Quote relucas81 Replybullet Posted: 07 May 2014 at 5:17am
Shoptech doesn't offer support for crystal reports.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 May 2014 at 5:43am
Ok, let me see what I can do here...

What tables are you using and are your tables linked together? Right-click on the links and let me know what the settings are in the Join Options.

-Dell
IP IP Logged
relucas81
Newbie
Newbie


Joined: 06 May 2014
Location: United States
Online Status: Offline
Posts: 6
Quote relucas81 Replybullet Posted: 07 May 2014 at 6:31am
Tables are QuoteMain and Contacts. They are linked as so

Tables
Quote Main > Contacts
Fields                   Join Type
ContactName > Contact     Inner Join, Not Enforced, =
Phone > Phone             Inner Join, Not Enforced, =
Fax > Fax                 Inner Join, Not Enforced, =
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 May 2014 at 6:38am
This didn't format very well. It looks like all of these are inner joins, so if you'll give it to me in the following format, I'll be able to read it better (in the Database Expert, pay attention to which direction the arrow is pointing - the arrow points to the "To" table.)

Table1.Field1 to Table2.Field2

Thanks!

-Dell
IP IP Logged
relucas81
Newbie
Newbie


Joined: 06 May 2014
Location: United States
Online Status: Offline
Posts: 6
Quote relucas81 Replybullet Posted: 07 May 2014 at 6:56am
They are all "Inner Joins"

QuoteMain.ContactName to Contact.Contact    
QuoteMain.Phone to Contact.Phone             
QuoteMain.Fax to Contact.Fax
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 May 2014 at 7:19am
Ok, based on the join types, you'll never have data in your report where QuoteMain.ContactName is null. An inner join means that both tables have to have data in the field in order for the row to be included in the result set. So, you should be able to just use {Contacts.Cell_Phone} on the report without checking for null in {QuoteMain.ContactName}.

If that doesn't work for you, what are you trying to accomplish with this formula?

-Dell
IP IP Logged
relucas81
Newbie
Newbie


Joined: 06 May 2014
Location: United States
Online Status: Offline
Posts: 6
Quote relucas81 Replybullet Posted: 07 May 2014 at 7:39am
I'm sorry I'm not sure if I follow. I'm new to Crystal Reports.

In my report I have the following fields
{Contacts.Phone}
{Contacts.Cell_Phone}
{Contacts.EMail}
However when the field {Quote.ContactName} is Null they cannot pull any information from the Contact Table because the Contact Table is linked through the {Quote.ContactName}
Does that make sense? I wish I could send you some screenshots.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 May 2014 at 9:51am
I think I may know part of what is going on. Are you creating a new report or have you just added a table to an existing report? Either way, when you install Crystal, something called "Automatic SmartLinking" is turned on. However, despite the name, it isn't very smart. What it does is try to match up fields between two tables based on the field name - if the names are the same they're automatically added to the link even though it might not make sense.

I would do a couple of things:

1. Go to the File menu and then to Options. Go to the Database tab and uncheck "Automatic SmartLinking" at the bottom.

2. Once again, on the File menu, turn off "Save Data With Report". Generally, you don't want this on as it makes your .rpt file bigger and all of the data has to be discarded when you run the report.

3. In the Database Expert, click on each of the links between the tables and delete them.

4. Add the correct link between the two tables.

From long-time experience with databases, the links between tables are usually based on either string "code" fields or numeric "id" fields. One way to help with this is to right-click on one of the fields in the Field Explorer and turn on "Show Field Type". You need to link fields of the same type. So, if the "Contact" field is a number, you're looking for a number field in QuoteMain. Another thing you can do is right-click on the field in the Field Explorer and select "Browse Data" to see what's actually in the field.

So, I would look in your QuoteMain table and see if you can find a fields named something like "ContactID" or "ContactCode". Then join from that to the "Contact" field in the Contact table or there may be some other ID field in the Contact table that you need to link to. Without knowing the structure of your tables, I can't tell you specifically what to look for.

5. Once you have the correct link set up, you may or may not want to right-click on it and change the join type. If you're not familiar with databases, here's how the joins work:

Inner Join - There must be matching data in BOTH tables.

Outer Join - Only one table has to have matching data. This works by direction - left or right. For a left outer join, the table that you're linking FROM has data but the table that you're linking TO may or may not. If it doesn't, the query will automatically include "null" values for fields in the TO table when there is no record that matches the FROM table.

So, you need to decide what type of join you need. I would probably link FROM QuoteMain TO Contact, but that really depends on what data you want to see in your report.

-Dell

-Dell
IP IP Logged
Page  of 2 Next >>
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