This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bw2:file_writer_tool [2020/12/15 12:51] akoehler |
bw2:file_writer_tool [2024/09/24 16:22] (current) dlee [File Writer Variables] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Introduction (File Writer)====== | ||
| - | |||
| - | This page describes the use of the “File Writer” tool in Bizweaver. Information regarding the associated File Operations and File Reader tools is found in separate documents. | ||
| ====== File Writer Tool ====== | ====== File Writer Tool ====== | ||
| Line 20: | Line 17: | ||
| The **Datasource** output option is used to write the input data set as it is received and create the file with data records only. Use the **Custom String** output method if header and footer sections, or custom column headings, are needed as well. No Bizweaver looping is required. | The **Datasource** output option is used to write the input data set as it is received and create the file with data records only. Use the **Custom String** output method if header and footer sections, or custom column headings, are needed as well. No Bizweaver looping is required. | ||
| - | {{ :bw:fwimage1.png? | + | {{ :bw2:bizweaverfilewriter1.png |}} |
| - | - Enter the **Filename** (target folder and file name) for the output file. | + | - Enter the **Filename** (target folder and filename) for the output file. |
| - Press <F4> to show variables from previous steps that might be used to create the file name. | - Press <F4> to show variables from previous steps that might be used to create the file name. | ||
| - | - The extension (e.g. csv, txt, etc.) must be included in the file name. The extension should be consistent with the **File Type** selected step 3 below. The extension is not automatically assigned based on the File Type selection. | + | - The extension (e.g., CSV, txt, etc.) must be included in the file name. The extension should be consistent with the **File Type** selected step 3 below. The extension is not automatically assigned based on the File Type selection. |
| - Select the data **Source** from the drop-down list. | - Select the data **Source** from the drop-down list. | ||
| - Only SQL Command and File Reader workflow steps are listed. | - Only SQL Command and File Reader workflow steps are listed. | ||
| Line 34: | Line 31: | ||
| - Column header names cannot be changed when using the Datasource output option. | - Column header names cannot be changed when using the Datasource output option. | ||
| - This option does not apply when XML output is selected. | - This option does not apply when XML output is selected. | ||
| - | - XML output will create a basic XML structure based on the data presented. There is no provision to create hierarchical output, or to change the node names. | + | - XML output will create a basic XML structure based on the data presented. There is no provision to create hierarchical output or to change the node names. |
| - | - As of version 2.2, Excel must be installed on the Bizweaver server to write output as an Excel file. | + | - As of version 2.2, Excel must be installed on the Bizweaver server to write the output as an Excel file. |
| ====== Custom String Output ====== | ====== Custom String Output ====== | ||
| Line 50: | Line 47: | ||
| </ | </ | ||
| - | {{ :bw:fwimage2.png? | + | {{ :bw2:bizweaverfilewriter2.png |}} |
| - | + | - Enter the **Filename** (target folder and filename) for the output file. | |
| - | - Enter the **Filename** (target folder and file name) for the output file. | + | |
| - Press <F4> to show variables from previous steps that can be used to create the file name. | - Press <F4> to show variables from previous steps that can be used to create the file name. | ||
| - | - The extension (e.g. csv, txt, etc.) must be included in the file name. | + | - The extension (e.g., CSV, txt, etc.) must be included in the file name. |
| - //**To create tab-delimited output, press Shift + Tab at the point where a delimiter is needed.**// | - //**To create tab-delimited output, press Shift + Tab at the point where a delimiter is needed.**// | ||
| - | | + | The **Header** section contains whatever values should be included in the output file' |
| - This section is only written once when the file is created | - This section is only written once when the file is created | ||
| - | - This section is optional but must be included | + | - This section is optional but must be included |
| - The appropriate delimiter value must separate column headers. | - The appropriate delimiter value must separate column headers. | ||
| - The **Body** section contains the values for each data record coming from the input source. | - The **Body** section contains the values for each data record coming from the input source. | ||
| + | - When data reaches the end of a line, it will wrap to the next line. This will not add spaces to the file; if line breaks are desired for the Body's data, you must press Enter where the line break is intended. | ||
| - The appropriate delimiter value must separate columns. | - The appropriate delimiter value must separate columns. | ||
| - | - In most cases the values in this section will be variables from the input source step. This is shown in the example image above. Press <F4> to list available steps, then click on the step name to see & select the desired values. | + | - In most cases, the values in this section will be variables from the input source step. This is shown in the example image above. Press <F4> to list available steps, then click on the step name to see & select the desired values. |
| - The **Footer** section contains whatever values should be included as the last row(s) of the output file. | - The **Footer** section contains whatever values should be included as the last row(s) of the output file. | ||
| - This section is only written once when the file is created | - This section is only written once when the file is created | ||
| - This section is optional. | - This section is optional. | ||
| - | - The appropriate delimiter value must separate columns, if appropriate. | + | - The appropriate delimiter value must separate columns, if applicable. |
| - | - An example | + | - An example of this section's use might be a summary record for the file' |
| - | - The output data can be placed into one, or more, files based on the “Grouped By”, “Each Record,” and “Append” options. | + | - The output data can be placed into one or more files based on the “Grouped By”, “Each Record,” and “Append” options. |
| - | - To create a single file, select the “Grouped By” option | + | - To create a single file, select the “Grouped By” option, leave the grouping value field blank, or use the “Append” option. See the notes below about the “Append” option. |
| - To create a unique file based on some value in the input data source, select “Grouped By.” Select a variable from the data source step and place it in the grouping value field. Press <F4> while in the field to see a list of data sources. Click on the appropriate data source to select the value. | - To create a unique file based on some value in the input data source, select “Grouped By.” Select a variable from the data source step and place it in the grouping value field. Press <F4> while in the field to see a list of data sources. Click on the appropriate data source to select the value. | ||
| - In this case, a variable from the data source must be used in the output file name to make each file unique. If this is not done, all records will be written into a single file. | - In this case, a variable from the data source must be used in the output file name to make each file unique. If this is not done, all records will be written into a single file. | ||
| - | - To create a unique file for each input record, select “Create file for each record.” A separate file will be created for each record. | + | - To create a unique file for each input record, select “Create |
| <WRAP center round info> | <WRAP center round info> | ||
| - | When creating multiple files, a variable from the data source must be used in the output file name to make each file unique. If this is not done the specified file will be over-written each time a new “grouping” is found, and the file will only reflect the last record(s) processed. This applies | + | When creating multiple files, a variable from the data source must be used in the output file name to make each file unique. If this is not done, the specified file will be over-written each time a new “grouping” is found, and the file will only reflect the last record(s) processed. This applies |
| </ | </ | ||
| ===== Append Option for Custom Output ===== | ===== Append Option for Custom Output ===== | ||
| - | The “Append” output option can be used in two ways. First, it can be used to create a single “custom” output file from the input data. Second, it can be used to write the output from multiple input steams | + | The “Append” output option can be used in two ways. First, it can create a single “custom” output file from the input data. Second, it can be used to write the output from multiple input streams |
| - | Care should be taken when using this option. If you do want a single output file, but you don’t want subsequent data to be written into the initial file, there are two options. | + | Care should be taken when using this option. If you want a single output file but don’t want subsequent data to be written into the initial file, there are two options. |
| - Add a timestamp value to the file name so that each time the workflow runs, the file name will be unique. | - Add a timestamp value to the file name so that each time the workflow runs, the file name will be unique. | ||
| Line 88: | Line 85: | ||
| ====== Binary Output ====== | ====== Binary Output ====== | ||
| - | The Binary Output option is used to process a Base64 input string and write it out as the appropriate type of file. The primary use of this process | + | The Binary Output option is used to process a Base64 input string and write it out as the appropriate type of file. This process' |
| ===== Uploaded Versago Data ===== | ===== Uploaded Versago Data ===== | ||
| - | Data files that are uploaded to Versago via a Versago Form are stored in the table “TWBS_VGO_FormAttachments, | + | Data files uploaded to Versago via a Versago Form are stored in the table “TWBS_VGO_FormAttachments, |
| The image below illustrates the record structure. The column headings in yellow are used to obtain the needed data. | The image below illustrates the record structure. The column headings in yellow are used to obtain the needed data. | ||
| Line 103: | Line 100: | ||
| - **FileContent** is the binary data that will be used to recreate the file. | - **FileContent** is the binary data that will be used to recreate the file. | ||
| - | To convert these files, we will need workflow steps to obtain | + | To convert these files, we will need workflow steps to obtain each record's ID to be converted. The SQL statement to create the list of records to feed into the loop will be: |
| > Select ID from TWBS_VGO_FormAttachments where ObjectID = 26 | > Select ID from TWBS_VGO_FormAttachments where ObjectID = 26 | ||
| Line 113: | Line 110: | ||
| The first step within the loop is to gather the detail for each specific record. The SQL statement to do this is: | The first step within the loop is to gather the detail for each specific record. The SQL statement to do this is: | ||
| - | <code sql> | + | <code sql>SELECT fileName |
| - | + | ,fileContent | |
| - | WorkFlow(SQLCommand1).Get({FIELD_ID}) </ | + | FROM twbs_vgo_formAttachments |
| + | WHERE id = WorkFlow(SQLCommand1).Get({FIELD_ID}) </ | ||
| The two values are then used in the File Writer step. | The two values are then used in the File Writer step. | ||
| Line 122: | Line 120: | ||
| * The FileContent variable indicates what data is to be written out | * The FileContent variable indicates what data is to be written out | ||
| - | {{ :bw:fwimage4.png? | + | {{ :bw2:bizweaverfilewriter3.png |}} |
| This process occurs for each record passed into the loop. The recreated files are created in the designated folder using their original name. | This process occurs for each record passed into the loop. The recreated files are created in the designated folder using their original name. | ||
| - | In the SAP Business One environment these files can now be processed further as Attachments to an SAP Business One object such as a Business Partner, Sales Order, etc. | + | In the SAP Business One environment, these files can now be processed further as Attachments to an SAP Business One object such as a Business Partner, Sales Order, etc. |
| ===== Versago Signature Data ===== | ===== Versago Signature Data ===== | ||
| - | The Binary Output option can also be used to convert | + | The Binary Output option can also convert a Versago Form signature |
| Signature data is stored in a column in the table used by the Versago Form. It is stored in a format that must be converted back to base64 before it can be used. There are two ways to approach this. | Signature data is stored in a column in the table used by the Versago Form. It is stored in a format that must be converted back to base64 before it can be used. There are two ways to approach this. | ||
| ====Option 1==== | ====Option 1==== | ||
| - | When you know that a form will be capturing a signature, the conversion can be done in the **CustomPostExecute** procedure. | + | When you know that a form will be capturing a signature, the conversion can be done in the **CustomPostExecute** procedure. |
| <code sql> | <code sql> | ||
| Line 144: | Line 142: | ||
| Used to convert a signature image from text to base64 binary for use with Crystal Reports or to save as a disk file. | Used to convert a signature image from text to base64 binary for use with Crystal Reports or to save as a disk file. | ||
| -- | -- | ||
| - | @vgoRecNum and vgoRecNum are the primary | + | @vgoRecNum and vgoRecNum are the primary |
| @ObjectID is the form ID. Change as needed. | @ObjectID is the form ID. Change as needed. | ||
| - | F2_SigCapture is the Versago table. Change name as needed. | + | F2_SigCapture is the Versago table. Change |
| */ | */ | ||
| Line 156: | Line 154: | ||
| from F2_SigCapture where vgoRecNum = @vgoRecNum | from F2_SigCapture where vgoRecNum = @vgoRecNum | ||
| -- | -- | ||
| - | /* Convert image data to base64 Binary and insert into holding table named SignatureCapture. | + | /* Convert image data to base64 Binary and insert |
| Assumes a text field named “Name” is used to capture the signature name */ | Assumes a text field named “Name” is used to capture the signature name */ | ||
| - | insert into SignatureConvert | + | INSERT INTO SignatureConvert |
| (ObjectID, ControlID, RecordId, FileName, FileType, FileContent, | (ObjectID, ControlID, RecordId, FileName, FileType, FileContent, | ||
| - | select | + | SELECT |
| - | @Object,' | + | |
| - | cast('' | + | ,' |
| - | from F2_SigCapture | + | ,@vgoRecNum |
| + | ,ISNULL(Name,' | ||
| + | ,' | ||
| + | ,CAST('' | ||
| + | ,' | ||
| + | ,GETDATE() | ||
| + | FROM F2_SigCapture | ||
| + | WHERE vgoRecNum = @vgoRecNum | ||
| </ | </ | ||
| Line 170: | Line 175: | ||
| {{ : | {{ : | ||
| - | The conversion to disk file is then the same as described in Uploaded Versago Data section above. | + | The conversion to disk file is then the same as described in the Uploaded Versago Data section above. |
| ====Option 2==== | ====Option 2==== | ||
| - | The signature image can also be converted as needed in a Bizweaver workflow. | + | The signature image can also be converted as needed in a Bizweaver workflow. |
| + | |||
| + | |||
| + | ====File Writer Variables==== | ||
| + | ^Name ^ Description | ||
| + | | AppendData | ||
| + | | BinaryData| | ||
| + | |ColumnID| If create a file for records - grouped by is selected it will display the current record that is being grouped| | ||
| + | | CreateFileForAllRecords | ||
| + | | CreateFileForGroupedRecords |True or False if the create a file for grouped records radio button was selected| | ||
| + | | CustomSeparator | ||
| + | | DataSourceWorkFlowID | ||
| + | | EnableBinaryData |True or False if the binary data radio button is selected| | ||
| + | | EnableColumnHeaders | ||
| + | |EnableDataSource | ||
| + | | EnableStringBuilder |True or False if custom string radio button is selected| | ||
| + | | FileName | ||
| + | | FileType | ||
| + | |FormattedStringBody |The value that was entered in the body section of the custom string if any| | ||
| + | | FormattedStringFooter | ||
| + | | FormattedStringHeader | ||
| + | | StepMessage|During a failure the reason for failure will be populated here | | ||
| + | | StepStatus | ||
| + | |||
| + | ---- | ||
| + | **[[bizweaver: | ||