<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/da/onlinemanual/trg_examples_setup" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Setup at implementation time</Title>
		<Keyword ContextSensitive="No"><Level1>Triggering</Level1>
			<Level2>Example</Level2>
		</Keyword>
		<Keyword ContextSensitive="No"><Level1>i-Flow</Level1>
		</Keyword>
	</Header>
	<GeneralSection><SectionTitle>Introduction</SectionTitle>
		<List><ListIntro>The implementation described here is based on the following assumptions:</ListIntro>
			<ListItem>In the Exchange scheme, the ASCII file name will be equivalent to the table code, and the ASCII field names will be equivalent to the column code.</ListItem>
			<ListItem>A create XML file type of action is defined. This action has a transformation script defined. In that transformation script, the following is programmed: <List><ListItem>The event type is changed: The standard events are replaced by a specific event.</ListItem>
					<ListItem>The class is changed: The table code is replaced with a logical name.</ListItem>
					<ListItem>The attributes that are not required in the output, but that only had to check the condition, are removed.</ListItem>
					<ListItem>The attributes that are required in the output are renamed.</ListItem>
				</List>
			</ListItem>
		</List>
		<Paragraph class="Default">Note that these assumptions are not mandatory. For example, the user can use other, more descriptive ASCII file and field names, which reduces the transformations in the trigger. However, in that case, the limitations of the Exchange module must be taken into account. More specifically, the ASCII file and field names cannot be greater than eight characters in length and the ASCII file names will always be in lowercase.</Paragraph>
		<List><ListIntro>In addition, for the transformation script, you can follow one of the following two approaches:</ListIntro>
			<ListItem>Adhere to the standard event structure. In this case, the incoming event is updated as described previously.</ListItem>
			<ListItem>Use a proprietary structure: In this case, the attribute values are picked up from the incoming event, and a new XML is created. In this case, any XML can be created and can be completely tuned to the needs of the workflow engine that receives the XML files.</ListItem>
		</List>
	</GeneralSection>
	<GeneralSection><SectionTitle>Audit setup</SectionTitle>
		<Paragraph class="Default">Audit is switched on for the tables involved: whwmd215 and tdsls400. For details about Audit Management, refer to the Web Help and to the <DocRef>Infor Enterprise Server 8.5 Technical Manual (U8172 US)</DocRef>.</Paragraph>
		<Important><SectionTitle>
                                 Important!
                              </SectionTitle>
			<Paragraph class="Default">By default, unchanged columns are not audited in case of an update action. As a result, for example, if the <Emphasis>stoc</Emphasis> (inventory on hand) is changed in <Emphasis>whwmd215</Emphasis>, the values for the primary key fields ( <Emphasis>cwar</Emphasis> and <Emphasis>item</Emphasis> ) and the changed field ( <Emphasis>stoc</Emphasis> ) are included, but the unchanged fields are not included. Note that this can impact filtering by conditions, because you cannot check an attribute that is unavailable.</Paragraph>
			<Paragraph class="Default">To avoid this limitation, use the <GUIRef href="/baanerp/tt/aud/ttaud3125m000" role="session">Audit Fields by Table (ttaud3125m000)</GUIRef> session to specify that unchanged fields must be audited (set the audit type to "Always"). For details, refer to "Unchanged table fields" in chapter 2, "To set up triggering".</Paragraph>
		</Important>
	</GeneralSection>
	<GeneralSection><SectionTitle>Exchange scheme setup</SectionTitle>
		<GeneralSection><SectionTitle>Overview</SectionTitle>
			<Paragraph class="Default">A single exchange scheme is created to pick up the relevant changes. As a result, the job for each of these situations runs at the same frequency, which results in less overhead. If the frequency for checking the changes must differ for the tables, you can create multiple batches or exchange schemes.</Paragraph>
			<Paragraph class="Default">The batch includes the two batch lines, covering the following table fields:</Paragraph>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="55" align="left" valign="top" rowspan="1" colspan="1">Table</TH>
						<TD width="80" align="left" valign="top" rowspan="1" colspan="1">tdsls400</TD>
						<TD width="80" align="left" valign="top" rowspan="1" colspan="1">whwmd215</TD>
					</TR>
					<TR><TH width="55" align="left" valign="top" rowspan="1" colspan="1">
							<Paragraph class="Default">Fields</Paragraph>
						</TH>
						<TD width="80" align="left" valign="top" rowspan="1" colspan="1">
							<Paragraph class="Default">orno</Paragraph> <Paragraph class="Default">ofbp</Paragraph> <Paragraph class="Default">sotp</Paragraph> <Paragraph class="Default">corg</Paragraph>
						</TD>
						<TD width="80" align="left" valign="top" rowspan="1" colspan="1">
							<Paragraph class="Default">item</Paragraph> <Paragraph class="Default">stoc</Paragraph> <Paragraph class="Default">allo</Paragraph>
						</TD>
					</TR>
				</TBODY>
			</TABLE>
		</GeneralSection>
		<GeneralSection><SectionTitle>Exchange scheme properties</SectionTitle>
			<TABLE width="52%" border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH align="left" width="195" rowspan="1" colspan="1">Exchange Scheme</TH>
						<TD width="282" rowspan="1" colspan="1">workflow</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Description</TH>
						<TD width="282" rowspan="1" colspan="1">Workflow Scheme for Triggering</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Path for Exchange Objects</TH>
						<TD width="282" rowspan="1" colspan="1">/home/exchange/workflow</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Path for Condition Errors</TH>
						<TD width="282" rowspan="1" colspan="1">/home/exchange/workflow</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Path for Seq. Files</TH>
						<TD width="282" rowspan="1" colspan="1">/home/exchange/workflow</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Path for Definition Files</TH>
						<TD width="282" rowspan="1" colspan="1">/home/exchange/workflow</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Based on Audit</TH>
						<TD width="282" rowspan="1" colspan="1">Yes</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Based on Indicators</TH>
						<TD width="282" rowspan="1" colspan="1">Yes</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Default Date Format</TH>
						<TD width="282" rowspan="1" colspan="1">YYYYDDMM</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Control character y/n</TH>
						<TD width="282" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Separator</TH>
						<TD width="282" rowspan="1" colspan="1">|</TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Enclosing Character</TH>
						<TD width="282" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH align="left" width="195" rowspan="1" colspan="1">Parent Exchange Scheme</TH>
						<TD width="282" rowspan="1" colspan="1"></TD>
					</TR>
				</TBODY>
			</TABLE>
			<Paragraph class="Default">Control character, separator, and enclosing character are irrelevant because no file is created.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Batch properties</SectionTitle>
			<TABLE width="52%" border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH align="left" width="165" rowspan="1" colspan="1">Exchange Scheme</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">workflow (Workflow Scheme for Triggering)</TD>
					</TR>
					<TR><TH align="left" width="165" rowspan="1" colspan="1">Batch</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">BATCH</TD>
					</TR>
					<TR><TH align="left" width="165" rowspan="1" colspan="1">Sequence No.</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">10</TD>
					</TR>
					<TR><TH align="left" width="165" rowspan="1" colspan="1">Description</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">Workflow Export Batch</TD>
					</TR>
					<TR><TH align="left" width="165" rowspan="1" colspan="1">Company</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">996</TD>
					</TR>
					<TR><TH align="left" width="165" rowspan="1" colspan="1">Exchange Using Audit</TH>
						<TD align="left" width="305" rowspan="1" colspan="1">Yes</TD>
					</TR>
				</TBODY>
			</TABLE>
		</GeneralSection>
		<GeneralSection><SectionTitle>ASCII file formats</SectionTitle>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>ASCII file: Item Inventory by Warehouse (whwmd215)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH align="left" width="100" rowspan="1" colspan="1">Field No.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">10</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">20</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">240</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">260</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Field Name</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">Cwar</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Item</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Stoc</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Allo</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Description</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">Warehouse</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Item</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Inventory on Hand</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Allocated Inventory</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Field Type</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">Alphanumeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Alphanumeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Numeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Numeric</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Start Pos</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">1</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">4</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">246</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">286</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Length</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">3</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">16</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">20</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">20</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Date Format</TH>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Floating Dec.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Dec.Pos.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
					</TR>
				</TBODY>
			</TABLE>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>ASCII file Sales Orders 9 (tdsls400)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH align="left" width="100" rowspan="1" colspan="1">Field No.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">10</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">20</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">50</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">70</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Field Name</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">orno</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">ofbp</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">corg</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">sotp</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Description</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">Sales Order</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Customer</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Origin</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Order Type</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Field Type</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">Numeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Alphanumeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Numeric</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">Alphanumeric</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Start Pos</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">1</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">7</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">22</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">28</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Length</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">6</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">6</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">3</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">3</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Date Format</TH>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
						<TD align="left" width="130" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Floating Dec.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH align="left" width="100" rowspan="1" colspan="1">Dec.Pos.</TH>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="130" rowspan="1" colspan="1">0</TD>
					</TR>
				</TBODY>
			</TABLE>
			<Paragraph class="Default">Field Type, Start Position, Length, and so on are irrelevant, because no ASCII file is created.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Table and field relations (export)</SectionTitle>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>Batch: BATCH (Workflow Export Batch)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="130" align="left" rowspan="1" colspan="1">Batch Line</TH>
						<TD width="220" align="left" rowspan="1" colspan="1">10</TD>
						<TD width="220" align="left" rowspan="1" colspan="1">20</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">ASCII File</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">whwmd215</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">tdsls400</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Desc.</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">Item Inventory by Warehouse</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">Sales Orders</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Table</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">whwmd215</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">tdsls400</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">ASCII File Name</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">whwmd215.S</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">tdsls400.S</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Active</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">Yes</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">Yes</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">bdbpre</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">No</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Range</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">No</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Index</TH>
						<TD width="200" align="left" rowspan="1" colspan="1">1</TD>
						<TD width="200" align="left" rowspan="1" colspan="1">1</TD>
					</TR>
					<TR><TH width="120" align="left" rowspan="1" colspan="1">Cond.</TH>
						<TD width="200" align="left" rowspan="1" colspan="1"></TD>
						<TD width="200" align="left" rowspan="1" colspan="1"></TD>
					</TR>
				</TBODY>
			</TABLE>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>Batch: BATCH (Workflow Export Batch)</ListItem>
				<ListItem>Batch Line: 10 (whwmd215)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="130" align="left" rowspan="1" colspan="1">Serial No.</TH>
						<TD width="70" align="left" rowspan="1" colspan="1">10</TD>
						<TD width="70" align="left" rowspan="1" colspan="1">20</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">240</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">260</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Field Name</TH>
						<TD width="70" align="left" rowspan="1" colspan="1">cwar</TD>
						<TD width="70" align="left" rowspan="1" colspan="1">item</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">stoc</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">allo</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Table Field</TH>
						<TD width="70" align="left" rowspan="1" colspan="1">cwar</TD>
						<TD width="70" align="left" rowspan="1" colspan="1">item</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">stoc</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">allo</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Array Element</TH>
						<TD width="70" align="left" rowspan="1" colspan="1">0</TD>
						<TD width="70" align="left" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Condition</TH>
						<TD width="70" align="left" rowspan="1" colspan="1"></TD>
						<TD width="70" align="left" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Fixed value</TH>
						<TD width="70" align="left" rowspan="1" colspan="1"></TD>
						<TD width="70" align="left" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
					</TR>
				</TBODY>
			</TABLE>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>Batch: BATCH (Workflow Export Batch)</ListItem>
				<ListItem>Batch Line: 20 (tdsls400)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH align="left" width="130" rowspan="1" colspan="1">Serial No.</TH>
						<TD align="left" width="70" rowspan="1" colspan="1">10</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">20</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">50</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">70</TD>
					</TR>
					<TR><TH align="left" width="130" rowspan="1" colspan="1">Field Name</TH>
						<TD align="left" width="70" rowspan="1" colspan="1">orno</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">ofbp</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">corg</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">sotp</TD>
					</TR>
					<TR><TH align="left" width="130" rowspan="1" colspan="1">Table Field</TH>
						<TD align="left" width="70" rowspan="1" colspan="1">orno</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">ofbp</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">corg</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">sotp</TD>
					</TR>
					<TR><TH align="left" width="130" rowspan="1" colspan="1">Array Element</TH>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
						<TD align="left" width="70" rowspan="1" colspan="1">0</TD>
					</TR>
					<TR><TH align="left" width="130" rowspan="1" colspan="1">Condition</TH>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH align="left" width="130" rowspan="1" colspan="1">Fixed value</TH>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
						<TD align="left" width="70" rowspan="1" colspan="1"></TD>
					</TR>
				</TBODY>
			</TABLE>
		</GeneralSection>
		<GeneralSection><SectionTitle>Export triggers</SectionTitle>
			<List><ListItem>Exchange Scheme: workflow (Workflow Scheme for Triggering)</ListItem>
				<ListItem>Batch: BATCH (Workflow Export Batch)</ListItem>
			</List>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="220" align="left" rowspan="1" colspan="1">Batch Line</TH>
						<TD width="130" align="left" rowspan="1" colspan="1">10</TD>
						<TD width="130" align="left" rowspan="1" colspan="1">20</TD>
					</TR>
					<TR><TH width="220" align="left" rowspan="1" colspan="1">Trigger for Each Row</TH>
						<TD width="130" align="left" rowspan="1" colspan="1">wf_inventory</TD>
						<TD width="130" align="left" rowspan="1" colspan="1">wf_salesorder</TD>
					</TR>
					<TR><TH width="220" align="left" rowspan="1" colspan="1">Create ASCII File</TH>
						<TD width="130" align="left" rowspan="1" colspan="1">No</TD>
						<TD width="130" align="left" rowspan="1" colspan="1">No</TD>
					</TR>
					<TR><TH width="220" align="left" rowspan="1" colspan="1">Trigger for Batch Line End</TH>
						<TD width="130" align="left" rowspan="1" colspan="1"></TD>
						<TD width="130" align="left" rowspan="1" colspan="1"></TD>
					</TR>
				</TBODY>
			</TABLE>
		</GeneralSection>
		<GeneralSection><SectionTitle>Optimizations</SectionTitle>
			<Paragraph class="Default">If required, to implement optimizations, you can move conditions from the Trigger to the Exchange scheme. For example, you can create a range for batch line 20 ( <DocRef>tdsls400</DocRef> ) on the <DocRef>corg</DocRef> (origin) column to only include sales orders created by means of EDI. This reduces the number of XML events that the Exchange module creates. Note, however, that the Exchange export cannot filter on action type, in this example, only include inserts, skip updates, and deletes.</Paragraph>
		</GeneralSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Application customization</SectionTitle>
		<Paragraph class="Default">To perform the implementation, you must customize the function(s) that check the credit limit of a Business Partner, which is used in the sales order related program scripts. The customization adds a check to see whether 80 percent of the credit limit is exceeded. If so, the function creates an event and invokes a trigger.</Paragraph>
		<Note><SectionTitle>
                                 Note
                              </SectionTitle>
			<Paragraph class="Default">You must check that the previous value of the Credit in Use did not exceed the 80 percent threshold. Otherwise, the process will be triggered multiple times for the same customer, which is undesirable.</Paragraph>
		</Note>
		<Paragraph class="Default">If the trigger you invoke is not in use for any other events, no conditions must be defined. The action that you must take is to create a file that contains the XML event.</Paragraph>
		<GeneralSection><SectionTitle>Implementation</SectionTitle>
			<Note><SectionTitle>
                                    Note
                                 </SectionTitle>
				<Paragraph class="Default">The information in this document is for educational purposes only, by way of example. The information is not intended to describe a complete and tested solution that will work in a live Infor ERP LN 6.1 environment.</Paragraph>
			</Note>
			<Paragraph class="Default">Assume that a library exists that contains a function to check the credit limit. Further assume that the following variables are available in that function:</Paragraph>
			<List><ListItem>invoice.to.bp: the business partner (customer) to which the invoice must be sent</ListItem>
				<ListItem>order.number: The sales order being processed</ListItem>
				<ListItem>credit.limit: The business partner’s credit limit</ListItem>
				<ListItem>old.credit.in.use: The credit already used before processing the sales order</ListItem>
				<ListItem>new.credit.in.use: The old.credit.in.use plus the order amount for the new sales order</ListItem>
			</List>
			<Paragraph class="Default">The original version of the library function contains the following code:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">if new.credit.in.use &gt; credit.limit then
        return(true) | credit limit exceeded
    else
        return(false) | credit limit not exceeded
