G
Guest
I need to get a sum in a group footer in a report, I wrote a public function
in the module, and wrote an expression to check the condition and calculate:
=Sum((IIf(If_Instrument([ItemNumber])=1,[Jan_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jan_D],0)+IIf(If_Instrument([ItemNumber])=1,[Feb_F],0)-IIf(If_Instrument([ItemNumber])=1,[Feb_D],0)+IIf(If_Instrument([ItemNumber])=1,[Mar_F],0)-IIf(If_Instrument([ItemNumber])=1,[Mar_D],0)+IIf(If_Instrument([ItemNumber])=1,[Apr_F],0)-IIf(If_Instrument([ItemNumber])=1,[Apr_D],0)+IIf(If_Instrument([ItemNumber])=1,[May_F],0)-IIf(If_Instrument([ItemNumber])=1,[May_D],0)+IIf(If_Instrument([ItemNumber])=1,[Jun_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jun_D],0)+IIf(If_Instrument([ItemNumber])=1,[Jul_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jul_D],0)+IIf(If_Instrument([ItemNumber])=1,[Aug_F],0)-IIf(If_Instrument([ItemNumber])=1,[Aug_D],0)+IIf(If_Instrument([ItemNumber])=1,[Sep_F],0)-IIf(If_Instrument([ItemNumber])=1,[Sep_D],0)+IIf(If_Instrument([ItemNumber])=1,[Oct_F],0)-IIf(If_Instrument([ItemNumber])=1,[Oct_D],0)+IIf(If_Instrument([ItemNumber])=1,[Nov_F],0)-IIf(If_Instrument([ItemNumber])=1,[Nov_D],0)+IIf(If_Instrument([ItemNumber])=1,[Dec_F],0)-IIf(If_Instrument([ItemNumber])=1,[Dec_D],0))*[StandardCost])
as you can see, it's a long long expression, and the function If_Instrument
is what I wrote in the module, this works, but it would take me 10 minutes to
get the result, is there a better way to do it? the point is I need to judge
the item number which is in the detail part.
Thanks a lot in advance!
in the module, and wrote an expression to check the condition and calculate:
=Sum((IIf(If_Instrument([ItemNumber])=1,[Jan_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jan_D],0)+IIf(If_Instrument([ItemNumber])=1,[Feb_F],0)-IIf(If_Instrument([ItemNumber])=1,[Feb_D],0)+IIf(If_Instrument([ItemNumber])=1,[Mar_F],0)-IIf(If_Instrument([ItemNumber])=1,[Mar_D],0)+IIf(If_Instrument([ItemNumber])=1,[Apr_F],0)-IIf(If_Instrument([ItemNumber])=1,[Apr_D],0)+IIf(If_Instrument([ItemNumber])=1,[May_F],0)-IIf(If_Instrument([ItemNumber])=1,[May_D],0)+IIf(If_Instrument([ItemNumber])=1,[Jun_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jun_D],0)+IIf(If_Instrument([ItemNumber])=1,[Jul_F],0)-IIf(If_Instrument([ItemNumber])=1,[Jul_D],0)+IIf(If_Instrument([ItemNumber])=1,[Aug_F],0)-IIf(If_Instrument([ItemNumber])=1,[Aug_D],0)+IIf(If_Instrument([ItemNumber])=1,[Sep_F],0)-IIf(If_Instrument([ItemNumber])=1,[Sep_D],0)+IIf(If_Instrument([ItemNumber])=1,[Oct_F],0)-IIf(If_Instrument([ItemNumber])=1,[Oct_D],0)+IIf(If_Instrument([ItemNumber])=1,[Nov_F],0)-IIf(If_Instrument([ItemNumber])=1,[Nov_D],0)+IIf(If_Instrument([ItemNumber])=1,[Dec_F],0)-IIf(If_Instrument([ItemNumber])=1,[Dec_D],0))*[StandardCost])
as you can see, it's a long long expression, and the function If_Instrument
is what I wrote in the module, this works, but it would take me 10 minutes to
get the result, is there a better way to do it? the point is I need to judge
the item number which is in the detail part.
Thanks a lot in advance!