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!

Displaying hard-coded range

Status
Not open for further replies.

crystaln00b

Programmer
Aug 10, 2005
23
US
hi all,

first post here.

I'm very new to crystal, so i don't know the full power of the application, especially from a formula perspcctive.

I am trying to setup a report that displays ranges not pulled from a database, but hard coded. For example:

100-200
201-300
301-400 etc.

I was wondering what is the best method to display this. And i also would like to setup the report that each range could be evaluated to show if a certain account was located in the range and display number of account in the range beside the range. those would be pulled from the database.

i hope there is a simple solution, because i am stuck.

thanks

n00b
 
Create a formula like the following in the formula expert (field explorer->formula->new:

if {table.acct} in 100 to 200 then "100-200" else
if {table.acct} in 201 to 300 then "201-300" else
if {table.acct} in 301 to 400 then "301-400" else//etc.

If {table.acct} is a string instead of a number, change the formula to enclose the values in quotes, as in:

if {table.acct} in "100" to "200" then "100-200"//

Then insert a group on this formula. You can then place {table.acct} in the detail section and right click on it and insert a count at the group level to get the count per range.

-LB
 
this solution works if there is an account in that range, if there isn't one, it is skipped over and nothing is displayed...

i need to have the range (100-200) displayed even if there isn't an account in that range. i've tried loops but i am confused how to optimally use loops in formulas.

i've thought to use if..then.else statements in order to for example, if {account.table} in 100 to 200 then "100-200" else "100-200". this seems to get the disired reults however, when i put a group on it, "100-200" is displayed however many records are in the table

i'm thinking of it from a programming standpoint and it seems easy, but i haven't been able to come up with a solution.

some general info, i need to display ranges in increments of 100 e.g. 100-200, 201-300.......9,001-10,000.

thanks for the help so far

n00b
 
Are these to be your column headers, or row labels, or what?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
I think that you'll need to manually handle this, or I would do this by creating a View something like:

select distinct groups from table

Add that to the report, then join your current data sources as a Left Outer to this View, where the View becomes the main table.

-k
 
cool, is there an easy way to ensure that the rox labels line up correctly with the other fields?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top