| Navigation: Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:TempNameFunc ====== | ![]() ![]() |
Property of a REPORT which allows you to create your own names for the metafiles generated for the PREVIEW attribute by writing a callback function to supply the metafile name for each page of the report. The callback function must be a PROCEDURE which takes a single SIGNED parameter and returns a STRING.
To turn this on, you must assign the ADDRESS of your callback function to PROP:TempNameFunc. To turn it off, you must assign zero (0).
The report engine, when it is about to write a page of the report to disk, calls your procedure, passing it the page number, and uses the return value from your procedure as the name of the metafile (both on disk and in the PREVIEW attribute's QUEUE). The callback function must create the file to ensure that the name is available.
When using PROP:TempNameFunc, PROP:FlushPreview writes the metafiles to the printer but does not automatically delete them (you must clean them up yourself, whenever your program is finished using them).
Example:
MEMBER('MyApp')
MAP
PageNames PROCEDURE(SIGNED),STRING !Callback function prototype
END
MyReport PROCEDURE
MyQueue QUEUE !Preview queue
STRING(260)
END
Report REPORT,PREVIEW(MyQueue) !ReportDeclaration
END
CODE
OPEN(Report)
Report{PROP:TempNameFunc} = ADDRESS(PageNames) !Assign ADDRESS to property so the
! report engine calls PageNames to
! get the name to use for each page
!Report processing code goes here
Report{PROP:TempNameFunc} = 0 !Assign zero to property to turn off
Report{PROP:FlushPreview} = TRUE !Send the report to the printer
! and the .WMF files are still on disk
PageNames PROCEDURE(PageNumber) !Callback function for page names
NameVar STRING(260),STATIC
PageFile FILE,DRIVER('DOS'),NAME(NameVar),CREATE
Rec RECORD
F1 LONG
. .
CODE
NameVar = PATH() & '\PAGE' & FORMAT(PageNumber,@n04) & '.WMF'
CREATE(PageFile)
RETURN(NameVar)



