Formula

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hello;

I am looking to return a code if it is between the following code ranges:

98101-98801

I was thinking something like:

if   {table.field} >= {98101}   and   {table.field} <= {98801}   then "Show"   else "Hide"

Do you think that would work to only return the value if it was between
98101-98801.

LB

Edited by lbuffett - 24 Jan 2017 at 4:46am
The first question is the code field a string or a number.  If it is a number then yes it should work (with slight modification

if   {table.field} >= 98101   and   {table.field} <= 98801   then "Show"   else "Hide"
if it is a string
if   {table.field} >= "98101"   and   {table.field} <= "98801"   then "Show"   else "Hide"

numeric strings can sometimes be a little tricky with ranges and sorting.

Thank you for the help.

It is a string and I think it is working correct. The problem I am having is that on the report instead of the number (code) showing it displays show or hide depending on whether or not it is in the range.

Any ideas on how to just return the number.

Les
If you want the number on the report then you put that field in the report.  The formula you posted will return either the words Show or Hide.  Or do you want the formula to return the number?  If so, do this.

if   {table.field} >= "98101"   and   {table.field} <= "98801"   then {table.field}   else ""