Salesforce

How Do I Set a Dynamic Name for an Input/Output File? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Set a Dynamic Name for an Input/Output File? (Magic xpa 3.x)

When you create or use an input/output file in Magic xpa, you have several options for coding the file name:

  • You can hard-code the file name, such as 'C:\Temp\Report.txt'.

  • You can use variables to hold the file name, such as TRIM(AF). The variable, AF, might have been held in a table, or it might have been a file name selected or typed in by the user. You can also generate the file name randomly and hold it in a variable, which is useful for temporary text files.

  • You can use logical names to set all or part of the file name. This is a good idea for the path name, as you want to be able to set the path names at runtime. An especially useful logical name is %TempDir%, which is automatically set up by Magic xpa.

In all cases, the file name will be entered in the Expression Editor. Here we will show you how to do it step by step for a text output file.

Setting the I/O device name

  1. First, open up the task which is doing the I/O. You can do that by clicking on the task in the navigator pane (Alt+F1).

  2. Press Ctrl+I (Task->I/O Devices). This will take you to a list of your I/O devices. If you don’t already have one in the task:

    • Add an I/O device by pressing F4 (Edit->Create Line).

    • In the Name column, give this I/O device a name that is meaningful to you.

    • In the Media column, select File.

    • In the Access column, select Write.

    • In the Format column, select Line.

  3. Now, tab to the Expression column and zoom (F5, double-click) to the Expression Editor.

  4. Enter the expression you want to use for the file name. In this case we used '%TempDir%Orders.txt'. You can use any combination of logical names and variables as long as it evaluates to a valid path name.

Now, when the export runs, the file will be created in the Windows temporary directory in My Computer.

See also

Reference
Attachment 
Attachment