Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: fourmula asking for Then already have Post Reply Post New Topic
Page  of 2 Next >>
Author Message
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Topic: fourmula asking for Then already have
     Posted: 26 Aug 2014 at 2:23am
In the formula I am wanting to compare two years Last year and this year I need the formula to look at the property ID and the Location number and if these two are the same in both years I do not want the record to show up. If not the same I need to show on report. I first kept getting a message that I was missing a ) but I was not know it is saying missing "Then" which I have in the formula. Been working on this thing for 2 days.... Please Help

if{txre_master.a_property_code} = next({txre_master.a_property_code}) or {txre_master.a_property_code} = previous({txre_master.a_property_code})
and
if{txre_master.a_juris_code}= next({txre_master.a_juris_code}) or {txre_master.a_juris_code} = previous({txre_master.a_juris_code})then 'Yes' else 'No'
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Aug 2014 at 3:08am
Try grouping your statements and removing the second if:

if
(
(
({txre_master.a_property_code} = next({txre_master.a_property_code}))
or
({txre_master.a_property_code} = previous({txre_master.a_property_code}) )
)
and
(
({txre_master.a_juris_code}= next({txre_master.a_juris_code}))
or
({txre_master.a_juris_code} = previous({txre_master.a_juris_code}))
)
)
then 'Yes'
else 'No'
|< /\ '][' ( )
IP IP Logged
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Posted: 26 Aug 2014 at 3:12am
It says the then and else portion doesn't seem to be part of the formula
IP IP Logged
z9962
Senior Member
Senior Member
Avatar

Joined: 04 Jul 2012
Online Status: Offline
Posts: 161
Quote z9962 Replybullet Posted: 26 Aug 2014 at 3:19am
Do you have the IF at the start??
IP IP Logged
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Posted: 26 Aug 2014 at 3:27am
ok now it is working but when I go to filter (I want to filter by this formula field) my formulas are not showing up under my choose a field list.. any ideas on this.
By the way thank you so much for actually getting the formula to work!!!
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Aug 2014 at 3:31am
I removed some of the grouping.

if

(
(
{txre_master.a_property_code} = next({txre_master.a_property_code})
or
{txre_master.a_property_code} = previous({txre_master.a_property_code})
)

and

(
{txre_master.a_juris_code}= next({txre_master.a_juris_code})
or
{txre_master.a_juris_code} = previous({txre_master.a_juris_code})
)
)

then 'Yes'
else 'No'
|< /\ '][' ( )
IP IP Logged
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Posted: 26 Aug 2014 at 3:32am
I also want it to only return the results that have a record in 2013 an 2014 this will be matching only the property codes to see if two records exist can you run this selection with the other selection?
IP IP Logged
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Posted: 26 Aug 2014 at 3:37am
I was able to write another formula to pull the second info I just need to be able to use the selection expert to only pull the records that contain a no in both places
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 26 Aug 2014 at 3:37am
Previous and Next can't be used as selection formulas because they must be evaluated later.

My suggestion is to suppress the detail lines that don't meet the criteria.


Edited by FrnhtGLI - 26 Aug 2014 at 3:38am
|< /\ '][' ( )
IP IP Logged
tsh1586
Newbie
Newbie


Joined: 25 Aug 2014
Location: United States
Online Status: Offline
Posts: 11
Quote tsh1586 Replybullet Posted: 26 Aug 2014 at 3:50am
How do I suppress by line for the two criteria? I am sorry still new at this crystal thing
IP IP Logged
Page  of 2 Next >>
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