VA FileMan V. 22.0 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Import and Export Tools API


EXPORT^DDXP: Data Export

This procedure exports data from VA FileMan files into ASCII host files. Each entry in a specified FileMan file is stored as a line of data in the host file.

For additional information about the Import and Export Tools, see the "Import and Export Tools" chapter of the "VA FileMan Advanced User Manual."

Format
D EXPORT^DDXP(FILE,EXPORT_TEMPLATE,DELETE_FLAG,
SORT_TEMPLATE,[.]FR,[.]TO,.DIS,[.]DISTOP,IOP,DQTIME)
Input
FILE

(Required) File number from the file where the data to be exported is located.

NOTE: A special case occurs when exporting data from file number 1.1, the AUDIT file. In this case, FILE then becomes "1.1^<file number of the audited file>". For example, if the audited data is associated with the PATIENT file, then the string would look like: "1.1^2".

EXPORT_TEMPLATE

(Required) The name of the export template, without the surrounding brackets "[]", that was created when the developer used the option: CREATE EXPORT TEMPLATE.

DELETE_FLAG

(Optional) Indicates whether or not the export template should be deleted when exporting of the data is finished.

It has two possible values:

0 (zero) Do NOT delete the export template when the export has finished. Default.
1 DELETE the export template when the export has finished.
SORT_TEMPLATE

(Optional) The name of the sort template, without the surrounding brackets "[]", that will be used for file sorting. If this parameter is Null, then the user will see the standard FileMan Sort dialog.

[.]FR

(Optional) The START WITH: values of the SORT BY fields. If FR is undefined, the user will be asked the START WITH: question for each SORT BY field. If FR is defined, it consists of one or more comma pieces, where the piece position corresponds to the order of the sort field in the BY variable.

Passed by reference.

The details of this parameter are identical to those of the FR input variable of the Classic FileMan print routine EN1^DIP. For additional information, see that description.

[.]TO

(Optional) The GO TO: values of the SORT BY fields. Its characteristics correspond to the FR variable. If undefined, the user will be asked the GO TO: questions for each SORT BY field. If TO is defined, it consists of one or more comma pieces.

Passed by reference.

The details of this parameter are identical to those of the TO input variable of the Classic FileMan print routine EN1^DIP. For additional information, see that description.

.DIS

(Optional) You can screen out certain entries so that they do not appear on the output by setting the optional array DIS. The first subscript in this array can be 0 (zero). This variable (as well as all the others) contains an executable line of M code which includes an IF-statement.

Passed by reference.

The details of this parameter are identical to those of the DIS (0) and DIS(n) input variables of the Classic FileMan print routine EN1^DIP. For additional information, see that description.

[.]DISTOP

(Optional) If Kernel is present, by default prints queued through the EN1^DIP call can be stopped by the user with a TaskMan option. However, if this variable is set to 0, users will not be able to stop their queued prints.

Passed by reference.

The details of this parameter are identical to those of the DISTOP input variable of the Classic FileMan print routine EN1^DIP. For additional information, see those descriptions.

IOP

(Optional) EXPORT^DDXP calls the ^%ZIS entry point to determine which device output should go to. This requires user interaction unless you pre-answer the DEVICE prompt. You can do this by setting IOP equal to the name of the device (as it is stored in the DEVICE file) to which the output should be directed.

Passed by reference.

The details of this parameter are identical to those of the IOP input variable of the Classic FileMan print routine EN1^DIP. For additional information, see that description.

DQTIME

(Optional) If output is queued, this variable contains the time for printing. You can set it equal to any value that %DT recognizes.

Passed by reference.

The details of this parameter are identical to those of the DQTIME input variable of the Classic FileMan print routine EN1^DIP. For additional information, see that description.

Output Parameters

None

Examples

See examples below for ways to use EXPORT^DDMP.

Note that in all examples, the DELETE_FLAG is null, i.e., 0 (zero).

Example 1

In this example, no sort template is provided and the user is asked sort dialog.

    D EXPORT^DDXP(2,"ZZS0 SKIP TEST")
    SORT BY:  NAME//
    START WITH NAME:  FIRST//
    DEVICE:

Example 2

In this example, a sort template is provided.

    D EXPORT^DDXP(2,"ZZS0 SKIP TEST",,"ZZS0 TEXPORT #1") 

    *Previous selection: DATE ENTERED INTO FILE from Jan 1,1997 to Jun 4,1999 
    START WITH DATE ENTERED INTO FILE: FIRST// 1/1/97  (JAN 01, 1997) 
    GO TO DATE ENTERED INTO FILE: LAST// T  (JUN 07, 1999) 
    DEVICE: 

Example 3

In this example, a sort template is provided and the FROM and TO values are supplied.

    S FR="1/1/97" 
    S TO=DT 
    D EXPORT^DDXP(2,"ZZS0 SKIP TEST",,"ZZS0 TEXPORT #1",FR,TO) 
    DEVICE: 

Example 4

This example shows the special case of the AUDIT file.

Because users may want to export information from the AUDIT file (1.1), a special case has been created. All parameters that are to be passed remain the same as abovve, EXCEPT for the FILE parameter. In this special case, the format is as follows:

    FILE "1.1^<file number of audited file>"

