Greetings all,
I'm having an issue with my Web application. It's deployed
using Crystal Reports 8.0 Developer edition.
I have an RPT file with a relatively large number of
formulas (30+). I did not create this RPT file and I
loathe to change it as I am not very well versed in the
field. I also did not create the ASP to generate reports,
but inherited it too, so I am really speaking from what I
have gathered at looking at the code.
The Report designer wanted a switch to determine if they
should show a certain field as an average or a total.
Instead of making this switch a parameter as I was
expecting them to, they made it a formula, which stumped
me for an hour or so. As the product shipped, this formula
is set equal to false, which means the user always
generates this field in Averages. If the formula is set to
true then the field will be set to Totals.
Now the problem has arisen that there are a large number
of formulas in the Report, and when you use Crystal 8.0
with ASP you must reference the formulas by their index
number as opposed to by the formula name or id. I have no
idea what this formula number would be.
<!---------------- begin sample code ----------------------
--------->
if InStr(strReportName, "ThatOneReport.rpt") > 0 then
set MyFormula = session("oFFC").Item(20)
MyFormula.text = "'" & strHeader1 & "'"
set MyFormula = session("oFFC").Item(21)
MyFormula.text = "'" & strHeader2 & "'"
set MyFormula = session("oFFC").Item(22)
MyFormula.text = "'" & strHeader3 & "'"
set MyFormula = session("oFFC").Item(34)
MyFormula.text = "TRUE"
end if
<!---------------------- end sample code ------------------
-------->
Looking at the code, the previous ASP developer figured
out, somehow, that 20, 21, 22 are three headers at the top
of the report (strings). I don't know how he managed to
figure these index values out. The last two lines are my
doing of trying to find the "switch" formula to toggle
totals and averages. As the product was shipped to the
customer the RPT file just had the switch value hardcoded
to FALSE so it was always generated averages. Argh!
I started incrementally testing the index numbers, but
have not had success and it is extremely aggrevating and
time consuming. I may have hit upon the correct one, since
when I used a certain index the Crystal Viewer generated
an error that a Boolean expression was expected, which is
what I would expect to happen since this is a boolean
variable. So I guess my subquestion is that if, for
example, 34 is the correct formula index, but is looking
for a boolean, what is the method to pass it a boolean
value?
I tried:
MyFormula.bool = TRUE
and
MyFormula.boolean = TRUE
both of which generated ASP errors as being incorrect
methods for MyFormula.
So, what's the secret to finding out which formula indexes
are which (I read on a website that the numbers are
generated as the formulas are added to the Report, which
doesn't help me since the person who generated the report
is long gone as well)? And the inevitable subquestion,
once I had the index, how do I set the boolean formula =
TRUE or = FALSE?
Thanks so much,
Matt Fuerst