Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: sql to Crystal Post Reply Post New Topic
Author Message
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Topic: sql to Crystal
    Posted: 29 Aug 2017 at 6:29am
I received some help from a peer, that gave me this sql code to make sure I knew what I wanted to pull back on a new Crystal report we are designing.

from AUTHS a
       left join [dbo].[V_SupplementalDataEndServiceDate] e on e.AUTHUKEY = a.AUTHUKEY
where
       e.AUTHUKEY IS NULL

I went to try and put that into my report selection formula as the line below with ******* pointed out. But this is not working.

(({Members.CGRPID} like {?Health Plan} and
{Members.CPLNTP} like {?LOB}) or
isnull({Members.MBRNO})) and

{Members.CIPACD} like {?IPA} and

{AUTHS.Status} <> "Cancelled" and

({AUTHS.ExpirationDate} < {@StartDefaultDate} or
not isnull({Members.TermDate})) and

{AUTHS.ReferralType} like ["HPC","DIA"]
******and isnull ({V_SupplementalDataEndServiceDate.EndServiceDate})

Everything works on the report except that line. It brings back nothing. Is this enough information for anyone to help/add some suggestions to my formula? I am trying to bring in all records that do not have an EndServiceDate and it's not working correctly. It brings back nothing.

Edited by BoltzGirl - 29 Aug 2017 at 6:30am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Aug 2017 at 2:28am
did you alter the join in the data source set up to make it an left outer join?
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Posted: 30 Aug 2017 at 6:16am
I did alter the join. One of the most confusing things for me on this is; that each record actually does not use the EndServiceDate at all. Therefore, I would think I would be pulling back quite a few records as "Null". But what I have found is; that if the field isn't used at all...it's not 'recorded' within the table. The field is only recorded when used, if that makes sense. So I am trying to pull a specific type of records with my other formula, to then only pull those types with the EndServiceDate as null....Does this make any sense? I might not be explaining clearly at all, as it is a bit confusing.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Aug 2017 at 7:31am
you want to only include 'not closed' records but the close date is stored in another table so you need to do a select where the matching ID does not exist in that table.

First test to make sure that you router join is working. Place the discharge date into the report canvas and see if you are getting both closed and open records. placing the field on your report will enforce the join and you can make sure your joins are OK.
If the joins are OK, in the select criteria you can set it to "use default values for nulls" which will assist in how it reads things in sequence then try to use the same code your sql person did

and isnull ({V_SupplementalDataEndServiceDate.AUTHUKEY})
IP IP Logged
BoltzGirl
Groupie
Groupie
Avatar

Joined: 22 Jan 2013
Online Status: Offline
Posts: 89
Quote BoltzGirl Replybullet Posted: 30 Aug 2017 at 8:43am
I GOT IT!!!! Makes sense now!!! THANK YOU SO MUCH!!!
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.