Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Negative Reversal Problem CRX Post Reply Post New Topic
Author Message
CSPIT
Newbie
Newbie


Joined: 11 Jul 2012
Online Status: Offline
Posts: 1
Quote CSPIT Replybullet Topic: Negative Reversal Problem CRX
     Posted: 11 Jul 2012 at 3:38am
Using Crystal Reports 10
 
I have a numbering sequence of ABCXXXX99909 and I need to match the 09 to 90 of a another field 90XXX0
 
I am using the following formula but cannot get it to recognise the negative 09 reversed to 90.  Any ideas?
 
//Formula to check the Policy Number against Insurer year
Local Stringvar PolYear;
Local Stringvar InsYear;
Local Numbervar InsYearNo;
 
PolYear:=Right ({Risk.PolicyNumber}, 2);
If Length(totext({Insurer.InsurerCode})) = 09 then InsYear:=StrReverse(Left (totext({Insurer.InsurerCode}), 2))
else InsYear:=(Left (totext({Insurer.InsurerCode}), 2));
 
If PolYear = InsYear then "Correct Details"
Else "Incorrect Details"
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Jul 2012 at 4:02am
If Length(totext({Insurer.InsurerCode})) = 09
this line isn't doing what I think you want.  It currently reads, if the length of the insurerCode = 9. What I think you want is: totext({Insurer.InsurerCode}, "", 0) = "09"
 
I would check this as well, because if {Insurer.InsurerCode} is a number, the totext value is 9, not 09.  By default totext for a number will format as 9.00.
 
So to debug, I would create a simple formula that is just:
totext({Insurer.InsurerCode}, "",0)
 
and see what results you get. Then you can code your formula to respond correctly.
 
I'm not looking at help, but I think that you can give totext a 'picture' of how to transform your number to a string..."00" should work in your case (if totext accepts the argument)
 
HTH
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