Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference parameter in a SQL Expression

Status
Not open for further replies.

RustyAfro

Programmer
Jan 12, 2005
332
US
CRXI R2

Is there anyway to reference a parameter in a SQL Expression?

I want to return a database field conditionally in a SQL Expression based on a parameter answer.

Probably not, but worth asking ;-)
 
SQL expressions return one value only, not a set of values, and they do not accept parameters. I'm not sure why you would WANT to do this in a SQL expression. Why not just use a formula?

-LB
 
I didn't think I could, but sometimes there are workarounds so I wanted to ask ;-).

I did want to return the values of only one database field, but based on a condition.

So on the server, it might look like;

CASE WHEN "Fieldx" = "Yes" Then "Field1" END

I wanted "Fieldx" to be the value of a parameter answer (so it might be "Yes"="Yes"). It is possible with a command with a parameter but not using sql expressions.

As to the why, I was hoping it might help with my attempts at getting a subreport to group on server if the value came in the way I needed it, to be summed in a shared variable (I have that question pending in another thread766-1427480)

I did some testing though and summing the data in a database field in a shared variable didn't help, so doing this would be pointless. Thanks for the help though!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top