Genpact Cora Knowledge Center

Support

File Writer Activity Overview

Starting with V10.0, Cora SeQuence has been renamed to Cora Orchestration.

V10.5 and later

Overview

Use the File Writer activity to create, edit, and save a file into the database as part of a workflow. After you create the file, you can access and use its data in other activities.
You can also use the File Writer activity to generate a PDF file with data from forms.

Use cases

  • Create a spreadsheet of all support tickets with a designated severity level.
  • Create a file from large, unstructured data, and import it to Cora SeQuence.
  • Create a file and use it as an attachment in File Activities.
  • Create PDF files for archiving or printing purposes. For example, you can create a PDF that includes all the sign-off forms of a workflow for future auditing procedures.
  • Create a PDF file by merging content from two or more files of different type. (Supported from V10.5 onwards)

Configuration properties by file type

You can create the following three types of files with the File Writer activity. 

  • CSV
  • Docx (supported from V10.6 onwards)
  • OpenXML
  • PDF
  • Compressed (supported from V10.6 onwards)

For all file types, you need to define the file's access mode:

  • Internal (default): The system can access the file and share it with a different workflow.  
  • Private: Only you can access the file.
  • Public: Anyone can access the file.

Each file type requires different properties.

Main CSV file properties

PropertyDescriptionInterface
FormatDefines the language, date, and time format for the CSV file.
For example: English (United States) format will set language as en-US, date format as M/d/yyyy, and time format as h:mm tt.
Click image to enlarge it.
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
Field TypeSelect Delimited to separate each field with a special character like comma (,) or select Fixed Width to align fields in columns with a space between each field.
Field DelimitersSelect the character you want to use as a delimiter.
Enabled only when field type is Delimited.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.
Trim white spacesRemoves unnecessary spaces in cell values.
This option is selected by default for both field types and can be unselected for Delimited field type only.

Main Docx file properties

PropertyDescriptionInterface
ActionSelect an action to perform. Each action generates different capabilities.
  • Create file from HTML: Generates a Docx file from an HTML code.
  • Create file from URL: Generates a Docx file from content from a URL.
  • Merge and convert file list: Merges two or more files and generates a Docx file.
  • Extract from a PDF file: Extracts selected pages from a PDF file to a new Docx file.
Click image to enlarge it.
HTML Details
(For Create file from HTML)
Paste the HTML code from which the Docx file is to be created.
Example:
Literal string
"<html><body><h1>my content</h1></body></html>" 
Expression returning string
{Approval Task}.Tasks.Last().Body
URL Details
(For Create file from URL)
Enter the URL where the Docx file content is.
Example:
{Request}.Query("MyRequest").URL 
or
"HTTP://myServer/myPage.aspx?myParam="+{Request}.Query("MyRequest").["ActInstanceNumber"]&config=form
Credential Type
Credential Name
(For Create file from URL)
If the URL that you entered requires credentials, set the credential type and name.
Source Query
(For Merge and convert file list)
Enter the query to select files which need to be merged to create the file.
Example:
{Request}.Query(“MyRequest”).AsQueryable().Select(GUID)
Source Query
(For Extract from a PDF file)
Enter the query to select the PDF file from which pages are to be extracted.
Example:
{Request}.Query(“MyRequest”)[FileGuid]
Start Page
End Page
(For Extract from a PDF file)
Select the page range from the PDF file from which pages are to be extracted.
Page SizeSelect the required paper size to print the PDF file.
  • A3
  • A4
  • A5
  • Letter
  • Legal
Add page numberingSelect this option to display page numbers in the PDF file.
Landscape page orientation
(Available from V9.9.2  and V10.3 onwards)
Only for creating from HTML and URL
Select this option to set the page orientation to landscape while printing.
The default page orientation is portrait.
Contain Header/Footer
(Available from V10.5)
Only for creating from HTML and URL
Select this option if your file contains some header or footer content.

Main OpenXML file properties

