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

Conditional Grouping Calculation

Status
Not open for further replies.

sportdlockport

Technical User
Apr 13, 2005
38
US
I'm trying to perform a calculation for specific criteria within a defined group of data.

Example:
Field1 is the data for gouping.

If 78480 and 78478 in Field2 has the same value in Field1, then enter "Bundled" in Field3 on the same record line as 78480 from Field2. If 78480 and 78478 in Field2 does not have the same value in Field1, then enter "Separate" in Field3 on the same record line as 78480 from Field2.

Expected Results

Field1 Field2 Field3
1580 78480 Bundled
1580 78478
1580 93015
1580 78465
1582 78480 Separate
1583 78478
1583 80061
1584 78478

 
First insert a group on {table.field1}. You can suppress the group header and footer if you wish. Then create three formulas:

//{@values} to be placed in the details section and suppressed:
if {table.field2} = 78480 then 1 else
if {table.field2} = 78478 then 10000 else 0

//{@bundledornot}:
if sum({@values},{table.field1}) >= 10001 and
remainder(sum({@values},{table.field1}),10000) <> 0 then "Bundled" else "Separate"

//{@display} to be placed in the detail section:
if {table.field2} = 78480 then {@bundledornot} else ""

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top