Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to show data from 2 different views Post Reply Post New Topic
Author Message
pzar
Newbie
Newbie


Joined: 09 Dec 2009
Online Status: Offline
Posts: 4
Quote pzar Replybullet Topic: How to show data from 2 different views
     Posted: 09 Dec 2009 at 4:17am
Hi Everybody,
 
I would like to show data around 2 different Views from the given period. Oth Views contain the Data/Time column. If there is no filter, is showing all data. I tried to create such a filter (query)
 
{rpt_print_transactions.Date/Time} >= {?@Start_date} and
{rpt_print_transactions.Date/Time} <= {?@End_date} and
{rpt_copy_transactions.Date/Time} >= {?@Start_date} and
{rpt_copy_transactions.Date/Time} <= {?@End_date}
 
 but is doesn`t work (I see no data in report).
I am calling for help, how it should look it is an Formula?.
 
Thank You in advance
Best Regards
Pzar 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2009 at 6:12am
the formula should work, and the question that I have is what do the dateTimes and parameters look like?  If the parameters are MM/dd/yyyy but the table fields are MM/dd/yyyy hh:mm:ss the end date may be cutting off the data. OR there may be do data where both the print and the copy transaction date are in the date range.
 
To see where things might be going astray, I will print various parts of the formula in a 'test' formula and display it, so you could break the above formula into 6 formulas, one for each line and one for each transaction type, and display them on the report, then you can 'see' what CR is doing and what you want and respond accordingly.
 
HTH
IP IP Logged
pzar
Newbie
Newbie


Joined: 09 Dec 2009
Online Status: Offline
Posts: 4
Quote pzar Replybullet Posted: 09 Dec 2009 at 9:13am
The formula is working if the range is setting for print transctions or for copy transactions, is not working if the formula contain date for copy and print tr. Because in database are people which made only copies or prints I modified the formula to:
 
{rpt_copy_transactions.Date/Time} >= {?@Start_date} and
{rpt_copy_transactions.Date/Time} <= {?@End_date} or
{rpt_print_transactions.Date/Time} >= {?@Start_date} and
{rpt_print_transactions.Date/Time} <= {?@End_date}
 
but this show only copy transactions.
 
You can show some example how to do the test about which you are writing?
 
Thanks in advance 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 09 Dec 2009 at 2:12pm
({rpt_copy_transactions.Date/Time} >= {?@Start_date} and
{rpt_copy_transactions.Date/Time} <= {?@End_date})
 or
({rpt_print_transactions.Date/Time} >= {?@Start_date} and
{rpt_print_transactions.Date/Time} <= {?@End_date})
 
does this work any better?  the logic was a bit unpredictable without the ()
IP IP Logged
pzar
Newbie
Newbie


Joined: 09 Dec 2009
Online Status: Offline
Posts: 4
Quote pzar Replybullet Posted: 09 Dec 2009 at 2:33pm

lockwelle

Is the same result, only cp transactions.

Perhaps is something wrong in relationships betweent views? I have a structure as below:

1. Users.view

2. Cp.transactions.view with Left Outer Join [User ID] to Users.view [User Id]

3. Pr.transactions.view with Left Outer Join [User ID] to Users.view [User Id]

In report are some info about user (user ID, L. Name, F. Name ...) from Users.view, some info about print jobs from Pr.transactions.view and some info abou copy transactions from Cp.transactions.view.
 
That is all.
 
IP IP Logged
pzar
Newbie
Newbie


Joined: 09 Dec 2009
Online Status: Offline
Posts: 4
Quote pzar Replybullet Posted: 09 Dec 2009 at 2:42pm
Originally posted by pzar

lockwelle

Is the same result, only cp transactions.

Perhaps is something wrong in relationships betweent views? I have a structure as below:

1. Users.view

2. Cp.transactions.view with Left Outer Join [User ID] to Users.view [User Id]

3. Pr.transactions.view with Left Outer Join [User ID] to Users.view [User Id]

In report are some info about user (user ID, L. Name, F. Name ...) from Users.view, some info about print jobs from Pr.transactions.view and some info abou copy transactions from Cp.transactions.view.
 
That is all.
 
 
Sorry
I made mistake in relationships, below are correct:
 
Left Outer Join Users.User ID --> Pr_transactions.User ID
Left Outer Join Users.User ID --> Cp_transsctions.User ID
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 10 Dec 2009 at 6:28am
Sorry, I don't join tables in CR, so I am not familar with which way it goes.  What the SQL should look like is:
SELECT ...
FROM Users
 LEFT OUTER JOIN Pr_transactions ON Users.UserID = Pr_transactions.UserID
 LEFT OUTER JOIN Cp_transactions ON Users.UserID = Cp_transactions.UserID
 
You know that you have users, and they may or may not have printed/copied anything.  You can always filter out the users that have not copied or printed, but you can't do it the other way around.  The Left joins, what is to the left of the word join, forms the base table, and if it is not the user, then you will be limiting and or omitting the people that copied.
 
Check the SQL syntax and see if the joins are as expected.
 
good luck
 
IP IP Logged
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