Loving this Report. Starting a new Topic since I made some additions, to dicuss the small problem I have come across …
[Products:5,5, 3, 3, 3, 3, 3, 3, 3]
@{REPORT COST DETAILS:M.GroupCode.asc::,}
>Name|Portion|Qty|Sales|Cost|Cost%|PM%|PM|P%
>>GROUP|$1|||||||
{REPORT COST DETAILS:C.Name.asc,C.PortionName,
C.Quantity.Sum,
[([C.AvgPrice]*[C.Quantity]).Sum],
[([C.Cost]*[C.Quantity]).Sum],
[($5/$4)];#0.00 %;-#0.00 %,
[($4-$5)/$3];#0.00 %;-#0.00 %,
[($4-$5)];0.00,
[(($4-$5)/$5)];#0.00 %;-#0.00 %:M.GroupCode="$1"}
> |Totals|{REPORT COST DETAILS:C.Quantity.Sum,[([C.AvgPrice]*[C.Quantity]).Sum],[([C.Cost]*[C.Quantity]).Sum],[($3/$2)];#0.00 %;-#0.00 %,[($2-$3)/$1];#0.00 %;-#0.00 %,[($2-$3)];0.00,[(($2-$3)/$3)];#0.00 %;-#0.00 %:M.GroupCode=="$1"}
>>TOTALS||Qty|Sales|Cost|Cost%|PM%|PM|P%
> ||{REPORT COST DETAILS:C.Quantity.Sum,[([C.AvgPrice]*[C.Quantity]).Sum],[([C.Cost]*[C.Quantity]).Sum],[($3/$2)];#0.00 %;-#0.00 %,[($2-$3)/$1];#0.00 %;-#0.00 %,[($2-$3)];0.00,[(($2-$3)/$3)];#0.00 %;-#0.00 %}
[Groups:5, 3, 3, 3, 3, 3, 3, 3]
>Group|Qty|Sales|Cost|Cost%|PM%|PM|P%
{REPORT COST DETAILS:M.GroupCode.asc,
C.Quantity.Sum,
[([C.AvgPrice]*[C.Quantity]).Sum],
[([C.Cost]*[C.Quantity]).Sum],
[($4/$3)];#0.00 %;-#0.00 %,
[($3-$4)/$2];#0.00 %;-#0.00 %,
[($3-$4)];0.00,
[(($3-$4)/$4)];#0.00 %;-#0.00 %}
>>TOTALS|Qty|Sales|Cost|Cost%|PM%|PM|P%
> |{REPORT COST DETAILS:C.Quantity.Sum,[([C.AvgPrice]*[C.Quantity]).Sum],[([C.Cost]*[C.Quantity]).Sum],[($3/$2)];#0.00 %;-#0.00 %,[($2-$3)/$1];#0.00 %;-#0.00 %,[($2-$3)];0.00,[(($2-$3)/$3)];#0.00 %;-#0.00 %}
The problem exists in the 1st Table.
This is the line with the issue:
> |Totals|{REPORT COST DETAILS:C.Quantity.Sum,[([C.AvgPrice]*[C.Quantity]).Sum],[([C.Cost]*[C.Quantity]).Sum],[($3/$2)];#0.00 %;-#0.00 %,[($2-$3)/$1];#0.00 %;-#0.00 %,[($2-$3)];0.00,[(($2-$3)/$3)];#0.00 %;-#0.00 %:M.GroupCode=="$1"}
Specifically, this part:
[($2-$3)/$1];#0.00 %;-#0.00 %
I understand why this happens. The var $1
is “double-assigned”. First, it is assigned using @parmeterlist
, here:
@{REPORT COST DETAILS:M.GroupCode.asc::,}
But it can also act upon the Field List, here:
> |Totals|{REPORT COST DETAILS:C.Quantity.Sum,[([C.AvgPrice]*[C.Quantity]).Sum],[([C.Cost]*[C.Quantity]).Sum]
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$1 $2 $3
So it seems it is preferring the @parmlist
over the Field list when it comes to $1
, and being that it is non-numeric (it is a GroupCode), the calculation [($2-$3)/$1]
fails and returns 0
.
Any thoughts on a way to workaround this?