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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting "Record Selection" comparison method based on a Parameter...? 1

Status
Not open for further replies.

MJRBIM

MIS
May 30, 2003
1,579
0
0
CA
CR-XI, MS-SQL database
======================

Would like a parameter on a report that effects the "Record Selection" comparison method -

Parameter = {ComparisonMethod}
Values =
01 - EQUAL TO
02 - LESS THAN
03 - GREATER THAN
04 - LESS THAN OR EQUAL TO
05 - GREATER THAN OR EQUAL TO

I'm pretty sure I can do this with a long IF-THEN-ELSE statement in the Record Selection formula, but think that will run pretty slowly on a large data-set.

Anyone done this before? What is the most-efficent method of setting the "Record Selection" comparison method based on a Parameter...?

Thanks in Advance!
 
but think that will run pretty slowly on a large data-set."

An if then statement won't slow anything down, what is passed or not passed to the database will.

if {?Compar} = 1 then
{table.field} = {?SomeOtherParm}
else
if {?Compar} = 2 then
{table.field} < {?SomeOtherParm}
else
if {?Compar} = 3 then
{table.field} > {?SomeOtherParm}
else
if {?Compar} = 4 then
{table.field} <= {?SomeOtherParm}
else
if {?Compar} = 5 then
{table.field} >= {?SomeOtherParm}

Check the Database->Show SQL to make certain the SQL reflects the choice.

-k
 
THANKS!

They want to embed the reports within a Java application which passes all the parameter-values in the background - hidden from the user, and delivers a PDF.

I think I will do everything within the RECORD SELECTION formula.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top