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

Grouping in intervals

Status
Not open for further replies.

swiss2007

Technical User
Aug 13, 2007
92
US
I have orderid, customer name and orderamt
1, abc, 950
2, abd, 500
3, abe, 450
4, abf, 1950
5, abg, 1200
6, abx, 2200
7, aby, 2500
8, abz, 2700
9, abxx, 2800
10, abzz, 3100

I want to pass one parameter number, 100 or 500 or 1000 so that the order amt results are grouped based on
parameter number.

For ex if I pass 500 as parameter, I want to see data grouped in 500`s

0 - 500
abd 500
abe 450

501 - 1000
abc 950

1001 - 1500
abg 1200

1501 - 2000
abf 1950

2001 - 2500
abx 2200
aby 2500

2501 - 3000
abz 2700
abxx 2800

3001 - 3500
abzz - 3100


If I pass 1000 as parameter, I want to see data grouped in 1000`s like

0 - 1000
abd 500
abe 450
abc 950

1001 - 2000
abg 1200
abf 1950

2001 - 3000
abx 2200
aby 2500
abz 2700
abxx 2800

3001 - 4000
abzz 3100

Any help is appreciated.
 
Swiss2007,

With a quick test I was able to group them in this manner, but I have not yet worked out the labeling.

To get the groupings, I used:
Code:
Int({Table.OrderAmt}/{?MyParameterField})

I know you can use some math and formula's to return the group labels, I just haven't got them written yet. I will post them once developed.

Hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Swiss2007,

The following seems to return the labels as defined, but missing ranges/groups are not generated for the report in this manner, only labels for those groups which have at least one Order within them.

{@GroupLabels}
Code:
IF {@NewFormulaField} = 0 THEN
(
    ToText({@NewFormulaField},0,"") & "-" & ToText({?MyParameterField}*({@NewFormulaField}+1),0,"")
) ELSE
(
    ToText(({?MyParameterField}*{@NewFormulaField})+1,0,"") & "-" & ToText({?MyParameterField}*({@NewFormulaField}+1),0,"")
)

Hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
Group on this formula:

//{@range}:
truncate({table.amt}/{?Interval})*{?Interval}

Then create a formula to add to your group header instead of the automatically generated groupname:

totext({@range},0)+" - "+totext({@range}+{?Interval}-1,0)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top