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

Zero records - formula still counting 1

Status
Not open for further replies.

CrystaLv

Technical User
May 12, 2006
121
US
I have a strange question.
My formula CountOrd counting orders
if isnull({vw.DPT}) then 1 else 0

So when Report comes up with zero records - formula showing 1 anyway.

I wrote another formula
If not isnull ({vw.ID}) then {CountOrd}

ID is the field Report can not be without. So it still comes up as 0. I do not want to see anything. But when adding else "" - error comes up that it has to be a number.

Please, look into this for me.
Thanks
 
Hi,
No records will mean that
if isnull({vw.DPT}) then 1 else 0
will show 1 as requested ( vw.DPT IS NULL when no records are returned)

Try:
if not (isnull({vw.DPT})) then 1 else 0
to get a 1 for any Non-Null record and supress displaying it, if = 0





[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
The else "" returns an error because you can't return 2 different data types in the same formula, you could use Turk's method or:

If not isnull ({vw.ID}) then
totext({CountOrd})
or
""

-k
 
The problem is i need it to be
if isnull({vw.DPT}) then 1 else 0
because it how it suppose to calculate orders to displa

If DPT is null and Q = "Complete" then I want 1. Then I am summarising those 1s.

I will try 'to text' though. Thanks

 
Hi,
It is confusing..you want to count those vw.DPT that are NOT there? Then use:

If ( IsNull(vw.DPT) and Q = "Complete" )
then 1
else
0

Sum that formula to get the count of those who match.
The Formula need not be displayed and the 0 will not affect the sum.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
To "count" via a 1-or-0 formula, you must SUM (not count) that formula.

- Ido

Visual CUT & DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
I have this data
Contract Order Stage
1 12 Complete
1 12 NC
1 13 Complete
1 13 NA
1 14 NC


2 10 <NULL>
2 11 <NULL>

3 20 <NULL>

So if Stage IsNull I need this Order to be included in calculation. Also those that are Complete. This is where weird formula starts. Then I am grouping and supressing 0s.

It all working except when records are none - 0 or 1 gets displayed.
 
Hi,
Ok, now you have changed the field names to make it even harder to understand what you really need to do.
Given your latest version, create a formula:
@CountIt
Code:
If (
IsNull({Stage}) or Trim({Stage}) = "" or {Stage} = "Complete" 
)
then 1
else
0
Group on {Contract}, place this formula in your details, SUM it, but do not display the formula , just the SUM in the GF.


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
YES! Formula exactly. But I do not need SUM.I am off to cont figuring it out. Problem is that request changing every day. Oh, well. Thanks a lot.
 
Hi,
If SUM is not needed, please explain what you meant by:

Then I am summarising those 1s.


Thanks..

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top