<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/da/onlinemanual/000100" xml:lang="en">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">Functions</Title>
		<Keyword ContextSensitive="No"><Level1>function</Level1>
		</Keyword>
	</Header>
	<AimSection><Paragraph class="Default">This document describes the predefined <Link href="/baanerp/tt/glossary/glossary#100056" role="glossary">functions</Link> that are available in the Exchange <Link href="/baanerp/tt/glossary/glossary#100004" role="glossary">module</Link>.</Paragraph>
	</AimSection>
	<GeneralSection><List><ListIntro>The following functions are available:</ListIntro>
			<ListItem><Link href="#get.xch.scheme" role="internal">get.xch.scheme()</Link>
			</ListItem>
			<ListItem><Link href="#get.batch" role="internal">get.batch()</Link>
			</ListItem>
			<ListItem><Link href="#get.batch.line" role="internal">get.batch.line()</Link>
			</ListItem>
			<ListItem><Link href="#get.default.dateformat" role="internal">get.default.dateformat()</Link>
			</ListItem>
			<ListItem><Link href="#qdb.search" role="internal">qdb.search()</Link>
			</ListItem>
			<ListItem><Link href="#read.table" role="internal">read.table()</Link>
			</ListItem>
			<ListItem><Link href="#read.table.once" role="internal">read.table.once()</Link>
			</ListItem>
			<ListItem><Link href="#read.table.company" role="internal">read.table.company()</Link>
			</ListItem>
			<ListItem><Link href="#log.mess" role="internal">log.mess()</Link>
			</ListItem>
			<ListItem><Link href="#do.not.log.condition" role="internal">do.not.log.condition()</Link>
			</ListItem>
			<ListItem><Link href="#do.not.export.record" role="internal">do.not.export.record()</Link>
			</ListItem>
		</List>
	</GeneralSection>
	<GeneralSection ID="get.xch.scheme"><SectionTitle>get.xch.scheme()</SectionTitle>
		<Paragraph class="Default"><GUIRef href="" role="manual">SYNOPSYS</GUIRef>
		</Paragraph>
		<Paragraph class="Default">domain daxch.cxch get.xch.scheme()</Paragraph>
		<Paragraph class="Default"><GUIRef href="" role="manual">DESCRIPTION</GUIRef>
		</Paragraph>
		<Paragraph class="Default">This function returns the exchange scheme code that is currently being exchanged.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="get.batch"><SectionTitle>get.batch()</SectionTitle>
		<Paragraph class="Default">SYNOPSYS domain daxch.cbat get.batch()</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function returns the batch code that is currently being exchanged.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="get.batch.line"><SectionTitle>get.batch.line()</SectionTitle>
		<Paragraph class="Default">SYNOPSYS domain daxch.batl get.batchline()</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function returns the batch line id that is currently being exchanged.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="get.default.dateformat"><SectionTitle>get.default.dateformat()</SectionTitle>
		<Paragraph class="Default">SYNOPSYS domain daxch.dfor get.default.dateformat()</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function gets the default date format of the exchange scheme of the current export/import run.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="qdb.search"><SectionTitle>qdb.search()</SectionTitle>
		<Paragraph class="Default">SYNOPSIS qdb.search("table", index, keyfield1, ...)</Paragraph>
		<List><ListIntro>Conditions of usage:</ListIntro>
			<ListItem>Only spaces are permitted before qdb.search() (no tabs)</ListItem>
			<ListItem>There should not be a space between qdb.search and the first parenthesis</ListItem>
			<ListItem>the format of the table is ppmmmnnn pp=package mmm=module nnn=table number The table name must be written between quotes (")</ListItem>
			<ListItem>Index must be a numeric constant</ListItem>
			<ListItem>values are separated by commas</ListItem>
			<ListItem>a value should not be split over two lines; however the complete construction may be split after a comma.</ListItem>
			<ListItem>Do not use comments in the construction</ListItem>
			<ListItem>Expressions are allowed, but usage of commas in this are not allowed. So, the following example is NOT allowed: qdb.search(daxch010, 1, max(200, 300)) For that reason it is advisable to use variables or defines to avoid this problem.</ListItem>
			<ListItem>String constants may contain commas.</ListItem>
			<ListItem>If the last character on a line is the closing parenthesis character ()), it will be seen as the closing character for the qdb.search() call. If however, on the following lines the qdb.search() call continues, place the comma behind it, instead of letting it be the first character on the next line: <List><ListIntro>
                                       Example
                                    </ListIntro>
					<ListItem>Wrong: qdb.search(daxch002, 1, get.xch.scheme() ascii.file)</ListItem>
				</List> <List><ListItem>OK: qdb.search(daxch002, 1, get.xch.scheme(), ascii.file)</ListItem>
				</List>
			</ListItem>
			<ListItem>String constants should not be used in an expression.</ListItem>
		</List>
		<List><ListIntro>DESCRIPTION A qdb.search function call is during generation expanded into a:</ListIntro>
			<ListItem>db.change.order()</ListItem>
			<ListItem>a number of keyfield assignments</ListItem>
			<ListItem>a db.eq() call</ListItem>
		</List>
		<Paragraph class="Default">If it is not possible to fill all keyfields with the arguments supplied, will the remaining keyfields be emptied (with a set.min()) and will a db.ge() call be executed instead of a db.eq().</Paragraph>
		<Paragraph class="Default">You can test the result of the qdb.search() call by inspecting the variable e.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="read.table"><SectionTitle>read.table()</SectionTitle>
		<Paragraph class="Default">FUNCTION NAME READ.TABLE - Function for reading a table</Paragraph>
		<Paragraph class="Default">SYNOPSYS long READ.TABLE(const string tablename, long index.no, key.field1 [, key.field2, key.field3, ...])</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function is used to read a record from a table once per batch i.s.o. once per batch line. The argument tablename is a table name and should be declared separately and should NOT be preceded by the character "t". If the table name is given literally it must be enclosed in double quotes. Argument index.no is the index number on which the table has to be read. Remaining arguments are values of the key fields in respective order. Hence at least three arguments are necessary to read the table. The function reads the table specified in the argument 'tablename' for the import or export company (for import or export data respectively). In this function a table is read with key values as defined in the arguments. If not all keyfields are filled with the arguments are the remaining keyfields left empty.</Paragraph>
		<Paragraph class="Default">EXAMPLE: read.ret = READ.TABLE("tiitm001", 1, item) Where 'read.ret' is defined as a long and 'item' is a field name from the ascii file.</Paragraph>
		<Paragraph class="Default">The return values for the function are: 0 : OK - read successful 1 : Error - read unsuccessful</Paragraph>
	</GeneralSection>
	<GeneralSection ID="read.table.once"><SectionTitle>read.table.once()</SectionTitle>
		<Paragraph class="Default">FUNCTION NAME READ.TABLE.ONCE - Function for reading a table only once during the processing of a batch line.</Paragraph>
		<Paragraph class="Default">SYNOPSIS long READ.TABLE.ONCE(string tablename(), long index.no, key.field1 [, key.field2, key.field3, ...])</Paragraph>
		<Paragraph class="Default">DESCRIPTION With this function it is possible to read a record from a table. This will increase the processing speed as the table will NOT be read for every record from the ascii file (like in case of READ.TABLE function). The table will be read only once per batch line. This can be used for parameter tables. The argument tablename is a table name and should be declared separately and should NOT be preceded by "t". If the table name is given literally it must be enclosed in double quotes. The argument index.no is the index number on which the table has to be read. Remaining arguments are values of the key fields in respective order. Hence at least three arguments are necessary to read the table. The data will be read for the company the import or export is being done for.</Paragraph>
		<Paragraph class="Default">EXAMPLE: read.ret = READ.TABLE.ONCE("tcmcs095", 1, "PUR", 5, 0, "hisp") or read.ret = READ.TABLE.ONCE("tiitm001", 1, item) Where 'read.ret' is defined as long and 'item' is a field name from ascii file.</Paragraph>
		<Paragraph class="Default">The return values for the function are: 0 : OK - read successful 1 : Error - read unsuccessful</Paragraph>
	</GeneralSection>
	<GeneralSection ID="read.table.company"><SectionTitle>read.table.company()</SectionTitle>
		<Paragraph class="Default">FUNCTION NAME READ.TABLE.COMPANY - Function for reading a table for a specific company.</Paragraph>
		<Paragraph class="Default">SYNOPSIS long READ.TABLE.COMPANY(string tablename(), long company.no, long index.no, key.field1 [, key.field2, key.field3, ...])</Paragraph>
		<Paragraph class="Default">DESCRIPTION With this function it is possible to read a record from a table of a specific company. The argument tablename is a table name and should be declared separately and should NOT be preceded by "t". If the table name is not given literally it must be enclosed in double quotes. The argument company.no is a company table of which is required to be read. The argument index.no is the index number on which the table has to be read. Remaining arguments are values of the key fields in respective order. If the argument company.no contains the current company number then this function is the same as READ.TABLE function. Hence at least four arguments are necessary to read the table.</Paragraph>
		<Paragraph class="Default">EXAMPLE: read.ret = READ.TABLE.COMPANY("tccom000", 000, 1, comp) Where 'read.ret' is defined as long and 'comp' is a field name from ascii file.</Paragraph>
		<Paragraph class="Default">The return values for the function are: 0 : OK - read successful 1 : Error - read unsuccessful</Paragraph>
	</GeneralSection>
	<GeneralSection ID="log.mess"><SectionTitle>log.mess()</SectionTitle>
		<Paragraph class="Default">FUNCTION NAME log.mess</Paragraph>
		<Paragraph class="Default">SYNOPSYS void log.mess(string messcode, ...)</Paragraph>
		<Paragraph class="Default">The arguments should be the same as for a normal call to the function 'mess' except for the second argument (mode) which should be left out.</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function displays a message on the screen and logs a message in the log file. If the field Wait for &lt;CR&gt; with Messages in the sessions <Link href="/baanerp/da/xch/daxch0223m000" role="session">Import Data (Non-Regular) (daxch0223m000)</Link>, <Link href="/baanerp/da/xch/daxch0224m000" role="session">Import Data (on a Regular Basis) (daxch0224m000)</Link>, <Link href="/baanerp/da/xch/daxch0233m000" role="session">Export Data (Non-Regular) (daxch0233m000)</Link> or <Link href="/baanerp/da/xch/daxch0234m000" role="session">Export Data (on a Regular Basis) (daxch0234m000)</Link> is selected this function waits for &lt;Return&gt;.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="do.not.log.condition"><SectionTitle>do.not.log.condition()</SectionTitle>
		<Paragraph class="Default">FUNCTION NAME do.not.log.condition()</Paragraph>
		<Paragraph class="Default">SYNOPSIS void do.not.log.condition()</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function can be used in conditions that are used on record level to decide whether a specific database action should be executed (e.g. " <GUIRef href="/baanerp/da/xch/daxch0121s000#daxch021.acon" role="manual">Add Condition</GUIRef> "). If such a condition returns false the action is not executed and the record will be logged to the logfile. By calling this function just before returning false, the action will still not be executed, but it will also not be logged. So if your condition rejects the record, it will not be logged as 'condition rejected', but as 'skipped'. This means the number of records in the log file is reduced.</Paragraph>
		<Paragraph class="Default">Use this function when your <GUIRef href="/baanerp/da/xch/daxch0121s000#daxch021.acon" role="manual">Add Condition</GUIRef> does the processing and always returns false.</Paragraph>
	</GeneralSection>
	<GeneralSection ID="do.not.export.record"><SectionTitle>do.not.export.record()</SectionTitle>
		<Paragraph class="Default">DEFINE NAME do.not.export.record()</Paragraph>
		<Paragraph class="Default">SYNOPSIS do.not.export.record()</Paragraph>
		<Paragraph class="Default">Conditions of usage: This function can only be called when exporting. It can be added to a condition specified in daxch0132m000. This function cannot be used when exporting based on audit.</Paragraph>
		<Paragraph class="Default">DESCRIPTION This function prevents the record from being exported. The record is skipped. This limits the size of the exported file and improves performance of the import.</Paragraph>
		<List><ListIntro>Note:</ListIntro>
			<ListItem>Although the record is not exported (i.e. not written to the ascii file), all conditions that have been specified in the field relations (export) are executed.</ListItem>
			<ListItem>The use of 'ranges' is more efficient, so it is advisable to use these wherever possible.</ListItem>
			<ListItem>Skipped records can not be reprocessed; they will be counted as 'skipped' in the log table, but they will not be written to the log file.</ListItem>
		</List>
	</GeneralSection>
	<RelatedTopics><SectionTitle>Related topics</SectionTitle>
		<RelTopic><Link href="/baanerp/da/onlinemanual/000102" role="manual">Libraries</Link>
		</RelTopic>
		<RelTopic><Link href="/baanerp/da/onlinemanual/000101" role="manual">Variables</Link>
		</RelTopic>
	</RelatedTopics>
</ManualTopic>
