Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parameter in Database Field Variable Post Reply Post New Topic
Author Message
doraemon
Newbie
Newbie


Joined: 03 Jul 2009
Online Status: Offline
Posts: 3
Quote doraemon Replybullet Topic: Parameter in Database Field Variable
     Posted: 03 Jul 2009 at 8:20am
Assume that I have a parameter variable "bar" and I have three database fields labeled "bar1", "bar2", "bar3", all under a stored procedure called "bar":

-Database Fields
  -foo
    -bar1
    -bar2
    -bar3
-Parameter Fields
  -bar

I want to create a formula field such that I can call each field without using a select/switch/if statements (because the parameter bar is dynamic) by using a parameter variable nested in a database field variable:

{foo.{bar}}

But when I do this, Crystal Reports tells me:
"The function identifier "}" is unknown"
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 06 Jul 2009 at 6:52am
I am not sure what you are trying to accomplish...formulas don't call database stored procs, so what you are trying to accomplish isn't going to work. 
 
So the next question becomes why do you want to do this? If it is to get a value to display on the report, a subreport might work, or simply joining the table into the report might work, but calling a stored proc in a formula won't work.  I believe, that Crystal ONLY calls stored procs when it is gathering data for a report/subreport.  I could be wrong, and I am sure that someone will chime in if I am.
 
HTH
IP IP Logged
doraemon
Newbie
Newbie


Joined: 03 Jul 2009
Online Status: Offline
Posts: 3
Quote doraemon Replybullet Posted: 06 Jul 2009 at 12:10pm
Currently, I am implementing it by using switch condition:

select {?Breakdown By}
    case "Project Name":  {IssueOverview.Project Name}
    case "Reporter":  {IssueOverview.Reporter}
    case "Assignee": {IssueOverview.Assignee}
    case "Type": {IssueOverview.Type}
    case "Priority": {IssueOverview.Priority}
    case "Status": {IssueOverview.Status}
    case "Satisfaction": {IssueOverview.Satisfaction}

"?Breakdown By" is a static list with those possible values. The reason why I wanted to use nested variables is because it would reduce maintenance. Such a statement above could be reduced to:

{IssueOverview{?Breakdown By}}

That way every time the "?Breakdown By" parameter is changed, I won't have to modify this formula as well. And further down the road, "?Breakdown By" will be dynamic as it may change frequently.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 Jul 2009 at 6:13am
Ah.  That makes sense.  Sorry, don't know of a way to accomplish it.
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