Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Crosstab format field formula help

$
0
0

I have a Crystal Report with a crosstab with a format field formula that generates correct totals.  However, this report and formula are based on an array.

 

I needed to redesign this report without using a subreport or an array, so I redesigned the formula, trying to take out "all the array pieces".

 

The new report is working great except that my totals for "EMR", "Paper", and "Total" are incorrect (amount is too low).

 

 

 

Here is the original formula with the array:

 

if GridLabelAt("@while",CurrentColumnIndex) = "Paper Points" then

(

whileprintingrecords;

shared stringvar osrt;

stringvar array oa:= split(osrt,'||');

stringvar t:= '';

numbervar r;

r:= r + 1;

t:= split (oa[r],'|')[2];

totext(tonumber(t),0)

)

else if GridLabelAt("@while",CurrentColumnIndex) = "Total" then

(

whileprintingrecords;

shared stringvar osrt;

stringvar array oa:= split(osrt,'||');

stringvar t:= '';

numbervar s;

numbervar pats;

s:= s + 1;

t:= split (oa[s],'|')[2];

pats :=  (GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex) + tonumber(t));

totext(GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex) + tonumber(t),0);

)

else if GridLabelAt("@while",CurrentColumnIndex) = "Percentage EMR" then

(

whileprintingrecords;

shared stringvar osrt;

stringvar array oa:= split(osrt,'||');

stringvar t:= '';

numbervar u;

local numbervar adds;

u:= u + 1;

t:= split (oa[u],'|')[2];

adds := GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex) + tonumber(t);

    totext((GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex)/adds)*100)&"%";

)

else if GridLabelAt("@while",CurrentColumnIndex) = "Percentage Paper" then

(

whileprintingrecords;

shared stringvar osrt;

stringvar array oa:= split(osrt,'||');

stringvar t:= '';

numbervar v;

local numbervar x;

v:= v + 1;

t:= split (oa[v],'|')[2];

x := tonumber(t);

local numbervar adds := GridValueAt(CurrentRowIndex, CurrentColumnIndex-4, CurrentSummaryIndex) + x;

    totext((x/adds)*100)&"%";

)

else

totext(CurrentFieldValue,0)

 

 

 

 

Here is my new formula which I took the "array" pieces out of:

 

 

if GridRowColumnValue("@ChartLocation", CurrentColumnIndex) IN ["%EMR","%Paper"]

then

(

    if GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex) = 0 then

    '0'

else

    totext((GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex)/GetTotalValueFor("@ChartLocation")) * 100,2) & "%"

)

else if GridLabelAt("@ChartLocation",CurrentColumnIndex) = "Total" then
(
whileprintingrecords;
stringvar t:= '';
numbervar s;
numbervar pats;
s:= s + 1;
pats :=  (GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex));
totext(GridValueAt(CurrentRowIndex, CurrentColumnIndex-2, CurrentSummaryIndex),0);
)

else

    totext(CurrentFieldValue,0)

 

 

What needs to be changed to make the new formula give me correct numbers?

 

Thanks.


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>