Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reports using temporary table running into each other?

Status
Not open for further replies.

vecjjk

Programmer
Mar 26, 2002
34
US
I have a method that uses a temporary table (PRNTSOFM.DB), along with the static tables, to print a report. The code is listed below. The user can activate this code for different data one after the other. When a large number of reports have built up, some reports are not printed, and most of the time, there will be a GPF generated. I believe that what is happening is that the temporary table is getting deleted before the previous report is finished using it. Is there any way to prevent a return from this method until the report is no longer using the temporary table? I already tried assigning the statement "rpt.print(PrintInfo_RPI)" to a logical value, but it didn't seem to help. I also tried using "printlock" report restart options, but that didn't work because the other tables used by the report can be locked by other users. I'd appreciate any help I can get. I did not write this method, and I'm not an expert with Paradox. Thanks !

method printServiceOrderForm(CONST ThisPremiseID_LI LONGINT,
CONST ThisServiceRequestID_LI LONGINT,
CONST CloseTcursors_L LOGICAL) LOGICAL
VAR
ReturnVal_L LOGICAL
Answer_TBL TABLE
ReportFile_S,ReqType_S STRING
prnoptions PRINTEROPTIONINFO
openinfo REPORTOPENINFO
PrintInfo_RPI REPORTPRINTINFO
rpt REPORT
ENDVAR

ReturnVal_L = False ;Assume problems

IF NOT Servcord_TC.isAssigned() THEN
IF NOT Servcord_TC.open(DataAlias_S + "SERVCORD") THEN
RETURN ReturnVal_L
ENDIF

IF IsTable(":pRIV:pRNTSOFM.DB") THEN
delete(":pRIV:pRNTSOFM.DB")
ENDIF

Answer_TBL = CREATE ":pRIV:pRNTSOFM.DB"
LIKE Servcord_TC
ENDCREATE

IF NOT Answer_TBL.isAssigned() THEN
errorShow("Unable to create Answer")
DEBUG()
ENDIF

Answer_TC.open(Answer_TBL)
Answer_TC.edit()
ENDIF

IF Servcord_TC.qLocate(ThisPremiseID_LI,
ThisServiceRequestID_LI) THEN

ReqType_S = "/" + Servcord_TC."NSR-REQ-TYPE" + "/"

SWITCH
CASE Search(&quot;/E/O/U/C/M/P/S/EW/OW/UW/&quot;,ReqType_S) <> 0:
;Electric service orders
ReportFile_S = &quot;:WRSSYS:R\\Mrktinpt-Elec.RSL&quot;
; Use constant to specify orientation.
prnOptions.Orientation = prnPortrait
PrintInfo_RPI.orient = PrintPortrait

CASE Search(&quot;/T/TR/T1/T1R&quot;,ReqType_S) <> 0:
ReportFile_S = &quot;:WRSSYS:R\\Mrktinpt-TSS.RSL&quot;
; Use constant to specify orientation.
prnOptions.Orientation = prnPortrait
PrintInfo_RPI.orient = PrintPortrait

OTHERWISE:
;Unknown type
msgInfo(&quot;Print List&quot;,
&quot;Request Type: &quot; + Servcord_TC.&quot;NSR-REQ-TYPE&quot; + &quot;\n\n&quot; +
&quot;Request type not found. Using Electric form.&quot;)

ReportFile_S = &quot;:WRSSYS:R\\Mrktinpt-Elec.RSL&quot;
; Use constant to specify orientation.
prnOptions.Orientation = prnPortrait
PrintInfo_RPI.orient = PrintPortrait
ENDSWITCH

Answer_TC.deleteRecord() ;Clear last record
Answer_TC.insertRecord(Servcord_TC)
Answer_TC.postRecord()

PrintInfo_RPI.Name = ReportFile_S
PrintInfo_RPI.MasterTable = &quot;:pRIV:pRNTSOFM.DB&quot;

if printerSetOptions(prnOptions) then
rpt.print(PrintInfo_RPI)
else
errorShow(&quot;Could not set printer options--Viewing instead.&quot;)

openinfo.name = ReportFile_S
openinfo.mastertable = &quot;:pRIV:pRNTSOFM.DB&quot;
openinfo.WinStyle = WinStyleDefault+WinStyleHidden

viewReport(openinfo)
sleep(50)
endIf

ReturnVal_L = True
ELSE
beep()
msgInfo(&quot;Print Service Order Form&quot;,
&quot;Premise ID: &quot; + ThisPremiseID_LI.string() + &quot;\n&quot; +
&quot;SO Request#: &quot; + ThisServiceRequestID_LI.string() + &quot;\n\n&quot; +
&quot;Unable to locate service order request.&quot;)
ENDIF

IF CloseTcursors_L THEN
Servcord_TC.close()
Answer_TC.close()
ENDIF

RETURN ReturnVal_L
endMethod
 
If you really think that's the problem, you can insert a sleep command before the delete. However, delete() fails if the table is locked or in use, so I really doubt that is it. The sleep still might help, as repetitive processing sometimes benefits from an inactivity period. The below code will create about a 2 second pause. You can try any number you want, but it's best to start high and work backwards.

sleep(2000)


Mac :)

&quot;Gurth a choth-en-America! Tôl acharn...&quot;


langley_mckelvy@cd4.co.harris.tx.us
 
Are these tables reasonably small? If so try inserting
PrintInfo_RPI.restartoptions = PrintFromCopy
just before
rpt.print(PrintInfo_RPI)
This will force Paradox to make a copy of ALL tables in on the report before the print. Therefore, the original tables can be deleted as the report is still printing. If your tables are large, PrintFromCopy will be a big overhead.

 
Thanks, both of you, for your input. I'll try the sleep command and see if it helps, and if the users will tolerate the delay. Regarding the PrintFromCopy, the tables are pretty large, and there are several tables involved. I will try it anyway in development, just to see what kind of overhead there is, but I suspect it will be large.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top