<?xml version="1.0" encoding="utf-8"?>
<ManualTopic ID="/baanerp/tt/EnterpriseStudio/onlinemanual/ui_scripts" xml:lang="en" TopicType="Overview">
	<Header>
		<Title xmlns:HTML="http://www.w3.org/TR/REC-html40">UI scripts</Title>
		<Keyword ContextSensitive="No"><Level1>
                                    Infor ERP LN Development Tools
                                 </Level1>
			<Level2>UI script</Level2>
		</Keyword>
		<Keyword ContextSensitive="No"><Level1>
                                    Infor ERP LN Development Tools
                                 </Level1>
			<Level2>Program script</Level2>
		</Keyword>
	</Header>
	<GeneralSection><Paragraph class="Default">The default behavior of a session is handled by the <Link href="/baanerp/tt/glossary/glossary#100092" role="glossary">4GL engine</Link>. If additional functionality is needed or default functionality needs to be by-passed, this should be programmed in a UI script (Program script).</Paragraph>
		<Paragraph class="Default">The UI script is compiled in the object. It is important to note that the object contains only the exceptions to the normal operating procedures of the system. The 4GL Engine executes the normal operating procedures of the system, and you write the exceptions.</Paragraph>
		<Paragraph class="Default">The UI script contains events to hook into the 4GL Engine, and describe the actions that should happen as a result of an event. Events trigger code. When the session runs and an event triggers, the 4GL Engine uses the session object to perform the appropriate actions.</Paragraph>
		<List><ListIntro>Actions that could take place as the result of an event are:</ListIntro>
			<ListItem>Calculate a field value before a field displays.</ListItem>
			<ListItem>Synchronize the current (parent) session with a child session when you run a form command. For example: a parent session that uses the Orders table is synchronized with a child session that uses the Order lines table.</ListItem>
			<ListItem>Send a file to the user’s PC when you save a record.</ListItem>
		</List>
		<Paragraph class="Default">The syntax of the UI script contains complete programming syntax capabilities such as variable declarations, expressions, operators, transfer of control, iterations (loops), functions, embedded SQL, and a full featured functions library.</Paragraph>
		<Note><SectionTitle>
                                    Note
                                 </SectionTitle>
			<Paragraph class="Default">As a developer, you must be diligent to provide only user interface elements in the UI script. Logical integrity and business logic elements will be added in the Data Access Layer (DAL).</Paragraph>
		</Note>
	</GeneralSection>
	<GeneralSection><SectionTitle>Event sections</SectionTitle>
		<Paragraph class="Default">UI scripts consist of one or more event sections in which you program actions to be performed at particular states of execution of the 4GL Engine. It is not necessary to program all sections; only those for which you need to provide the required functionality. The statements programmed in a section can be a combination of 3GL/4GL functions and 3GL statements.</Paragraph>
		<Paragraph class="Default">The event sections are categorized. A section type consists of a main section and, for most section types, subsections. A main section indicates the object for which the programmed actions must be executed. A subsection specifies when the actions must be executed. The section types are:</Paragraph>
		<TABLE border="1" borderstyle="default" space-and-orientation="indented-estimated"><THEAD><TR><TD rowspan="1" colspan="1">Section Type</TD>
					<TD rowspan="1" colspan="1">Main section</TD>
					<TD rowspan="1" colspan="1">Subsections</TD>
				</TR>
			</THEAD>
			<TBODY><TR><TD rowspan="1" colspan="1">Program</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">No</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Zoom From</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Form</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Group</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Choice</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Field</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
				<TR><TD rowspan="1" colspan="1">Main Table</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
					<TD rowspan="1" colspan="1">Yes</TD>
				</TR>
			</TBODY>
		</TABLE>
		<Paragraph class="Default">Field sections are only used for non-table fields, table fields are handled by the DAL script.</Paragraph>
		<Paragraph class="Default">Main table sections must not be used anymore, because the logic for the Main table is done via the DAL.</Paragraph>
		<Paragraph class="Default">For more information, refer to the "Event sections" subtopic in the "4GL Language Features" topic in the <DocRef>ERP LN 6.1 Programmer's Guide</DocRef>. The related help topic for the Flow of the 4GL engine is useful for advanced developers to understand event loops and the sequence of events in the 4GL engine.</Paragraph>
	</GeneralSection>
	<GeneralSection><SectionTitle>To create UI scripts</SectionTitle>
		<Paragraph class="Default">You can create and edit UI scripts in the <GUIRef href="" role="manual">Program Scripts / Libraries (ttadv2530m000)</GUIRef> session. When you create a new session in the <GUIRef href="" role="manual">Sessions (ttadv2500m000)</GUIRef> session, a corresponding UI script is generated automatically.</Paragraph>
	</GeneralSection>
</ManualTopic>
