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

Use of IsNull Function

Status
Not open for further replies.

Jtreshan

Technical User
Jul 14, 2000
17
0
0
US
I have a report in which uses running totals of work done by certain agencies. In one week's report, because no work was done by a particular agency, the formulas for totals by that agency which are calculated by subtracting that agency's numbers from the total numbers shows a blank (because no work was done by that agency that week), but I want to show a zero. I discovered that I can use the IsNull function to identify the null fields, and also use that function to show a "0" in my report if the field is null. But I can't figure out how to write the code. I understand that if I simply put IsNull ({field}) = , if the field is null, the result will be true. But how do I also indicate that I want to produce a "0" in the report when the field is null? For my example, I total a field where the formula for the field is named "TotalArmyDays", and the report sums the field "WOPM2", using the record selection formula "({workorder.WOPM2}) in ["AR","AS","AP"]", so if there is a workorder during my range of dates that meets that criteria, that record is counted. I need to know how to make a zero appear in the report when there is no record that meets the criteria.

 
Under file, options, reporting tab, there is an option to convert null field values to default. Click that checkbox and re-run the report.

You can also use file-report options. File report options is for that one report, while file options is global.

Software Support for Sage Mas90, Macola, Crystal Reports, Goldmine and MS Office
 
the code for the formula would be something like

if not isnull({table.value}) then
{table.value}
else
0;

converting nulls to defaults can be used .... but can be a trap if the default changes for whatever reason....this is bulletproof from that aspect.

this format can also be used in totals as well

Hope this helps.....Jim

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top