Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recalc report every time a Detail Band line is printed.
Message
From
18/06/1999 00:43:25
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00231182
Message ID:
00231227
Views:
17
>David, can you call UDF from one of the detail band controls instead of using report variable? What calculation it supposed to do?
>
>Nick

Sorry, not familiar with term UDF. (Pretty new to VFP)

My goal is....Based on the value of a particular field, print an extra line.
If the field has the value the does not normally print the extra line, I still
want to print the extra line if the previous record caused two lines to be printed. More formally,

IF fval > X
print blank line
print record
nLines = 2
ELSE && fVal < X+1 so....
IF nLines = 2
print blank line
ENDIF
print record
nLines = 1
ENDIF

(Sorry the above isn't blocked with indents. UT removes my whitespace, even blanks)

Assuming X=9, some sample output

8
6
9

10

11

1
2
3


In the above logic, one must be able to revalue the variable nLines after a record is printed.

My solution was to put two additional controls on each print line. The first control is stretchable, has a constant value of chr(10), and is conditionally set to print only if fVal > X OR (vVal X because that branch of the OR clause doesn't depend on nLines)

The second control is simply set to nLines, but it is set to never print (I use
the condition .T. = .F.). The expression in the definition of the record variable nLines is IIF(fval>X,2,1). The problem is (I think!) that since the control is never printed, it's never evaluated, so I don't get the result I want when fval
I'm pretty sure I can achieve the desired results using Grouping, but if there really is a way to force the recalculation of a variable after each record is printed, this way seems a little simpler. (Besides, now its a challenge!)

Another way one could do this is if it is possible to reference a field in a record other than the one being printed, but being new to VFP, I have not yet found a way to reference fields of records not selected (either directly or by relation) by the current record pointer. Even if you have a way to do this, I'd still like to know how to cause a report variable to be recalculated each time a new record is printed in the detail band.
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Previous
Reply
Map
View

Click here to load this message in the networking platform