Export in presort order with all fields + presort field

All things related to the Script feature of AccuZIP6, including the Script Monitor.

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
User avatar
Eric
Moderator
Posts: 1910
Joined: Tue Sep 19, 2006 3:29 pm
Contact:

Export in presort order with all fields + presort field

Post by Eric » Tue Sep 15, 2009 12:18 pm

When you want to export your data in presort order within a script, exporting all of your input file's fields in addition to the presort fields, you can use this command as an alternative to using the File > Export feature. The Export requires you to create an export map. But if your lists will have varying fields from list to list, an export map won't work. The command below replaces the Export event.

Code: Select all

* Current Database
com_Alias=ALIAS()

* Presort Database
com_PresortData=FORCEEXT(DBF("_azqualification"),"prt")

* Open and Export all fields in Presorted Database
USE (com_PresortData) IN 0 ALIAS _presortdata AGAIN SHARED
SELECT("_presortdata")
COPY TO (FORCEEXT(DBF("_azqualification"),"txt")) TYPE CSV
USE IN IIF(USED("_presortdata"),SELECT("_presortdata"),0)

* Select Current Database
SELECT(com_Alias)
If you want to specify the path and name of the file and export it as an AccuZIP6 database file, use this command instead:

Code: Select all

* Current Database
com_Alias=ALIAS()

* Presort Database
com_PresortData=FORCEEXT(DBF("_azqualification"),"prt")

* Open and Export all fields in Presorted Database
USE (com_PresortData) IN 0 ALIAS _presortdata AGAIN SHARED
SELECT("_presortdata")
COPY TO ("C:\Program Files\AccuZIP6 5.0\Demo\presorted file.dbf")
USE IN IIF(USED("_presortdata"),SELECT("_presortdata"),0)

* Select Current Database
SELECT(com_Alias)
If you want to put a hard coded path:

Code: Select all

COPY TO ("FullPath") TYPE CSV
To output as AccuZIP6 5.0 Database:

Code: Select all

COPY TO ("FullPath")
To output as dBase II

Code: Select all

COPY TO ("FullPath") TYPE FOX2X
Chat with an AccuZIP6 technician weekdays from 7-4 PST with AccuZIP6 Live Online Support

Post Reply