PropertyDescriptionInterface
FormatDefines the language, date, and time format for the CSV file.
For example: English (United States) format will set language as en-US, date format as M/d/yyyy, and time format as h:mm tt.


Click image to enlarge it.
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
Sheet NameIf the source file contains more than one sheet, specify the name of the sheet that you want to process.
Invalid Character Handling MethodSelects how the invalid characters will be handled in the sheet.
In case of an invalid character, either the invalid character will be replaced with a space or the activity will fail.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.

Main PDF file properties

Most of the properties for generating PDF files is similar to Docx files.

PropertyDescriptionInterface
ActionSelect an action to perform. Each action generates different capabilities.
  • Create a file from HTML: Generates a PDF file from an HTML code.
  • Create a file from URL: Generates a PDF file from content from a URL.
  • Merge and convert file list: Merges two or more files and generates a PDF file.
  • Extract from a PDF file: Extracts selected pages from a PDF file to a new PDF file.
Click image to enlarge it.
HTML Content
(For Create file from HTML)
Paste the HTML code from which the PDF file is to be created.
Example:
Literal string
"<html><body><h1>my content</h1></body></html>" 
Expression returning string
{Approval Task}.Tasks.Last().Body
URL Details
(For Create file from URL)
Enter the URL where the PDF file content is.
Example:
{Request}.Query("MyRequest").URL 
or
"HTTP://myServer/myPage.aspx?myParam="+{Request}.Query("MyRequest").["ActInstanceNumber"]&config=form
Credential Type
Credential Name
(For Create file from URL)
If the URL that you entered requires credentials, set the credential type and name.
Source Query
(For Merge and convert file list)
Enter the query to select files which need to be merged to create the PDF.
Example:
{Request}.Query(“MyRequest”).AsQueryable().Select(GUID)
Source Query
(For Extract from a PDF file)
Enter the query to select the PDF file from which pages are to be extracted.
Example:
{Request}.Query(“MyRequest”)[FileGuid]
Start Page
End Page
(For Extract from a PDF file)
Select the page range from which PDF is to be created.
Page SizeSelect the required paper size to print the PDF file.
  • A3
  • A4
  • A5
  • Letter
  • Legal
Add page numberingSelect this option to display page numbers in the PDF file.
Landscape page orientation
(Available from V9.9.2  and V10.3 onwards)
Only for creating from HTML and URL
Select this option to set the page orientation to landscape while printing.
The default page orientation is portrait.
Contain Header/Footer
(Available from V10.5)
Only for creating from HTML and URL
Select this option if your file contains some header or footer content.
Enable links in the PDFSelect this option to activate hyperlinks from the source in the PDF file.
Fit to page
(Available from V10.5)
Select this option to fit the file content to the page in PDF.
Stretch to fit
(Available from V10.5)
 Select this option to ensure system stretches the file content to fit the page size.

Best practices for creating PDF files

When you specify a URL, make sure that:

  • All the external resources, such as CSS, JavaScript, and image files, referenced in the HTML can be accessed. 
  • You don't use any JavaScript that dynamically changes the HTML DOM, as the changes may not be reflected in the generated PDF document.
  • The Persist on Creation property of a Form or a Task activity is enabled, if the URL is of a Form or a Task activity that is on the same workflow execution path.
NOTE
While creating PDF files from URL based on a form, when the Enable links option is selected, the result PDF shows black borders around checkbox and button controls. As a workaround, consider a form design without those controls. Or leave the Enable links option un selected if links are not required in the form.

When designing your own HTML:

  • Take into consideration the target paper size dimensions (width and height), and use the correct units of measurement when placing controls on the page. 
  • If you don't need to print the PDF file, then select a larger paper size for complex forms. For example, select A3 instead of A4.
  • Use a simple page layout.
  • Reduce image size and avoid embedded objects and JavaScript.
  • Design the HTML code to fit a PDF output, and not as a regular HTML page.

