Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REPORT FORM TO FILE xxx ASCII discovery
Message
From
14/02/2006 11:50:25
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
REPORT FORM TO FILE xxx ASCII discovery
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01096211
Message ID:
01096211
Views:
76
I think I found an answer to the age old problem of mangled columns when using REPORT FORM TO FILE xxx ASCII.

In summary, the fields have to be stored in FRX in right to left order. Here is code to do that.
lcFileFrom = 'reports.bak\xxxx.frx'
lcFileTo   = 'reports\xxxx.frx'
SELECT *,SPACE(13) AS cOrder ;
  FROM (lcFileFrom) ;
  INTO CURSOR Temp READWRITE

REPLACE cOrder WITH '1'+TRANSFORM(RECNO(),'@L 999999') FOR INLIST(ObjType,1,2,3,4,9,10)
REPLACE cOrder WITH '2'+TRANSFORM(999999 - HPos,'@L 999999') FOR INLIST(ObjType,5,6,7,8)
REPLACE cOrder WITH '3'+TRANSFORM(RECNO(),'@L 999999') FOR ObjType > 20

SELECT * ;
  FROM Temp ;
 ORDER BY cOrder ;
  INTO TABLE (lcFileTo)
USE

ALTER TABLE (lcFileTo) DROP COLUMN cOrder
USE IN (JUSTSTEM(lcFileFrom))
USE IN (JUSTSTEM(lcFileTo))
USE IN Temp
Alex
Next
Reply
Map
View

Click here to load this message in the networking platform