Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Formula Syntax Post Reply Post New Topic
Author Message
jj72uk
Newbie
Newbie


Joined: 12 Feb 2010
Online Status: Offline
Posts: 3
Quote jj72uk Replybullet Topic: Crystal Formula Syntax
     Posted: 12 Feb 2010 at 1:07am

Hi all,

Just looking for some wisdom and help.

I currently have a report which has a field that has this formula:


if((({GF_CALLDETAIL.CALL_TYPE})=3 or{GF_CALLDETAIL.CALL_TYPE}= 4) and (isnull({GF_CALLDETAIL.DIAL_DIGIT})
or
length({GF_CALLDETAIL.DIAL_DIGIT})<3))
then 1
else 0

This works fine, I didn't write it, what its saying is if call type is 3 or 4 and dial digits is null or below 3 then count 1 otherwise don't

What I'm trying to do is this:


if((({GF_CALLDETAIL.CALL_TYPE})=3 or{GF_CALLDETAIL.CALL_TYPE}= 4) and (isnull({GF_CALLDETAIL.DIAL_DIGIT})
or
length({GF_CALLDETAIL.DIAL_DIGIT})<3)xor({GF_CALLDETAIL.DIAL_DIGIT})=45 xor{GF_CALLDETAIL.DIAL_DIGIT}=49 xor{GF_CALLDETAIL.DIAL_DIGIT}=4)
then 1
else 0

Which I hope is saying the same apart from if dialed digits length is under 3 but dialed is not 45 49 4.

This doesn't work as it says there is a problem with the formula when I try to save it.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 Feb 2010 at 6:27am
it would seem that your parenthesis are off, but there are a couple of parens that make no sense, you should write out the formula and verify what your logic is.
 
HTH
IP IP Logged
jj72uk
Newbie
Newbie


Joined: 12 Feb 2010
Online Status: Offline
Posts: 3
Quote jj72uk Replybullet Posted: 12 Feb 2010 at 6:35am
Hi lockwelle,
 
The orginal code I didn't write. In all honesty I have no idea how to write crystal, so some clear direction is needed.
 
Sorry
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Feb 2010 at 7:58am
Maybe this...
if(
{GF_CALLDETAIL.CALL_TYPE} in [3,4] and isnull({GF_CALLDETAIL.DIAL_DIGIT})
)
or
(length({GF_CALLDETAIL.DIAL_DIGIT})<3 and NOT({GF_CALLDETAIL.DIAL_DIGIT})in [45,49,4])
)
then 1
else 0
IP IP Logged
jj72uk
Newbie
Newbie


Joined: 12 Feb 2010
Online Status: Offline
Posts: 3
Quote jj72uk Replybullet Posted: 12 Feb 2010 at 8:02am
Once again, thank you for helping me.
 
I've entered your suggestion in and when error checking it i get an error saying
 
'the keyword 'then' is missing
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Feb 2010 at 8:15am
Is Dial_Digit text?
if(
{GF_CALLDETAIL.CALL_TYPE} in [3,4] and isnull({GF_CALLDETAIL.DIAL_DIGIT})
)
or
(
length({GF_CALLDETAIL.DIAL_DIGIT})<3 and NOT({GF_CALLDETAIL.DIAL_DIGIT} in ['45','49','4'])
)
then 1
else 0
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