Main Compressed file properties (supported from V10.6 onwards)

With compressed file type option, you can generate a ZIP type compressed file through the File Writer Activity.

PropertyDescriptionInterface
ActionCreate a ZIP file from file list: Generates a ZIP file from a query.Click image to enlarge it.
Source Query
Enter the query to select files which need to be compressed into ZIP file.
Example:
{Request}.Query(“MyRequest”).AsQueryable().Select(GUID)

Configure the File Writer activity

  1. Add the File Writer activity to your workflow.
  2. In the File Writer Activity Properties screen, enter the activity name, and then click Next.
  3. In the File Writer Definition screen, enter file properties.
    1. File Name: Enter a name for the file that you want to create, including file extension.
    2. File Type: Select a file type: CSV, Docx, OpenXML, PDF, or Compressed.
    3. Access Mode: Select an access mode, Private, Internal, Public.
      For details, see the Configuration properties by file type section above.

      IMPORTANT
      After you select a file type and click Next, you cannot change the file type. To change the file type, cancel the current activity wizard and start a new.

  4. For Docx, PDF, or Compressed file, add file properties and then click Finish.
  5. Click Next, if you are creating CSV and OpenXML files. In the File Field Properties screen map the fields in the file with values from a source file.
    For more details, see the Define field properties section below.

Define field properties

When configuring CSV and OpenXML files, you need to map the fields in the file with values retrieved from the source file.
You can set up advanced formatting properties for Date, Time, DateTime, and Boolean values.

  1. In the File Field Properties screen, set the source file used to create the file.
  2. Define the field properties:
    1. Name: Define the name of the property in the target file.
    2. Value: Define the relevant value in the Expression Wizard.
    3. Field Type: Select a relevant type for each field.
      For Field Type as Fixed Width, in the File Properties screen, define the Field Width property, which determines the number of characters allowed in the column.
  3. Click Add Field, if additional fields are required.
  4. (Optional) Click Advanced Options, and select the required format to define additional options for Date, Time, DateTime, and Boolean fields.
Date, Time, DateTimeBoolean
  • Use default settings: the format defined for your system.
  • Use standard format: select one of the available standards.
  • Define custom format: set up your own format. 
  • Use default options: the format defined for your system.
  • Define custom values: enter the values to use instead of true and false.


NOTE
To make sure that the output files can be easily shared, starting with V9.2, new files created with the File Writer activity are set to public access mode by default.

Starting from V9.5, for OpenXML files, the date, time, and numeric fields are mapped to the relevant data types per the source file, and calculation can be done on these using specific data functions.
For example, numeric field mapped to Int32 field type appears with General data type in the OpenXML file, and all calculations can be done on it using numeric functions.

Access and use the file's data

After you create the file, you can access its data through the File Writer activity's metadata.
For example, if you want to use data from the created file in a Put File activity, you can set the created file as the file source.

V9.3-V10.4

Overview

Use the File Writer activity to create, edit, and save a file into the database as part of a workflow. After you create the file, you can access and use its data in other activities.
You can also use the File Writer activity to generate a PDF file with data from forms.

Use cases

  • Create a spreadsheet of all support tickets with a designated severity level.
  • Create a file from large, unstructured data, and import it to Cora SeQuence.
  • Create a file and use it as an attachment in File Activities.
  • Create PDF files for archiving or printing purposes. For example, you can create a PDF that includes all the sign-off forms of a workflow for future auditing procedures.

Configuration properties by file type

You can create three types of files with the File Writer activity.

  • CSV
  • OpenXML
  • PDF

For all file types, you need to define the file's access mode:

  • Internal (default): Allows the system to access the file and share it with a different workflow.  
  • Private: Only you can access the file.
  • Public: Anyone can access the file.

Each file type requires different properties.

Main CSV file properties

