Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Data Selection Post Reply Post New Topic
Author Message
jimmy_macd
Newbie
Newbie
Avatar

Joined: 03 May 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote jimmy_macd Replybullet Topic: Data Selection
    Posted: 03 May 2007 at 2:59am
Hi All,
 
I have been asked to have a look at the performance of a crystal report but I am a complete newbie without any training ! Can anyone hep with the following problem.
 
We have a report that extracts data from an MS SQL database. I have traced the problem to the data selection on a sub report.
 
Basically, the subreport receives the customer number from the main report and selects from the customer master table the 1 record matching this customers. The customer record returns a lot of fields, including 6 fields that contain specific codes.
 
The report has to display the text for the codes in the selected language not the actual code.
 
However, the orginal designer has selected these text via a left outer join and then uses a formula in the record selection.
 
I see;
{@ZTPJOBFUNCSPRAS} = "1" and
{@ZTVBRTSPRAS} = "1" and
{@ZTPCMRSTATTSPRAS} = "1" and
{@ZTPPINTTSPRAS} = "1" and
{@ZJOBTECHTSPRAS} = "1" and
{@ZTPPURINFLTSPRAS} = "1" and
and
{SMOKNA1_1.PARTNER} = {?Pm-SMOKNA1_1.PARTNER}
 
in the record selection. For each of the @ fields, I can see;
if IsNull ({ZTPPURINFLT_SMO.SPRAS}) then '1' else
if {ZTPPURINFLT_SMO.SPRAS} = {?Pm-?Language} then '1' else '2'
 
I understand how this works. It returns all the records from the SQL data base using the left outer join but internally in Crystal it only selects where the code is null or in the parameter language.
 
Because we have a lot of langauges on the DB, this cause a mssive select. If the customer has an entry in each on the six field, the select trace shows
 
Field      1        2        3        4      5      6
             EN      EN      EN      EN   EN    AT
             EN      EN      EN      EN   EN    DE
             ..
             ..
             EN      EN      EN      EN   AT     EN
 
And so on. This matrix returns circa 192,000 records and that is the route of our problem.
 
What I would like to do is read the 1 customer record using the partner number key field. and fire of up to 6 separate reads of the text tables if there is an entry in the code field on the customer master record.
 
My problem is, I have no idea how to do this in CR !!
 
Sorry for such a long question, but I have tried to detail the issue as much as possible.
 
Thanks in advance.
 
James
         
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 08 May 2007 at 1:28pm
Because your selection formula is using a bunch of formulas and not specific fields, the actual data selection is happening on inside Crystal instead of through the database.
 
I would leave "{SMOKNA1_1.PARTNER} = {?Pm-SMOKNA1_1.PARTNER}" in the select formula and then use a suppression formula to suppress the section on the subreport if all of the other conditions aren't met.  Your suppress formula would look something like:
 
{@ZTPJOBFUNCSPRAS} <> "1" or
{@ZTVBRTSPRAS} <> "1" or
{@ZTPCMRSTATTSPRAS} <> "1" or
{@ZTPPINTTSPRAS} <> "1" or
{@ZJOBTECHTSPRAS} <> "1" or
{@ZTPPURINFLTSPRAS} <> "1"
 
-Dell
 
IP IP Logged
jimmy_macd
Newbie
Newbie
Avatar

Joined: 03 May 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote jimmy_macd Replybullet Posted: 17 May 2007 at 5:06am

Hi,

I got round this in the end. I created 6 commands in the Database expert to select data from the 6 text files.

I then linked to this "tables" using a left outer join.

This report now runs within a second even if all 6 code fields are populated.

Cheers

James

IP IP Logged
jimmy_macd
Newbie
Newbie
Avatar

Joined: 03 May 2007
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote jimmy_macd Replybullet Posted: 17 May 2007 at 5:08am

Hi,

I got round this in the end. I created 6 commands in the database expert screen to select the data from the text tables using the langauge supplied by the user.

I then linked to these "tables". The report now runs in a second regardless of how many of the code fields are populated

Cheers

James

IP IP Logged
Pelican
Newbie
Newbie


Joined: 29 Aug 2007
Online Status: Offline
Posts: 2
Quote Pelican Replybullet Posted: 29 Aug 2007 at 11:27am
I'm using Crystal Reports v9, OEM version that came with Peachtree Accounting for Manufacturing.

I have the exact same issue, and have tried select formulas and suppress formulas, as suggested, without success.

I don't see any option to enter commands in the database expert to select the data. Is it possible in the version I am using?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 29 Aug 2007 at 11:38am
I've never used it with Peachtree. But I could see where it would have limited functionality. Depends on what type of data connection options it gives you when creating a report.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Pelican
Newbie
Newbie


Joined: 29 Aug 2007
Online Status: Offline
Posts: 2
Quote Pelican Replybullet Posted: 29 Aug 2007 at 1:48pm
I tried to put screen shots of the screens I see in the database expert, but apparently our security won't allow it.
I see two tabs; Data and Links. Data shows the lists of connections (database files)available. Links shows the selected files with lines connecting the links. Iinks also has the following buttons: Auto-Arrange; Auto-Link (by name or by key); Order Links; Clear Links; Delete Link; Link Options; and Index Legend.

That's all I have to work with.
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.016 seconds.