Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calling parameters with formulas Post Reply Post New Topic
Author Message
Erinmichelle
Newbie
Newbie
Avatar

Joined: 06 Nov 2009
Location: United States
Online Status: Offline
Posts: 24
Quote Erinmichelle Replybullet Topic: Calling parameters with formulas
    Posted: 23 Mar 2010 at 11:46am
Hi there,
 
I have a huge list of locations on my report - like 450.  What I want to do is have a selection parameter that would give the option of some of them.  However, there are two that can be grouped, and then we also want an "All" function.
So my parameter gives the option to choose between 50 specific locations and then anything that starts with "VC1" and anything that starts with "VC2", and "All".  How then do I write a selection formula for this?  Here's what i had so far:
 
 
if {?Location} = "VC1" then (if left({@Location/DeviceName}, 3) = "VC1" then {@Location/DeviceName} else "")
else if {?Location} = "VC2" then (if left({@Location/DeviceName}, 3) = "VC2" then {@Location/DeviceName} else "")
else if {?Location} = "All" then {@Location/DeviceName}
else {@Location/DeviceName} = {?Location}
 
I'm getting an error on the last line. Any help? Thanks so much!
Thanks!

Erin
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 24 Mar 2010 at 2:09am
There may be a better way to do it but I usually leave if statements out of my record selection. I would do something like:
 
{?Location}='VC1' and left({Location/DeviceName},3)='VC1'
or
{?Location}='VC2' and left({Location/DeviceName},3)='VC2'
or
{?Location}='ALL' and {Location/DeviceName}={Location/DeviceName}
or
{?Location}={Location/DeviceName}
 
Could be worth a try and I believe it will get you what you want, but there may be a cleaner way to write it.
IP IP Logged
Erinmichelle
Newbie
Newbie
Avatar

Joined: 06 Nov 2009
Location: United States
Online Status: Offline
Posts: 24
Quote Erinmichelle Replybullet Posted: 24 Mar 2010 at 8:06am
thank you so much! that worked. I knew the if statement in there was a bit awkward so thanks for your fresh perspective! :)
Thanks!

Erin
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.