This is sort of a long post, but the issue I'm experiencing requires such an explanation.
Premise:I'm building a report which will track the backlog of help desk tickets from month to month (those that don't get closed during the same month) and trying to keep a total of them throughout a year, doing this for each month would be simple but doing it for a year requires a few formulas which I felt were easy and like I coded perfectly but I'm getting some WEIRD behavior.
Database Fields:INCIDENT_ID
OPEN_INCIDENT_TIME
CLOSE_INCIDENT_TIME
Running Total Fields (
these are just for housekeeping while I make the report):
Opened (tracks how many tickets opened in a month)
Closed (tracks how many tickets closed in a month)
Formula Fields (in order that they are called):Name: @array_declare (placed in report header)
Placement: Report Header
Function: Creates an array
BeforeReadingRecords;
Global StringVar Array Backlog;
Backlog := ["0"];
"";
Name: @left over
Placement: details
Function: Checks to see if incident opens and closes in same month, reports true or false
EvaluateAfter ({@array_declare});
cStr (Month ({INCIDENTSM1.OPEN_TIME})) <> cStr (Month ({INCIDENTSM1.CLOSE_TIME}))
Name: add_to_array
Placement: details
Function: If @left over is true then add a concatenate of the month/year in string form to Backlog
EvaluateAfter ({@Left Over});
Global StringVar Array Backlog;
If {@left over} = TRUE
Then
(Redim Preserve Backlog[UBound(Backlog) + 1];
Backlog[UBound(Backlog)] := {@close_conc};
);
Name: counter
Placement: details
Function: Counts the number of backlogs in array. First for loop replaces any backlog that will expire that month with a "0". Second for loop counts all array elements that are not "0". Outputs 'Blog'.
EvaluateAfter ({@add_to_array});
Global StringVar Array Backlog;
Global NumberVar i;
Global NumberVar L;
Global NumberVar Blog;
Blog := 0;
L := Ubound(Backlog);
For i := 1 To L Do
(
If Backlog = {@open_conc} Then
Backlog := "0"
);
For i := 1 To L Do
(
If Backlog <> "0" Then
Blog := Blog + 1
);
Blog;
Name: @UBound
Placement: details
Function: Outputs the scope of the array (used for hosekeeping)
EvaluateAfter ({@add_to_array});
Global StringVar Array Backlog;
Ubound(Backlog);
Name: @open_month
cStr(Month ({INCIDENTSM1.OPEN_TIME}))
Name: @open_year
cStr(Year ({INCIDENTSM1.OPEN_TIME}))
Name: @open_conc
{@open_month}&{@open_year}
Name: @close_month
cStr(Month ({INCIDENTSM1.CLOSE_TIME}))
Name: @close_year
cStr(Year ({INCIDENTSM1.CLOSE_TIME}))
Name: @close_conc
{@close_month}&{@close_year}
Results:
The report outputs and looks fine at first...
See: http://designee.net/1.jpg
The counter resets the tickets that have been solved and the ubound keeps growing, this is expected.
On the 4th page of the report is where things go wrong...
See: http://designee.net/2.jpg
The counter drops and the ubound grows out of nowhere, this behavior continues randomly through the report...
See: http://designee.net/3.jpg
By this time the report is screwed, the counts are off by a mile and the report is useless.
Now here's the kicker... If I refresh the report I get a whole new garbled report...
See: http://designee.net/4.jpg
But if I edit a formula such as @close_month and remove a space (or change anything!) the report goes back to "normal" (1.jpg).
I am by no means a crystal reports expert but I would assume if a formula was working in one part of the report it would work the whole way through... what the heck is going on!?!?!
Any light anyone can shed will be greatly appreciated!!!