PropertyDescriptionInterface
FormatDefines the language, date, and time format for the CSV file.
For example: English (United States) format will set language as en-US, date format as M/d/yyyy, and time format as h:mm tt.
Click image to enlarge it.
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
Field TypeSelect Delimited to separate each field with a special character like comma (,) or select Fixed Width to align fields in columns with a space between each field.
Field DelimitersSelect the character you want to use as a delimiter.
Enabled only when field type is Delimited.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.
Trim white spacesRemoves unnecessary spaces in cell values.
This option is selected by default for both field types and can be unselected for Delimited field type only.

Main OpenXML file properties

PropertyDescriptionInterface
FormatDefines the language, date, and time format for the CSV file.
For example: English (United States) format will set language as en-US, date format as M/d/yyyy, and time format as h:mm tt.


Click image to enlarge it.
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
Sheet NameIf the source file contains more than one sheet, specify the name of the sheet that you want to process.
Invalid Character Handling MethodSelects how the invalid characters will be handled in the sheet.
In case of an invalid character, either the invalid character will be replaced with a space or the activity will fail.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.

Main PDF file properties

PropertyDescriptionInterface
HTML ContentURL: Enter the URL where the PDF file content is.Click image to enlarge it.
HTML: Paste the HTML code from which the PDF file is to be created.
Credential TypeRequired only for URL sources.
If the URL that you entered requires credentials, set the credential type and name.
Page SizeSelect the required paper size to print the PDF file.
Enable links in the PDFSelect this option to activate hyperlinks from the source HTML in the PDF file.
Add page numberingSelect this option to display page numbers in the PDF file.  
Landscape page orientation
Available from V9.9.2  and V10.3 onwards
Select this option to set the page orientation to landscape while printing.
The default page orientation is portrait.

Best practices for creating PDF files

When you specify a URL, make sure that:

  • All the external resources, such as CSS, JavaScript, and image files, referenced in the HTML can be accessed. 
  • You don't use any JavaScript that dynamically changes the HTML DOM, as the changes may not be reflected in the generated PDF document.
  • The Persist on Creation property of a Form or a Task activity is enabled, if the URL is of a Form or a Task activity that is on the same workflow execution path.

When designing your own HTML:

  • Take into consideration the target paper size dimensions (width and height), and use the correct units of measurement when placing controls on the page. 
  • If you don't need to print the PDF file, then select a larger paper size for complex forms. For example, select A3 instead of A4.
  • Use a simple page layout.
  • Reduce image size and avoid embedded objects and JavaScript.
  • Design the HTML code to fit a PDF output, and not as a regular HTML page.

Configure the File Writer activity

  1. Add the File Writer activity to your workflow.
  2. In the File Writer Activity Properties screen, enter the activity name, and then click Next.
  3. In the File Writer Definition screen, enter file properties.
    1. File Name: Enter a name for the file that you want to create, including file extension.
    2. File Type: Select a file type: CSV, OpenXML, or PDF.
    3. Access Mode: Select an access mode, Private, Internal, Public.
      For details, see the Configuration properties by file type section above.

      IMPORTANT
      After you select a file type and click Next, you cannot change the file type. To change the file type, cancel the current activity wizard and start a new.

  4. Click Finish, if you are creating a PDF file.
  5. Click Next, if you are creating CSV and OpenXML files. In the File Field Properties screen map the fields in the file with values from a source file.
    For more details, see the Define field properties section below.

Define field properties

When configuring CSV and OpenXML files, you need to map the fields in the file with values retrieved from the source file.
You can set up advanced formatting properties for Date, Time, DateTime, and Boolean values.

  1. In the File Field Properties screen, set the source file used to create the file.
  2. Define the field properties:
    1. Name: Define the name of the property in the target file.
    2. Value: Define the relevant value in the Expression Wizard.
    3. Field Type: Select a relevant type for each field.
      For Field Type as Fixed Width, in the File Properties screen, define the Field Width property, which determines the number of characters allowed in the column.
  3. Click Add Field, if additional fields are required.
  4. (Optional) Click Advanced Options, and select the required format to define additional options for Date, Time, DateTime, and Boolean fields.
