Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Where am I going wrong! Post Reply Post New Topic
Author Message
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Topic: Where am I going wrong!
     Posted: 09 Apr 2008 at 8:52am
I am having the worst time with Dynamic Cascading Parameters.... I need a report with 5 Dynamic parameters and I can't seem to get it right. Can someone send me an example to look at? I've looked at the GROUP.RPT in the samples but I can't seem to make the connection??
 
My SQL command is the following (these are all the parameters I need, but I need it based off the second query)
 
Command 1-
SELECT
    MWAPPTS."COMPANY", MWAPPTS."BOOK", MWAPPTS."USERCODE",MWBOOK."PROV", MWBOOK."FACILITY"
FROM
    { oj (("medical"."dbo"."MWAPPTS" MWAPPTS LEFT OUTER JOIN "medical"."dbo"."CLMASTER" CLMASTER ON
        MWAPPTS."COMPANY" = CLMASTER."COMPANY" AND
    MWAPPTS."ACCOUNT" = CLMASTER."ACCOUNT")
     LEFT OUTER JOIN "medical"."dbo"."MWBOOK" MWBOOK ON
        MWAPPTS."COMPANY" = MWBOOK."COMPANY" AND
    MWAPPTS."BOOK" = MWBOOK."BOOKCODE")
     LEFT OUTER JOIN "medical"."dbo"."MWSCHED" MWSCHED ON
        MWAPPTS."ADATE" = MWSCHED."ADATE" AND
    MWAPPTS."BOOK" = MWSCHED."BOOK" AND
    MWAPPTS."COMPANY" = MWSCHED."COMPANY"}
 
Command2-
CREATE PROCEDURE [dbo].[gm_SelCompanies]
AS
BEGIN
     SET NOCOUNT ON
     
DECLARE @COMPANY TABLE(
       vcCompany    VarChar(10)
       )
     SET NOCOUNT ON
           
     --Insert the Companies from CLUSER
     INSERT INTO @COMPANY
     SELECT
          DISTINCT COMPANY
     FROM
          CLUSER
     WHERE
          (ACTIVE = 'Y' OR ACTIVE IS NULL)
         
     --Insert the Companies from CLUSERCOMPANY
     INSERT INTO @COMPANY
     SELECT
          DISTINCT CLUSERCOMPANY.COMPANY
     FROM
          CLUSERCOMPANY INNER JOIN CLUSER ON CLUSERCOMPANY.USERCODE = CLUSER.USERID
     WHERE
          (ACTIVE = 'Y' OR ACTIVE IS NULL)

     --RETURN THE DISTINCT LIST OF COMPANIES
     SELECT
          DISTINCT vcCOMPANY
     FROM
          @COMPANY
     ORDER BY
          vcCOMPANY
END
GO
 
 


Edited by moleary - 09 Apr 2008 at 9:01am
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 09 Apr 2008 at 5:58pm
I think the problem you are having with DCPs is that you can't break them apart into separate recordsets. You need to have one giant recordset which has all the data you need for all the possible DCPs. Crystal takes this giant resultset and only shows one column at a time to the user. As they select items from the list, Crystal uses it to filter the recordset into a smaller dataset. This happens over and over till you get to the last DCP.

Also, you say that you have five parameters, but your second query only has one field (vcCompany). I'm a bit confused by that, but if you understand what I'm talking about in the first paragraph then you will probably know how to clean this up.

I have extensive coverage about DCPs and the tricks to make them work in Chapter 4 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
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
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Posted: 17 Apr 2008 at 9:39am
GOT IT! My other issue is that previous in 8.5 we had a parameters page that allows users to see the parameters they have choosen. This was linked through the Select Expert. How do I accomplish this with the Dyamic Parameters if and the end of my cascade I only have one parameter?
IP IP Logged
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Posted: 17 Apr 2008 at 9:39am
Or do I even need to worry about that?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 17 Apr 2008 at 3:53pm
Parameters in XI are no different than 8.5. But now they can be linked together to create a DCP. This just has to do with how they connect to the database, but they still interact with the report in the same way. You can drag and drop them onto your report to show them to the user just like you did previously.
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
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Posted: 22 Apr 2008 at 5:50am
So I still need to bind each of my values to a parameter when creating the cascade? In the examples, I've just seen they bind the very last value as the parameter....
IP IP Logged
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Posted: 22 Apr 2008 at 7:29am
Nevermind I answered my own question. So I re-wrote my query but when I use my first cascasding parameter....(company) it does pull all available companies from my table?? Here is my query.....
 
SELECT
    MWAPPTS.COMPANY, MWAPPTS.ADATE, MWAPPTS.AKEYTIME, MWAPPTS.ATIME, MWAPPTS.BOOK, MWAPPTS.ADESC, MWAPPTS.USERFLAG, MWAPPTS.USERCODE, MWAPPTS.ANOTE,
    MWSCHED.ANOTE,    CLMASTER.PLNAME, CLMASTER.PFNAME, MWBOOK.BOOKNAME, MWBOOK.PROV, MWBOOK.FACILITY
FROM
    { oj ((medical.dbo.MWAPPTS MWAPPTS LEFT OUTER JOIN medical.dbo.CLMASTER CLMASTER ON
        MWAPPTS.COMPANY = CLMASTER.COMPANY AND
    MWAPPTS.ACCOUNT = CLMASTER.ACCOUNT)
     LEFT OUTER JOIN medical.dbo.MWBOOK MWBOOK ON
        MWAPPTS.COMPANY = MWBOOK.COMPANY AND
    MWAPPTS.BOOK = MWBOOK.BOOKCODE)
     LEFT OUTER JOIN medical.dbo.MWSCHED MWSCHED ON
        MWAPPTS.ADATE = MWSCHED.ADATE AND
    MWAPPTS.BOOK = MWSCHED.BOOK AND
    MWAPPTS.COMPANY = MWSCHED.COMPANY}
 
I should have 6 companies from the table MWAPPTS.COMPANY but in the dynamic parameter it only pulls two.
IP IP Logged
moleary
Newbie
Newbie


Joined: 06 Feb 2008
Location: United States
Online Status: Offline
Posts: 28
Quote moleary Replybullet Posted: 23 Apr 2008 at 10:03am
I broke down and just ordered your book. Hopefully I can stop bothering you with all my posts. :)
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