Here is an example:

    D EXPORT^DDXP("1.1^16200","ZZSO",,"ZZS0 AUDIT") 
 
    Previous selection: DATE/TIME RECORDED from Jan 1,1997 to Dec 31,1997@24:00 
    START WITH DATE/TIME RECORDED: FIRST// 1/1/97   (JAN 01, 1997) 
    GO TO DATE/TIME RECORDED: LAST// 12/31/97  (DEC 31, 1997@24:00)  
    DEVICE: 
 

Example 5

This example shows a sample sort template, export template, and routine.

In this example, we want to use Microsoft Word Mail Merge to send a brochure to the new patients who visited the Medical Center in the previous month. For purposes of illustration we are going to assume the month was March of 2000.

Sort Template Used:

    NAME: ZZSO NEW PATIENTS// 
    READ ACCESS: @// 
    WRITE ACCESS: @// 
    SORT BY: ]NAME//   
     * Previous selection: NAME not null 
     START WITH NAME: FIRST// 
      WITHIN NAME, SORT BY: DATE ENTERED INTO FILE  Replace   
     * Previous selection: DATE ENTERED INTO FILE from Feb 1, 2000 to Feb 29,
     2000 
      START WITH DATE ENTERED INTO FILE: FIRST// 3/1/00  (MAR 01, 2000) 
      GO TO DATE ENTERED INTO FILE: LAST// 3/31/00  (MAR 31, 2000) 
        WITHIN DATE ENTERED INTO FILE, SORT BY: 
     STORE IN 'SORT' TEMPLATE:    ZZSO NEW PATIENTS  
          (Jun 17, 1999@05:14) User #9152 File #2    SORT 
    DATA ALREADY STORED THERE....OK TO PURGE? NO// YES 
     DESCRIPTION: 
      1>Get previous month's New Patients for mass marketing mailing.  
     EDIT Option: 
 
     SHOULD TEMPLATE USER BE ASKED 'FROM'-'TO' RANGE FOR 'DATE ENTERED INTO 
     FILE'? NO// YES 

Export Template Used:

    NAME: ZZSO PATIENT ADDRESS X 
     DATE CREATED: JUN 17, 1999@08:26 
     READ ACCESS: @                        FILE: PATIENT 
     USER #: 9152                          WRITE ACCESS: @ 
     DATE LAST USED: MAR 01, 2000          TEMPLATE TYPE: EXPORT 
    FIELD ORDER: 1                          DATA TYPE: FREE TEXT 
    FIELD ORDER: 2                          DATA TYPE: FREE TEXT 
    FIELD ORDER: 3                          DATA TYPE: FREE TEXT 
    FIELD ORDER: 4                          DATA TYPE: FREE TEXT 
    FIELD ORDER: 5                          DATA TYPE: FREE TEXT 
     EXPORT FORMAT: EXCEL (COMMA)          SUB-HEADER SUPPRESSED: YES 
    HEADER (c): @@ 
    FIRST PRINT FIELD: W $C(34)// 
    THEN PRINT FIELD: NAME;X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: W $C(44);X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: STREET ADDRESS [LINE 1];X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: W $C(44);X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: CITY;X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: W $C(44);X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: STATE;X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: W $C(44);X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: ZIP CODE;X// 
    THEN PRINT FIELD: W $C(34);X// 
    THEN PRINT FIELD: W $C(44);X// 
    COMPILED (c): NO 

Example Routine and Output:

    ZZSONPAD -- 
            ;SFISC/SO-Sample Export API Usage ;7:18 AM  1 APR 2000 
           ;;1.0 
           N %DT 
           S %DT="AEPX" 
           S %DT("A")="Enter Beginning of previous Month: " 
           D ^%DT 
           I Y<1 Q 
           S FR=","_$P(Y,".") 
           S %DT="AEPX" 
           S %DT("A")="Enter End of previous Month: " 
           D ^%DT 
           I Y<1 Q 
           S TO=","_$P(Y,".") 
           K %DT 
           D EXPORT^DDXP(2,"ZZSO PATIENT ADDRESS X",,"ZZSO NEW PATIENTS",FR,T 
            O) 
           Q FM22 >D ^ZZSONPAD 
 

    Enter Beginning of previous Month: 3/1/00  (MAR 01, 2000) Enter End of
    previous Month: 3/31/00  (MAR 31, 2000) DEVICE:   Telnet terminal 
    "BIRD,TWEETY","123 TREE ST.","SAN FRANCISCO","CALIFORNIA","94521", 
    "BUNNY,BUGS","123 CARROT ST","SAN FRANCISCO","CALIFORNIA","90041", 
    "CAT,SYLVESTER","132 ANY ST","SAN FRANCISCO","CALIFORNIA","98765", 
    "DUCK,DAFFY","301 Howard St.","San Francisco","CALIFORNIA","94105", 
    "LASVEGAS,LEACH","111 LAS VEGAS BLVD.","LAS VEGAS","NEVADA","89101", 
    "RUNNER,ROAD","234 ROAD ST.","SAN FRANCISCO","CALIFORNIA","94077", 
    "SAM,YOSEMITE","234 YOSEMITE","SAN DIEGO","CALIFORNIA","98765", 

 


Reviewed/Updated: March 10, 2007