* Scrub a report. * Changes: * 05/jan/2009 pdv lparameter tcFile Local oldSele, lcMsg, lcExpr, lcExpr1, lnOrientation local lcFile, lnFnd local array laFile[1] do case case pcount() = 0 or empty( m.tcFile ) or vartype( m.tcFile ) # 'C' * tcFile = GetParm() * if empty( m.tcFile ) RETURN endif endcase lcFile = fullpath( m.tcFile ) lnFnd = adir( laFile, m.lcFile ) do case case m.lnFnd = 0 * msgbox( "Report not found: " + m.lcFile ) case "R" $ laFile[ 1, 5 ] * msgbox( "Report is ReadOnly: " + m.lcFile ) otherwise oldSele = select() lcMsg = '' Select 0 Use ( m.lcFile ) ALIAS ReportFRX lcMsg = lcMsg + chr(13) + chr(9) + alltrim( m.lcFile ) if isReadOnly() * lcMsg = lcMsg + ' (Failed: R/O)' else lcExpr1 = "COPIES=1" * scan for Objtype = 1 && will imply one (DOS or WINDOWS) or two (DOS and WINDOWS) records * lnOrientation = ATC("ORIENTATION", ReportFRX.Expr) * If lnOrientation > 0 * lcExpr = lcExpr1 + ; chr(13) + ; "ORIENTATION" + ; SUBSTR(ReportFRX.Expr, ; lnOrientation + 11, 02 ) else lcExpr = m.lcExpr1 endif * replace ; ReportFRX.Expr WITH lcExpr, ; ReportFRX.TAG WITH '', ; ReportFRX.TAG2 WITH '' endscan endif Use IN ReportFRX Select ( oldSele ) msgbox( "Report file scrubbed: " + lcMsg ) endcase FUNCTION msgbox( tcMsg ) messagebox( m.tcMsg, 0+16, "Scrub Report", 5000 ) RETURN FUNCTION GetParm local lcInput, lnFnd, llRepDir if adir( laDir, "report", "D" ) = 1 lnFnd = adir( laFrx, "report\*.frx" ) llRepDir = .t. else lnFnd = adir( laFrx, "*.frx" ) endif lnFnd = adir( laFrx, "*.frx" ) do case case m.lnFnd = 0 lcInput = space( 50 ) case m.lnFnd = 1 lcInput = padr( laFrx[ 1, 1 ], 50 ) otherwise lcInput = padr( ".frx", 50 ) endcase define window GetParm from mrow(), mcol() to mrow() + 10, mcol() + 63 system noclose nogrow nozoom title "Specify report to scrub" move window GetParm center activate window GetParm @ 6, 3 say "Report:" @ 7, 3 get lcInput read if lastkey() = 27 lcInput = '' endif release window GetParm activate window Command RETURN alltrim( m.lcInput )