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

How to use ranges in formulas 1

Status
Not open for further replies.

BigJohn70

IS-IT--Management
Apr 7, 2003
1
US
I'm trying to setup a variance report in a general ledger so that one of my goups extracts data from accounts that fall in the range of 50000000 to 89999999. At first I used the formula 'if {@text_to_number} > 59999999 then "Expense"' but I can't include the numbers over 899999999.
 
if {@TexttoNumber} in 50000000 to 89999999 then "Expense" Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
For numbers within a range of 50000000 to 89999999, ensure your syntax in your formula is like:

{YourField} in [50000000 to 89999999]

or

{YourField} >= 50000000 and
{YourField} <= 89999999

Naith
 
If you're grouping on a range of values, then presumably you will have a group for each possible value in the group, or you are NOT interested in the group, and you should use the record selection formula (Report->Edit Selection Formula->Record) to eliminate these rows from the report.

One of the keys is to ensure that the SQL is passed to the database as a result (check Database->Show SQL Query) so that Crystal doesn't do the work.

So a formula like this for grouping:

if {@TexttoNumber} < 50000000 then &quot;Less than Expense&quot;
else
if {@TexttoNumber} in 50000000 to 89999999 then &quot;Expense&quot;
else
if {@TexttoNumber} > 89999999 then &quot;Over the Expense&quot;

Will construct a group for every possible combination.

If you do not want values other than 50000000 to 89999999 in the report, then add the following to the record selection formula:

{@TexttoNumber} < 50000000
or
{@TexttoNumber} > 89999999

Keep in mind that if you use variables in the formula Crystal will NOT pass SQL to the database.

Hope this helps.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top