Date, Time, DateTimeBoolean
  • Use default settings: the format defined for your system.
  • Use standard format: select one of the available standards.
  • Define custom format: set up your own format. 
  • Use default options: the format defined for your system.
  • Define custom values: enter the values to use instead of true and false.


NOTE
To make sure that the output files can be easily shared, starting with V9.2, new files created with the File Writer activity are set to public access mode by default.

Starting from V9.5, for OpenXML files, the date, time, and numeric fields are mapped to the relevant data types per the source file, and calculation can be done on these using specific data functions.
For example, numeric field mapped to Int32 field type appears with General data type in the OpenXML file, and all calculations can be done on it using numeric functions.

Access and use the file's data

After you create the file, you can access its data through the File Writer activity's metadata.
For example, if you want to use data from the created file in a Put File activity, you can set the created file as the file source.

V9.2

Overview

Use the File Writer activity to create, edit, and save a file into the Cora SeQuence database as part of a workflow. After you create the file, you can access and use its data in other activities.
You can also use the File Writer activity to generate a PDF file with data from forms.

Use cases

  • Create a spreadsheet of all support tickets with a designated severity level.
  • Create a file from large, unstructured data, and import it to Cora SeQuence.
  • Create a file and use it as an attachment in File Activities.
  • Create PDF files for archiving or printing purposes. 

Configuration properties by file type

You can create three types of files: CSV, OpenXML, or PDF. Each file type requires different properties.

Main CSV file properties

PropertyDescriptionWizard
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8

Click image to enlarge it.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.
Trim white spacesRemoves unnecessary spaces in cell values.
This option is selected by default.

Main OpenXML file properties

PropertyDescriptionWizard
EncodingSupported character encoding types:
  • Default
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8

Click image to enlarge it.
Sheet NameIf the source file contains more than one sheet, specify the name of the sheet that you want to process.
First row contains headerSelect this option, if the first row of the source file contains a header.
In this case, the first row is skipped when the file is processed.

Main PDF file properties

PropertyDescriptionWizard
HTML ContentURL: Enter the URL where the content for the PDF file is.
Click image to enlarge it.
HTML: Paste the HTML code from which to create the PDF file.
Credential TypeRequired only for URL sources.
If the URL that you entered requires credentials, set the credential type and name.
Page SizeIf the PDF needs to be printed, select the required paper size.
Enable links in the PDFSelect this option to activate hyperlinks from the source HTML in the PDF file.
Add page numberingSelect this option to display page numbers in the PDF file.  

Best practices for creating PDF files

You can create PDF files for archiving or printing purposes. For example, you can create a PDF that includes all the sign-off forms of a workflow for future auditing procedures.
When you create a PDF file, you can either specify a URL that contains the required HTML content, or write your own HTML using a code editor. 

When you specify a URL, make sure that:

  • All the external resources, such as CSS, JS, and image files, referenced in the HTML can be accessed. 
  • Do not use any JavaScript that dynamically changes the HTML DOM as the changes may not be reflected in the generated PDF document.

When designing your own HTML:

  • Take into consideration the target paper size dimensions (width and height) and use the correct units of measurement when placing controls on the page. 
  • If the PDF file does not need to be printed, select a larger paper size for complex forms. For example, select A3 instead of A4.
  • Use a simple page layout.
  • Reduce image size and avoid embedded objects and JavaScript.
  • Design the HTML code to fit a PDF output, and not as a regular HTML page.

Configure the File Writer activity

  1. Add the File Writer activity to your workflow.
    1. In the Properties screen, enter a name for the activity, and then click Next.
  2. Define the file type.
    1. In the Definition screen, enter a name for the file that you want to create, including file extension.
    2. Select a file type: CSV, OpenXML, or PDF.

