Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Topic: Is it time to use a variable in this case? Posted: 08 Jun 2009 at 8:42am
I have a report whose purpose is to show a summary of several fees by project. Because each fee may have more than one record attached to it, I have had to move all the fields into the G3 footer and run maximums on a running total to avoid the project showing up as many times as there are fees attached to it. Well, I had the report developed and working properly and then they threw another wrench in it. One field was supposed to be a maximum of a field named "ManagementFee." The formula for calculating this is: If ({Meetings_ManagementFee.ManagementFeeCatID}=1) then {Meetings_ManagementFee.Actual} else $0.00
Well, now they want to add in several more ManagementFeeCatID's to the original ManagmentFee. So, I wrote a formula for each of the categories, exactly as above, only changing the catID #.
When I go to add them all together in a separate formula, the formula stops evaluating at the first null one it hits, thereby making the result incorrect in the running total, since it may be missing one or more fee category results.
I tried setting the report to convert the null values to default, but it doesn't work. I have no first hand experience with variables, but google is telling me I need to use them to set the formulas to $0 to get the maximum formula to evaluate all 13 categories. Is this correct and if so, how do I write and use the variable?
I'm sorry this is so long; any help is appreciated!
Joined: 23 Apr 2009
Location: United States
Online Status: Offline
Posts: 54
Posted: 08 Jun 2009 at 3:32pm
Originally posted by hilfy
Try this in the formulas:
If IsNull({Meetings_ManagementFee.ManagementFeeCatID})
then $0.00
else If ({Meetings_ManagementFee.ManagementFeeCatID}=1) then {Meetings_ManagementFee.Actual} else $0.00
This will convert you're nulls to zero in the formula and should prevent the problem you're seeing.
-Dell
Thanks for your quick reply. I'm not sure how nullifying the managementfeecatID would help, since I am looking to fix the null Actual fields in each of the managementfeecatID formulas. Can you explain further? Thanks!
Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Posted: 09 Jun 2009 at 7:24am
In databases (and other code as well) a comparison against null returns null, not True or False, so you have to explicitly check for null. This statement does the following:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum