MakePO
Use this component to produce a string by merging information from the order form with a template, such as creating a purchase order formatted from a purchase order template.
Configuration Values
You can determine how the MakePO component formats the purchase order and where it is written by setting component properties. Use the following boxes on the Make PO tab of the Component Properties dialog box to determine this information.
Box | Description |
Template File Name | The name of the file providing the template for the purchase order. The template is usually a Microsoft Visual Basic Scripting Edition (VBScript) file in a special format described below. |
Script language for the template | The programming language used in the template. The default is VBScript. |
Output Property Name | The name of a field in the order form or Transport dictionary to which the component writes the PO. The default is _po_text . |
Child Object Name | Applies only when the Use Child Object option is set. A child object is an object that is referenced by a key in the Transport dictionary that is passed into the pipeline. The Child Object Name box specifies the key. In a Commerce Interchange pipeline, the order form (business data object) from which the MakePO component generates the purchase order is a child object. |
Use Child Object | Determines the source from which the component reads the purchase order information. Select this option when using a Commerce Interchange pipeline so that the component reads this information from the business data object specified by the value in the Child Object Name box. Clear this check box when using an Order Processing pipeline so that the component reads this information from the order form passed directly into the pipeline. |
Values Read
The MakePO component reads the file indicated in the Template File Name box. The script can read anything available to it.
Values Written
The MakePO component assigns the value to the key in the Transport dictionary indicated in the Output Property Name box. The script may also be written to write out additional values.
Remarks
The MakePO component can be used to dynamically generate a text entry on the OrderForm object (usually a purchase order). The entry is generated from a template file similar to an Active Server Pages (ASP) page. Like an ASP page, a MakePO template contains plain text interspersed with special tags containing script code. From within script, output can be done using PageGen.Print expression, or <%% = expression %%> similar to the ASP shortcut for Response.Write. The script language is configurable in the property page.
From within the MakePO template, the business object (OrderForm object, dictionary, or child object) is exposed as an object with the name Items. The library for the selected scripting language is also extended to include the members of this object as built-in properties, so that referring to the entries of the business object using the Items.xxx notation is possible. For this reason, it is best to declare any temporary variables so that they are not saved in the business object.
The following segment is an example from a template:
Item Class:<%%= item.partclasscode %%>
#:<%%= item.partnumber %%>
Qty:<%%= item.quantity %%>
Cost:<%%= item.[_display_list_price] %%>
Unit Code:<%%= item.unitcode %%>
The PO generated by the MakePO component can be saved to a file using the POtoFile component.
The MakePO component cannot output variant subtype VT_DECIMAL. Any usage of decimal or currency in the MakePO component must be wrapped with a call to the CStr method, which properly coerces the value to a string. For example:
Requisition # <%% = CStr(RequisitionID) %%>
Programmatic Use
To use this component outside of a pipeline, you must configure it by assigning values to keys in the Configuration dictionary. The keys correspond to the indicated boxes on the Component Properties dialog box.
Key | Box | Description |
TemplateFileName |
Template File Name | String. |
TemplateScriptLanguage |
Script language for the template | String. |
OutPropName |
Output Property Name | String. |
ChildObjectName |
Child Object Name | String |
UseChildObject |
Use Chile Object | Numeric.
0 for False, 1 for True. |
For more information about using pipeline components outside of pipelines, see MicroPipe Object.