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!

Filter records using calculated field

Status
Not open for further replies.

capronton

MIS
Jun 28, 2013
159
US
I would like to filter out records that have a percent delta lower than .10
but the code below gives me the error:

"This formula cannot be used because it must be evaluated later. I've also tried the evaluation function "WhilePrintingRecords" and still does not work.

Can someone assist me with how to filter records using a calculated field?

not ({apc_correlated.vehicle_id} in 5001 to 5068) and
({apc_correlated.vehicle_id} < 10000) and
{apc_correlated.transit_date_time} in DateTime (2015, 04, 02, 00, 00, 00) to DateTime (2015, 04, 10, 00, 00, 00) and
{@percentDeltaTotal} > .10
 
Here's the @percentDeltaTotal formula:

If Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id}) = 0
then 0
else (Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id}) - Sum ({apc_correlated.offs}, {apc_correlated.vehicle_id}))/Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id})

Is there anyway I can use the result of this formula to filter out records?
 
In the Record Selection Formula, you can use

[tt]not ({apc_correlated.vehicle_id} in 5001 to 5068) and
({apc_correlated.vehicle_id} < 10000) and
{apc_correlated.transit_date_time} in DateTime (2015, 04, 02, 00, 00, 00) to DateTime (2015, 04, 10, 00, 00, 00)[/tt]

and use a Suppress formula in the Section Expert to filter records that have a percent delta lower than .10

[tt]{@percentDeltaTotal} >=.10[/tt]
 
Yes, I have tried suppressing the records in the section expert, but because I'm grouping on bus and want all records filtered for that bus some records that are greater than .10 are showing up and it's confusing. I want to be able to suppress or filter the entire group of records if percentDeltaTotal is less than .10

Any more ideas?

Thanks.
 
Let me work with the Suppressing idea a little more.

Thanks again Betty!
 
You could put the following in your GROUP selection formula:

(
If Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id}) = 0 then 0
else (Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id}) -
Sum ({apc_correlated.offs}, {apc_correlated.vehicle_id}))/Sum ({apc_correlated.ons}, {apc_correlated.vehicle_id})
) >= .10

Group selection can work with subtotals, but it can't work with formulas that use subtotals, so you have to repeat the logic.
Record selection can't do either.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Note that if you have any grand totals they will need to be done as running totals. Grand totals using summary fields are not reduced by group selection.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top