IMPORTANT
After you select a file type and click Next, you cannot change the file type. To change the file type, cancel the activity wizard and start a new activity wizard.

  1. Define the file properties.
    For details, see the Configuration properties by file type section above.
  2. Do one of the following:
    • If you are creating a PDF file, click Finish.
    • If you are creating CSV and OpenXML files, you need to map the fields in the file with values from a source file.
      For more details, see the Define field properties section below.
      Click Next.

Define field properties

When configuring CSV and OpenXML files, you need to map the fields in the file with values retrieved from the source file.
You can set up advanced formatting properties for Date, Time, and DateTime values.

  1. In the File Field Properties screen, set the source file used to create the CSV or OpenXML file.
  2. Define the field properties:
    1. Under Name, define the name of the property in the target file.
    2. Under Value, click the ellipsis button to define the relevant value in the Expression Wizard.
    3. For each field, select a relevant type.
  3. If additional fields are required, click Add Field.
  4. (Optional) For date, dateTime, time, and Boolean fields, you can define additional options.
    Click Advanced Options, and select the required format:
Date, Time, DateTimeBoolean
  • Use default settings: the format defined for your system.
  • Use standard format: select one of the available standards.
  • Define custom format: set up your own format. 
  • Use default options: the format defined for your system.
  • Define custom values: enter the values to use instead of true and false.


NOTE
To make sure that the output files can be easily shared, starting with V9.2, new files created with the File Writer activity are set to public access mode by default.

Access and use the file's data

After you create the file, you can access its data through the File Writer activity's metadata.
For example, if you want to use data from the created file in a Put File activity, you can set the created file as the file source.



V9.1 and earlier

Context

Use the File Writer Activity to create a file, write (edit) to the file, and save the file to the Cora SeQuence database as part of a workflow. After you create the file, you can access and use the file's data in other activities. 

Use Cases

  • Create a spreadsheet of all support tickets with a designated severity level.
  • Create a file from large, unstructured data that you import to .
  • Create a file and use it as an attachment in File Activities.
  • File enrichment.

Define the File

  • Type a file name including the file extension.
  • Select a file type: CSV or OpenXML

IMPORTANT: After you select a file type and click Next, you cannot change the file type (even if you click back). If you need to change the file type, cancel the activity wizard and start a new activity wizard. See the screenshot below.

CSV Files

CSV Files Configuration Parameters

ParameterDescription
Encoding
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
First row contains headerSelect if the first row of the source file contains a header. This row is skipped when the file is processed.
Has fields enclosed in quotesFields contain quotations when they are used to count separator symbols as part of the field value.
For example, if a field value is 52,345 and comma is a defined separator, the entire field is wrapped in quotations "52,345".
Cases in which a field is wrapped in quotations for other reasons, and the Has fields enclosed in quotes checkbox is selected, the quotations are removed from the field.
Trim white spacesRemoves unnecessary spaces in cell values. This option is selected by default.


OpenXML Files

OpenXML Files Configuration Parameters

ParameterDescription
Encoding
  • ASCII
  • Big-Endian Unicode
  • Unicode
  • UTF32
  • UTF7
  • UTF8
Sheet NameIf the file contains more than one sheet, specify the sheet name that you want to process. If this field is empty, the first sheet in the file is selected.
First row contains headerSelect if the first row of the source file contains a header. This row is skipped when the file is processed.


Define Field Properties - All File Types

This window depends on previous configurations. In this example, we selected a CSV file with fixed width.

File Field Properties Configuration Parameters

ParameterDescription
Source QueryThe source of the data that you want to include in the file.
NameField name that you enter.
ValueField value.
Field TypeDetermines the valid values for the property.
Advanced OptionsSee the Advanced Options section.


Define Advanced Options - All Files (optional)

DateTime Configuration


Time Configuration

Access and Use the File's Data

After you create the file, you can access the file's data from the activity's metadata. For example, if you want to use data from the created file in a Put File Activity, you can use the created file when defining the file source.