Adding a Create File event action

Use the Create File to create a specific content while running a visual project and then use this content for different purposes, for example, sending it in an email.

About this task

To add an Create File event action to an object:

Procedure

  1. Select the object in the editor window and double-click the event that you want to trigger the jump from the Events view.
    The [objectname] Behavior window opens.
  2. Click the Add New Action icon.
    The Add New Action window opens.
  3. Select Create File in the actions tree and click Next to open the Create File specific window.
    Note: To quickly find the required event action, type the name of the action in the filter text field.
  4. In the Output type radio group, select one of three radio buttons:
    • Open. It opens Save As dialog. Enter the name of the file in the File name field to save it.
    • Save to a temp file. It saves the generated file in a temporary directory. The path to this file is recorded in a global or local parameter. You specify the parameter in the bottom of the window.
      • Select either Global parameters or Local parameters from the Result parameter drop-down list.
      • Click Add New Parameter. The Insert Parameter window opens.
      • Enter a name for the parameter and its description in the Name and Description fields.
      • Select a parameter type. The valid types are FilePath, Literal, and Text.
    • Save to a file. It automatically saves the generated file in a specified root directory when the event occurs.
  5. If you select Save to a file check box you can build an export path in different ways, depending on the directory which can be specified in the Root output directory field on the Server-Side File System page of the Preferences window:
    • When the output root directory is specified, the export directory of the file will be combined of the root output directory and the path typed in the Name field.
    • In QMF for Workstation when the output root directory is not specified, the export directory of the file will be a combination of the application working directory and the path typed in the Name field.
    • In QMF for WebSphere® when the output root directory is not specified, the export directory of the file will be a combination of the temporal directory and the file name, the typed path is ignored.
  6. Specify a file name for the file you want to create in the Name field. You can also specify the file extension in this field. If you do not specify it, the file type is selected from the list of available ones:
    • application/octet-stream -*.bin
    • image/bmp - *.bmp
    • image/png - *.png
    • text/calendar - *.ics
    • text/plain - *.txt
    Note: Specify a file extension if you want to create a file different from the listed ones.
  7. In the File Content area, enter the content of the file you want to create in the Content field. For example, you want to add the text from TextBox1, enter the value: = TextBox1.Text.
  8. Select the type from the Content type list or enter the any necessary value in the list. The available types for the content selection are:
    • application/octet-stream specifies a binary file that is associated with an application that opens this file.
    • image/bmp creates an image in *.bmp format.
    • image/png creates an image in *.png format.
    • text/calendar creates a document in iCalendar data format for representing and exchanging, calendaring and scheduling calendar information.
    • text/plain creates an ordinary sequential file readable as textual material without much processing.
  9. If you did not previously specify the directory parameter, select either Global parameters or Local parameters from the Result parameter drop-down list and click the Add New Parameter button.
    The Insert Parameter window opens.
  10. Specify a necessary parameter and click Finish.
    The Insert Parameter window closes and control returns to the Add New Action window.
  11. Select the parameter that you want to use from the Result parameter drop-down lists and click OK.
    The Add New Action dialog closes.
  12. From the [objectname] Behavior window, click Apply to apply all actions that have been added for the event.
  13. Click OK to close the [objectname] Behavior window.