endif
</CodeBlock>
			<Paragraph class="Default">In a customized version of library, if the usual credit limit check is passed, the 80 percent check is carried out:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">if new.credit.in.use &gt; credit.limit then
        return(true) | credit limit exceeded
    else
        if new.credit.in.use &gt; 0.8 * credit.limit and
           old.credit.in.use &lt;= 0.8 * credit.limit
        then
            generate.credit.trigger(invoice.to.bp,
                        order.number,
                        credit.limit,
                        old.credit.in.use,
                        new.credit.in.use)
        endif
        return(false) | credit limit not exceeded
endif
</CodeBlock>
			<Paragraph class="Default">At the end of the DLL, the following function is added:</Paragraph>
			<CodeBlock space-and-orientation="indented-estimated">function generate.credit.trigger(
            domain  tccom.bpid  i.invoice.to.bp,
            domain  tcorno  i.order.number,
            domain  tcamnt  i.credit.limit,
            domain  tcamnt  i.old.credit.in.use,
            domain  tcamnt  i.new.credit.in.use)
{
#pragma used dll odatrgapi
#pragma used dll odatrgevent

#define MY_TRIGGER  "credit"
#define ERR_IF_NONZERO(value)
^           if value &lt;&gt; 0 then
^               | here some error logging can be implemented, 
^               | for example
^               return
^           endif

    long    event       |tree containing trigger event
    long    retl            |return value to be checked
    string  error.mess(256) |error message from trigger
    string  error.details(256)  |error details from trigger

    |add event to trigger
    retl = datrgevent.simpleevent.create("Customer", 
                    "creditLimitIsNear", event)
    ERR_IF_NONZERO(retl)
    retl = datrgevent.simpleevent.set.value(event,
            "customerID", i.invoice.to.bp)
    ERR_IF_NONZERO(retl)
    retl = datrgevent.simpleevent.set.value(event,
            "orderNumber", str$(i.order.number))
    ERR_IF_NONZERO(retl)
    retl = datrgevent.simpleevent.set.value(event,
            "creditLimit", str$(i.credit.limit))
    ERR_IF_NONZERO(retl)
    retl = datrgevent.simpleevent.set.value(event,
            "creditInIse", str$(i.new.credit.in.use))
    ERR_IF_NONZERO(retl)
    retl = datrgevent.simpleevent.set.old.value(event,
            "creditInUse", str$(i.old.credit.in.use))
    ERR_IF_NONZERO(retl)

    |invoke trigger
    retl = datrgapi.trigger.do(MY_TRIGGER, event, 
                    error.mess, error.details)
    ERR_IF_NONZERO(retl)
}
</CodeBlock>
		</GeneralSection>
	</GeneralSection>
	<GeneralSection><SectionTitle>Trigger setup</SectionTitle>
		<GeneralSection><SectionTitle>Triggers</SectionTitle>
			<List><ListIntro>Assume that the following three triggers are defined:</ListIntro>
				<ListItem>wf_inventory (for whwmd215)</ListItem>
				<ListItem>wf_salesorder (for tdsls400)</ListItem>
				<ListItem>wf_creditlimit (for the application trigger)</ListItem>
			</List>
		</GeneralSection>
		<GeneralSection><SectionTitle>Trigger conditions</SectionTitle>
			<Paragraph class="Default">In the trigger conditions, you do not have to check the class or table code. If a single trigger was used for multiple classes, you must include the class condition, and you must have the same action performed for each class.</Paragraph>
			<Paragraph class="Default">The following conditions are defined:</Paragraph>
			<Paragraph class="Default"><GUIRef href="" role="manual">Trigger wf_salesorder:</GUIRef>
			</Paragraph>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="130" align="left" rowspan="1" colspan="1">Seq Nr</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">10</TD>
						<TD width="100" align="left" rowspan="1" colspan="1">20</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">And/Or</TH>
						<TD width="100" align="left" rowspan="1" colspan="1"></TD>
						<TD width="100" align="left" rowspan="1" colspan="1">And</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Condition Type</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">Event Type</TD>
						<TD width="100" align="left" rowspan="1" colspan="1">Attribute</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Attribute</TH>
						<TD width="100" align="left" rowspan="1" colspan="1"></TD>
						<TD width="100" align="left" rowspan="1" colspan="1">corg</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Operator</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">=</TD>
						<TD width="100" align="left" rowspan="1" colspan="1">=</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Value</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">create</TD>
						<TD width="100" align="left" rowspan="1" colspan="1">3</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Becomes</TH>
						<TD width="100" align="left" rowspan="1" colspan="1"></TD>
						<TD width="100" align="left" rowspan="1" colspan="1">No</TD>
					</TR>
				</TBODY>
			</TABLE>
			<Paragraph class="Default"><GUIRef href="" role="manual">Trigger wf_inventory:</GUIRef>
			</Paragraph>
			<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><TBODY><TR><TH width="130" align="left" rowspan="1" colspan="1">Seq Nr</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">10</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">And/Or</TH>
						<TD width="100" align="left" rowspan="1" colspan="1"></TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Condition Type</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">Attribute</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Attribute</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">stoc</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Operator</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">&lt;</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Value</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">20</TD>
					</TR>
					<TR><TH width="130" align="left" rowspan="1" colspan="1">Becomes</TH>
						<TD width="100" align="left" rowspan="1" colspan="1">Yes</TD>
					</TR>
				</TBODY>
			</TABLE>
			<Paragraph class="Default">Trigger wf_creditlimit will not have any conditions specified, because the conditions are checked in the application.</Paragraph>
		</GeneralSection>
		<GeneralSection><SectionTitle>Trigger actions</SectionTitle>
			<Paragraph class="Default">For each trigger, a create XML file action is specified. The local path, file transfer program, and target path are defined.</Paragraph>
			<Paragraph class="Default">Additionally, if required, a transformation script is defined that translates the generic event into an event that the workflow engine can understand.</Paragraph>
			<Paragraph class="Default">The minimum requirement will likely be simply to rename the event type into a specific event to enable the workflow engine to detect what event occurred. Note that the class and standard event type are insufficient. The event type will always be Create, Change, or Delete, and the class is not unique because two changes on the same table/class can result in two different workflow processes. If you do not rename the event, the workflow engine must duplicate the conditions as defined for the triggers.</Paragraph>
			<Paragraph class="Default">In addition, the attributes must be renamed to UDAs that the workflow engine knows. The previous values can be moved to give the values a unique name. For more information, refer to "XML used at runtime," later in this chapter for examples.</Paragraph>
			<Paragraph class="Default">Finally, rather than use the standard event structure, the transformation script can build up a new event structure.</Paragraph>
		</GeneralSection>
	</GeneralSection>
</ManualTopic>
