Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Eliminating Duplicates from different rows Post Reply Post New Topic
<< Prev Page  of 2
Author Message
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Oct 2011 at 2:47am
So is the amount field displaying on the line as empty with these fields populated?
|< /\ '][' ( )
IP IP Logged
moontide
Groupie
Groupie
Avatar

Joined: 23 Feb 2011
Online Status: Offline
Posts: 78
Quote moontide Replybullet Posted: 26 Oct 2011 at 8:49am
yes it was, but i know why, there was another condition that I put earlier in the detail section which was causing it, so I removed it. As for now, the results are showing exactly what i wanted.
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 03 Jan 2013 at 6:18am
Thanks for the tip guys but I'm afraid it isn't working for me. I created 2 formula fields, one called 'Physician' and the other 'ReferringProvider'.
 
I attached the following formula to the first one:
 
global stringvar sPhysician:= sPhysician & {GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality} & ","
 
To the second I attached the following:
 
EvaluateAfter ({@Physician});
if totext({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) in global stringvar sPhysician
then ""
else ({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality})
 
The idea is that if sPhysician contains the Physician already, display a blank line otherwise display the physicin's name etc. Am I using the correct syntax or call to sort i.e. "in". Does this make senese?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 03 Jan 2013 at 8:34am
 
I would have tried:
EvaluateAfter ({@Physician});
if instr(sPhysician, totext({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) > 0
then ""
else ({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality})
or:
EvaluateAfter ({@Physician});
global stringvar sPhysician

if totext({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) in sPhysician
then ""
else ({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality})
 
also, I am assuming that GetDataFromEDIClaims.ReferringProvider} is a string...so you really don'ty need totext, like everywhre else that you use this string.
 
HTH
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 03 Jan 2013 at 12:12pm
Thanks for your suggestion. I tried what ou suggested and nothing gets displayed. It's as if the evaluation gets triggered after the sPhysician string has been completely created. It's just weird. I have to get this thing to work.
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 03 Jan 2013 at 12:15pm
Oh and it won't let me use:
 
if InStr (sPhysician, {GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) > 0
 
but will allow:
 
if InStr ({@Physician}, {GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) > 0
 
even though the string has been defined as being global. I even tried:
 
EvaluateAfter ({@Physician});
global stringvar sPhysician;
sPhysician = ({@Physician});
if InStr sPhysician, {GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality}) > 0
then ""
else ({GetDataFromEDIClaims.ReferringProvider} & " - " & {GetDataFromEDIClaims.Modality})
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 07 Jan 2013 at 8:07am
Hi there; how did you get this to work? I have tried implementing this but it doesn't work for me. are you able to go the forum page to view my responses? Thanks.
 
You need two formulas: You can name them whatever, but for the sake of this post, I will name them AmountField and StringVarField.

Create them both before adding anything to them. Then, for the StringVarField, put in the first formula:

evaluateafter({@AmountField});

global stringvar sAmount:=sAmount & totext({table.amountfield}) & ', ';


Then add the next formula in AmountField:

if totext({table.amountfield}) in global stringvar sAmount
     then ""
          else totext({table.amountfield})
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 07 Jan 2013 at 1:50pm
Hi; may I ask how you got this to work? Thanks.
 
You need two formulas: You can name them whatever, but for the sake of this post, I will name them AmountField and StringVarField.

Create them both before adding anything to them. Then, for the StringVarField, put in the first formula:

evaluateafter({@AmountField});

global stringvar sAmount:=sAmount & totext({table.amountfield}) & ', ';


Then add the next formula in AmountField:

if totext({table.amountfield}) in global stringvar sAmount
     then ""
          else totext({table.amountfield})
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 08 Jan 2013 at 9:05am
I never tried...don't have the data etc. I just replied with the syntax that is more correct.
 
I don't use 'in' except when dealing with arrays, so totext(xxx + '-' + yyy) in zzz didn't make sense to me. if xxx or yyy were numbers, I believe that this would fail (can't add numbers like strings.  Also, typically totext adds decimals and commas unless told not to (at least for numbers, dates are different)
 
so I replied that instr(zzz, xxx + '-' + yyy) > 0 should work better...it's been my experience that if your code doesn't work, you look for possible solutions, which is someone else's code.
 
Alas, we're not always correct, or there is some other twist that we are unaware of.
 
as for debugging, have you tried:
after evaluate (sPhysician)
global stringvar sPhysician;
sPhysician
 
just to check that the values that you think are in the string are actually there?  debugging CR can be tough as it is a black box.  You are pretty sure about what goes in, and you are positive about what comes out, but you can't see what CR is doing or how it is working, so sometimes you have figure out how to 'see' what CR is doing and compare that to what you thought CR was doing.
 
HTH
IP IP Logged
tbgrewal
Newbie
Newbie
Avatar

Joined: 03 Jan 2013
Location: United States
Online Status: Offline
Posts: 6
Quote tbgrewal Replybullet Posted: 01 Feb 2013 at 1:02pm
I did get this to work in the end. Many thanks for everyone's responses. I basically built up the first variable (@Physician) as follows:
 
If (Not IsNull({GetDataFromEDIClaims.ReferringProvider}) And ({GetDataFromEDIClaims.ReferringProvider} <> "")) Then
    Global StringVar sPhysician:= sPhysician + {GetDataFromEDIClaims.ReferringProvider} + " - " + {GetDataFromEDIClaims.Modality} + ",";
 
and then used the follwing code in the second and final variable (@ReferringSource):
 
EvaluateAfter ({@Physician});
//local variables:
Local NumberVar Pos1 = 0;
Local NumberVar Pos2 = 0;
//find 1st position of Physician's Name in the string just constructed in @Physician:
If (Not IsNull({GetDataFromEDIClaims.ReferringProvider}) And ({GetDataFromEDIClaims.ReferringProvider} <> "")) Then
    Pos1:= InStr({@Physician}, {GetDataFromEDIClaims.ReferringProvider} + " - " + {GetDataFromEDIClaims.Modality});
//find the next occurence of the Physician's Name:
If (Not IsNull({GetDataFromEDIClaims.ReferringProvider}) And ({GetDataFromEDIClaims.ReferringProvider} <> "")) Then
    Pos2:= InStr(Pos1 + 1, {@Physician}, {GetDataFromEDIClaims.ReferringProvider} + " - " + {GetDataFromEDIClaims.Modality});
//Pos1 and Pos2 > 0? (occurs if Physician's name is found 2nd time or more - do not display the Physician's name again:
If (Pos1 > 0 And Pos2 > 0) Then
    ""
//otherwise display Physician's name:
Else If ({GetDataFromEDIClaims.ReferringProvider} <> "") Then
    {GetDataFromEDIClaims.ReferringProvider} + " - " + {GetDataFromEDIClaims.Modality};
IP IP Logged
<< Prev Page  of 2
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.032 seconds.