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

Count records where text = " " ...

Status
Not open for further replies.

lutzs

Programmer
Oct 8, 2002
75
LU
Hi!

I will count all records where field_6 = "Text" or "Text2".

I have this formula:
if ({F6}= "TEXT1" or {F6}="TEXT2") then 1
It works fine but I will count this records.

What can I do?

Thanks, Stephanie
 
Stephanie,

Your query isn't 100% clear to me, but from what I can gather you should be able to achieve what you want if you create a running total set to count, and apply the condition:

UCase({F6}) in ["TEXT1","TEXT2"]

Naith
 
Please clarify what you want to do.

Are the values 'text' and 'text2', or are they 'text1' and 'text2'.

Do you want to count null values, or are they being counted and you do not want to count them?

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
what about using a global variable to count the matching entries?
Supposing that your formula is placed in the detail-section of your report you could modify it like this:

global numbervar counter;
whileprintingrecords;
if ({F6}= "TEXT1" or {F6}="TEXT2") then counter:=counter+1;

I'll name this formula {@inc}.

Then create a second formula (which contains the total) that is likely to be placed in the report footer. It should look like this:

global numbervar counter;
evaluateafter({@inc});
counter;

That should do the trick. When working with groups, the solution may vary but the idea should be about the same.

 
Hi,

thanks for your help. The suggestion of Naith is great.
It work's fine. But just in the details section. When I put the runningtotal field in the report header, the value is 0.

Your questions:
Sorry, the values are "text1" and "text2".
I don't want to count null values.

Thanks, Stephanie
 
You can't put a running total in the report header as the value is generated as it runs through the report.

To get the total in the report header, you need to go back to how you were going to do it in the first place.

create a formula :

If UCase({F6}) in ["TEXT1","TEXT2"] then 1 else 0

place this in the detail. right click, insert, summary, then sum the field.

you can now delete the formula from the detail.


Reebo
Scotland (Sunny with a Smile)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top