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!

Working formulas with null records

Status
Not open for further replies.

smibarb

Technical User
Jun 24, 2005
40
CA
I have a formula that, if the Count is null (no records) the formula should regard this as zero. If the count is not Null then the formula should use the count value.

I would like to use:

if IsNull (Count ({rslt_qc_t.rslt_type_id}))then "0" else Count ({rslt_qc_t.rslt_type_id})

however, the formula wants a string after else. How can I do this?

 
Try:

if IsNull (Count ({rslt_qc_t.rslt_type_id}))then 0 else Count ({rslt_qc_t.rslt_type_id})

Enclosing it in quotes in the first section stated that it was a string and you have to have the same data types in the IF and ELSE (no polymorphism here...).

-k
 
Remove the quotes from around the zero. Also I'm betting that you really wanted this at a group level, in which case you need to add the group field as a condition within the count, as in:

if IsNull (Count({rslt_qc_t.rslt_type_id},{table.groupfield}))then 0 else Count ({rslt_qc_t.rslt_type_id},{table.groupfield})

I think that:

count({rslt_qc_t.rslt_type_id},{table.groupfield})

...might have worked just as well though.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top