<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Formspider Learning Center</title>
	<atom:link href="http://theformspider.com/learningcenter/feed/" rel="self" type="application/rss+xml" />
	<link>http://theformspider.com/learningcenter</link>
	<description></description>
	<lastBuildDate>Fri, 18 May 2012 14:20:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>Tutorial 37: How to build a Calendar (Part I)</title>
		<link>http://theformspider.com/learningcenter/tutorial-37-how-to-build-a-calendar-part-i/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-37-how-to-build-a-calendar-part-i/#comments</comments>
		<pubDate>Fri, 18 May 2012 12:14:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[calendar]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1907</guid>
		<description><![CDATA[This tutorial is the first part of the series “How to build a Calendar” tutorials describing how to build a simple calendar.]]></description>
			<content:encoded><![CDATA[<p>This tutorial is the first part of the series “How to build a Calendar” tutorials describing how to build a simple <em>calendar</em> which displays activities existing in a database table. It covers following topics;</p>
<ul>
<li>how to add a calendar component into a panel
<li>how to display activities on the calendar
<li>how to use calendar&#8217;s attributes
</ul>
<p>Note that manipulation of <em>calendar</em> activities such as editing – rescheduling an existing activity or creating a new activity on the <em>calendar</em> are not the subject of this tutorial. These topics are covered in the second part of the series.</p>
<h3>Formspider Calendar</h3>
<p>Formspider <em>calendar</em> is a multifunctional activity scheduler component which allows the user to display and schedule any activity. Activities are presented as small boxes on the <em>calendar</em>. The attributes of a calendar activity are listed below:</p>
<table border="1" align="center">
<tr>
<td><b>Attribute</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td>id</td>
<td>unique identifier of the activity</td>
</tr>
<tr>
<td>startDate</td>
<td>start date of the activity</td>
</tr>
<tr>
<td>endDate</td>
<td>end date of the activity</td>
</tr>
<tr>
<td>title</td>
<td>label displayed on the activity box</td>
</tr>
<tr>
<td>editable</td>
<td>defines whether the activity can be rescheduled by moving – resizing the activity box</td>
</tr>
<tr>
<td>fontColor</td>
<td>font color of the label displayed on the activity box</td>
</tr>
<tr>
<td>backgroundColor</td>
<td>background color of the activity box</td>
</tr>
</table>
<p>The <em>calendar</em> can only display activities provided by a Formspider <em>datasource</em>. Therefore a <em>calendar</em> must always be bound to a <em>datasource</em> in order to display activities. As a result, when an activity is rescheduled by moving or resizing activity boxes or when a new activity is added through <em>calendar</em> APIs, you should reflect these changes to the <em>calendar</em>&#8216;s <em>datasource</em> to make them permanent.</p>
<p>The <em>calendar</em> can display activities in three different views (<b>Day</b>, <b>Week</b> and <b>Month</b>) which makes it able to schedule activities for days, weeks and months. You can use calendar&#8217;s <em>defaultView</em> attribute to set which view mode will be used when the <em>calendar</em> is displayed for the first time. To set the view mode at run time, the user can select one of three available modes located on the right side of the <em>calendar</em>.</p>
<p>Backward/Forward arrows on the left side of the <em>calendar</em> allow the user to move within <em>calendar</em> dates. Each time these arrows are pressed, for the ease of performance, Formspider queries the <em>calendar</em>&#8216;s <em>datasource</em> and fetches only data belonging to the activities which will be displayed on the <em>calendar</em>. Today button enables you to turn to the current date. When the selected view mode is <em>Day</em> or <em>Week</em> hours scale is located on the left side of the <em>calendar</em>.</p>
<p>Formspider <em>calendar</em> provides an advanced drag-and-drop functionality which allows users to change date and time of an activity by easily moving or resizing activity boxes.<br />
<div class="wp-caption aligncenter" style="width: 711px"><img title="Formspider calendar component" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/calendar_calendarGeneral.jpg" alt="" width="701" height="601" /><p class="wp-caption-text">Formspider calendar component</p></div></p>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File” menu</em>, the <em>“New Application” dialog</em> shows up. Enter <em>“calendar”</em> as the name of the application and “HR” as datasource schema name.  If you are using Formspider Online, you do not need to enter database schema name since your account is already configured to use your online database. Leave other fields empty and click <em>“OK”</em>. This creates the <em>“calendar”</em> application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<h3>Creating Model</h3>
<p>Use the following scripts to create a database table holding activity data and insert sample data for the current month;</p>
<pre class="brush: sql; title: ; notranslate">
create table activities
   (activityid                     number not null,
    startdate                      date,
    enddate                        date,
    title                          varchar2(4000),
    editable                       varchar2(1),
    bgcolor                        varchar2(255),
    fontcolor                      varchar2(255))
/

alter table activities
add constraint activities_pk primary key (activityid)
/
</pre>
<pre class="brush: sql; title: ; notranslate">
insert into activities (
        select 1 as activityid, (trunc(sysdate, 'MM') + 5/96) as startdate, (trunc(sysdate, 'MM') + 10/96) as enddate, 'Title of activity 1' as title, 'N' as editable, 'Green' as bgColor, 'White' as fontColor from dual
        union all
        select 2, (trunc(sysdate, 'MM') + 3), (trunc(sysdate, 'MM') + 4), 'Title of activity 2', 'Y' , 'Blue', 'Yellow' from dual
        union all
        select 3, (trunc(sysdate, 'MM') +  139/24), ((trunc(sysdate, 'MM') +  139/24) + 298/96), 'Title of activity 3', 'Y', 'Red', 'Pink' from dual
        union all
        select 4, ((trunc(sysdate, 'MM') + 7) + 3/24), ((trunc(sysdate, 'MM') + 7) + 5/24), 'Title of activity 4', 'Y' , 'Yellow', 'Blue' from dual
        union all
        select 5, ((trunc(sysdate, 'MM') + 14) + 3/96), ((trunc(sysdate, 'MM') + 15) + 10/96), 'Title of activity 5', 'N' , null, null from dual
        union all
        select 6, ((trunc(sysdate, 'MM') + 22) + 50/96), ((trunc(sysdate, 'MM') + 22) + 60/96), 'Title of activity 6', 'Y' , 'Pink', 'Red' from dual
        union all
        select 7, ((trunc(sysdate, 'MM') + 50) + 8/96), ((trunc(sysdate, 'MM') + 50) + 57/96), 'Title of activity 7', 'Y' , null, null from dual
      )
/
commit
</pre>
<p>Create a new <em>datasource definition</em> holding activity data. To achieve this, expand the <em>“Datasource Definitions” accordion</em>, select the <em>“Datasource Definitions”</em> node and click the <em>“+” button</em>. Alternatively, you may right click the <em>“Datasource Definitions”</em> node and select <em>“New”</em> from the pop up menu. The <em>“New Datasource Definition” dialog</em> shows up. Select the <em>“Query”</em> radio button from the <em>“Based On”</em> section and enter “ACTIVITIES” as <em>“Name”</em> of the <em>datasource definition</em>.<br />
<div class="wp-caption aligncenter" style="width: 707px"><img title="Creating “ACTIVITIES” datasource definition" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/calendar_createDSD1.jpg" alt="" width="697" height="294" /><p class="wp-caption-text">Creating “ACTIVITIES” datasource definition</p></div></p>
<p>Select <em>“Query”</em> node in the navigation tree on the left. Enter the following SQL Statement:</p>
<pre class="brush: sql; title: ; notranslate">
select ACTIVITYID
      ,STARTDATE
      ,ENDDATE
      ,TITLE
      ,EDITABLE
      ,BGCOLOR
      ,FONTCOLOR
from ACTIVITIES
</pre>
<div class="wp-caption aligncenter" style="width: 708px"><img title="Entering Query for “ACTIVITIES” datasource definition" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/calendar_createDSD2.jpg" alt="" width="698" height="525" /><p class="wp-caption-text">Entering Query for “ACTIVITIES” datasource definition</p></div>
<p>Click <em>“OK”</em> to save and close the <em>“New Datasource Definition” dialog</em>. This creates the <em>“ACTIVITIES” datasource definition</em> and the <em>“ACTIVITIES1″ datasource</em>.</p>
<h3>Creating UI</h3>
<p>Expand the <em>“Panels”</em> node from the <em>“Containers”</em> tree and double click the <em>“mainPanel”</em> to open it in the editor. Add a <em>calendar</em> bound to the <em>“ACTIVITIES1” datasource</em>. Note that <em>idColumn</em>, <em>startDateColumn</em>, <em>endDateColumn</em>, <em>titleColumn</em>, <em>editableColumn</em>, <em>fontColorColumn</em> and <em>backgroundColorColumn</em> attributes are used to adjust the properties of the <em>calendar</em> activities. The <em>firstDayOfWeek</em> attribute specifies the day of the week to display in the first day column of the <em>calendar</em>. The <em>“mainPanel”</em> XML should look like the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;calendar name=&quot;calendar&quot; firstDayOfWeek=&quot;Monday&quot; defaultView=&quot;Month&quot; dataSource=&quot;ACTIVITIES1&quot; idColumn=&quot;ACTIVITYID&quot; startDateColumn=&quot;STARTDATE&quot; endDateColumn=&quot;ENDDATE&quot; titleColumn=&quot;TITLE&quot; editableColumn=&quot;EDITABLE&quot; fontColorColumn=&quot;FONTCOLOR&quot; backgroundColorColumn=&quot;BGCOLOR&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p>Expand the “Windows” node and then the “Mainframe” node from the “Containers”tree. Double click to the “mainFrame” node to open it on the editor and set the value of the <em>maximizeOnStartUp</em> attribute to “Y”:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;mainframe title=&quot;calendar&quot; width=&quot;500&quot; height=&quot;500&quot; maximizeOnStartUp=&quot;Y&quot;&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;include panelName=&quot;mainPanel&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/mainframe&gt;
</pre>
<p>Press <em>“Run on Web” button</em> to run your application. Note that the <em>calendar</em> is displayed in month view and “Monday” is the first day of the week. Also, note that the activities are displayed on the <em>calendar</em> as expected.<br />
<div class="wp-caption aligncenter" style="width: 711px"><img title="The activities are displayed on the calendar" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/calendar_appRun.jpg" alt="" width="701" height="601" /><p class="wp-caption-text">The activities are displayed on the calendar</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-37-how-to-build-a-calendar-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 36: How to use a Web Service in a Formspider Application</title>
		<link>http://theformspider.com/learningcenter/tutorial-36-how-to-use-a-web-service-in-a-formspider-application/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-36-how-to-use-a-web-service-in-a-formspider-application/#comments</comments>
		<pubDate>Mon, 14 May 2012 10:59:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1874</guid>
		<description><![CDATA[This tutorial describes how to use a web service in a Formspider application.]]></description>
			<content:encoded><![CDATA[<p>This tutorial describes how to use a web service in a Formspider application. It shows how to build an application displaying current weather report for the selected state invoking  an external web service from U.S. National Weather Service (<a href="http://graphical.weather.gov/" target="_blank">NWS</a>). <a href="http://formspideronline.com/formspider/main.html?name=DemoMain#DemoWebService" target="_blank">Click here to run the completed application.</a></p>
<h3>Sample Web Service Definition</h3>
<p>NWS provides a web service containing various functions allowing public, government agencies and commercial enterprises to access data from the National Digital Forecast Database (NDFD). See the link below for the detailed information and the complete list of functions provided by NWS web service;<br />
<a href="http://graphical.weather.gov/xml/" target="_blank">http://graphical.weather.gov/xml/</a></p>
<p>Also, you can access to the web service description from the link below;<br />
<a href="http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl" target="_blank">http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl</a></p>
<p>This tutorial uses <b>NDFDgenByDay()</b> function defined as a part of NWS web service. This function returns NDFD data for a specified point (identified by its latitude and its longitude), starting from a specified date. A sample SOAP request for the NDFDgenByDay() interface is as the following:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;soapenv:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ndf=&quot;http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl&quot;&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;ndf:NDFDgenByDay soapenv:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;
         &lt;latitude xsi:type=&quot;xsd:decimal&quot;&gt;27.766279&lt;/latitude&gt;
         &lt;longitude xsi:type=&quot;xsd:decimal&quot;&gt;-81.686782&lt;/longitude&gt;
         &lt;startDate xsi:type=&quot;xsd:date&quot;&gt;2012-05-11&lt;/startDate&gt;
         &lt;numDays xsi:type=&quot;xsd:integer&quot;&gt;1&lt;/numDays&gt;
         &lt;Unit xsi:type=&quot;dwml:unitType&quot; xmlns:dwml=&quot;http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd&quot;&gt;m&lt;/Unit&gt;
         &lt;format xsi:type=&quot;dwml:formatType&quot; xmlns:dwml=&quot;http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd&quot;&gt;24 hourly&lt;/format&gt;
      &lt;/ndf:NDFDgenByDay&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;
</pre>
<p>The SOAP response returned for the sample request above is:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;
   &lt;SOAP-ENV:Body&gt;
      &lt;ns1:NDFDgenByDayResponse xmlns:ns1=&quot;http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl&quot;&gt;
         &lt;dwmlByDayOut xsi:type=&quot;xsd:string&quot;&gt;&lt;![CDATA[&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;dwml version=&quot;1.0&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd&quot;&gt;
  &lt;head&gt;
    &lt;product srsName=&quot;WGS 1984&quot; concise-name=&quot;dwmlByDay&quot; operational-mode=&quot;official&quot;&gt;
      &lt;title&gt;NOAA's National Weather Service Forecast by 24 Hour Period&lt;/title&gt;
      &lt;field&gt;meteorological&lt;/field&gt;
      &lt;category&gt;forecast&lt;/category&gt;
      &lt;creation-date refresh-frequency=&quot;PT1H&quot;&gt;2012-05-11T11:39:49Z&lt;/creation-date&gt;
    &lt;/product&gt;
    &lt;source&gt;
      &lt;more-information&gt;http://graphical.weather.gov/xml/&lt;/more-information&gt;
      &lt;production-center&gt;Meteorological Development Laboratory&lt;sub-center&gt;Product Generation Branch&lt;/sub-center&gt;&lt;/production-center&gt;
      &lt;disclaimer&gt;http://www.nws.noaa.gov/disclaimer.html&lt;/disclaimer&gt;
      &lt;credit&gt;http://www.weather.gov/&lt;/credit&gt;
      &lt;credit-logo&gt;http://www.weather.gov/images/xml_logo.gif&lt;/credit-logo&gt;
      &lt;feedback&gt;http://www.weather.gov/feedback.php&lt;/feedback&gt;
    &lt;/source&gt;
  &lt;/head&gt;
  &lt;data&gt;
    &lt;location&gt;
      &lt;location-key&gt;point1&lt;/location-key&gt;
      &lt;point latitude=&quot;27.77&quot; longitude=&quot;-81.69&quot;/&gt;
    &lt;/location&gt;
    &lt;moreWeatherInformation applicable-location=&quot;point1&quot;&gt;http://forecast.weather.gov/MapClick.php?textField1=27.77&amp;amp;textField2=-81.69&lt;/moreWeatherInformation&gt;
    &lt;time-layout time-coordinate=&quot;local&quot; summarization=&quot;24hourly&quot;&gt;
      &lt;layout-key&gt;k-p24h-n1-1&lt;/layout-key&gt;
      &lt;start-valid-time&gt;2012-05-11T06:00:00-04:00&lt;/start-valid-time&gt;
      &lt;end-valid-time&gt;2012-05-12T06:00:00-04:00&lt;/end-valid-time&gt;
    &lt;/time-layout&gt;
    &lt;time-layout time-coordinate=&quot;local&quot; summarization=&quot;12hourly&quot;&gt;
      &lt;layout-key&gt;k-p12h-n2-2&lt;/layout-key&gt;
      &lt;start-valid-time&gt;2012-05-11T06:00:00-04:00&lt;/start-valid-time&gt;
      &lt;end-valid-time&gt;2012-05-11T18:00:00-04:00&lt;/end-valid-time&gt;
      &lt;start-valid-time&gt;2012-05-11T18:00:00-04:00&lt;/start-valid-time&gt;
      &lt;end-valid-time&gt;2012-05-12T06:00:00-04:00&lt;/end-valid-time&gt;
    &lt;/time-layout&gt;
    &lt;time-layout time-coordinate=&quot;local&quot; summarization=&quot;24hourly&quot;&gt;
      &lt;layout-key&gt;k-p1d-n1-3&lt;/layout-key&gt;
      &lt;start-valid-time&gt;2012-05-11T06:00:00-04:00&lt;/start-valid-time&gt;
      &lt;end-valid-time&gt;2012-05-12T06:00:00-04:00&lt;/end-valid-time&gt;
    &lt;/time-layout&gt;
    &lt;parameters applicable-location=&quot;point1&quot;&gt;
      &lt;temperature type=&quot;maximum&quot; units=&quot;Celsius&quot; time-layout=&quot;k-p24h-n1-1&quot;&gt;
        &lt;name&gt;Daily Maximum Temperature&lt;/name&gt;
        &lt;value&gt;32&lt;/value&gt;
      &lt;/temperature&gt;
      &lt;temperature type=&quot;minimum&quot; units=&quot;Celsius&quot; time-layout=&quot;k-p24h-n1-1&quot;&gt;
        &lt;name&gt;Daily Minimum Temperature&lt;/name&gt;
        &lt;value&gt;18&lt;/value&gt;
      &lt;/temperature&gt;
      &lt;probability-of-precipitation type=&quot;12 hour&quot; units=&quot;percent&quot; time-layout=&quot;k-p12h-n2-2&quot;&gt;
        &lt;name&gt;12 Hourly Probability of Precipitation&lt;/name&gt;
        &lt;value&gt;10&lt;/value&gt;
        &lt;value&gt;5&lt;/value&gt;
      &lt;/probability-of-precipitation&gt;
      &lt;weather time-layout=&quot;k-p24h-n1-1&quot;&gt;
        &lt;name&gt;Weather Type, Coverage, and Intensity&lt;/name&gt;
        &lt;weather-conditions weather-summary=&quot;Partly Sunny&quot;/&gt;
      &lt;/weather&gt;
      &lt;conditions-icon type=&quot;forecast-NWS&quot; time-layout=&quot;k-p24h-n1-1&quot;&gt;
        &lt;name&gt;Conditions Icons&lt;/name&gt;
        &lt;icon-link&gt;http://www.nws.noaa.gov/weather/images/fcicons/sct.jpg&lt;/icon-link&gt;
      &lt;/conditions-icon&gt;
      &lt;hazards time-layout=&quot;k-p1d-n1-3&quot;&gt;
        &lt;name&gt;Watches, Warnings, and Advisories&lt;/name&gt;
        &lt;hazard-conditions xsi:nil=&quot;true&quot;/&gt;
      &lt;/hazards&gt;
    &lt;/parameters&gt;
  &lt;/data&gt;
&lt;/dwml&gt;]]&gt;&lt;/dwmlByDayOut&gt;
      &lt;/ns1:NDFDgenByDayResponse&gt;
   &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;
</pre>
<h3>Consuming the Web Service</h3>
<p>In your datasource schema, create a package called <em>“webservice_pkg”</em> and open your newly created <em>“webservice_pkg”</em> package in your favorite PL/SQL Editor. Add a function named <em>“genCurrentWeatherReportXML”</em> and ensure that it&#8217;s exposed in the package specification. This function creates a SOAP request for the given latitude-longitude pair and invoke the <em>NDFDgenByDay</em> function. It uses utl_http package to consume the web service and  returns the complete NDFD data (SOAP response body) in XMLType format.</p>
<pre class="brush: sql; title: ; notranslate">
function genCurrentWeatherReportXML(in_latitude_nr number, in_longitude_nr number) return xmltype
as
  v_soapRequest_tx        varchar2(32767);
  v_soapResponseChunk_tx  varchar2(32767);
  v_NDFDData_xml          XMLType;
  v_httpResponse          utl_http.resp;
  v_httpRequest           utl_http.req;
  v_soapResponse_cl       clob;
  v_bufferSize_nr         number                 := 32766;
  v_endPointURL_tx        constant varchar2(255) := 'http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php';
  -- fixed web service parameters
  v_startDate_tx          constant varchar2(255) := ''; -- earliest date available in NDFD
  v_numDays_nr            constant number        := 1;
  v_unit_tx               constant varchar2(1)   := 'm';
  v_format_tx             constant varchar2(255) := '24 hourly';
begin

  if in_latitude_nr is not null and in_longitude_nr is not null then

    dbms_lob.createtemporary(v_soapResponse_cl, false);

    -- create SOAP request
    v_soapRequest_tx :=
    '&lt;soapenv:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ndf=&quot;http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl&quot;&gt;' ||
      '&lt;soapenv:Header/&gt;' ||
      '&lt;soapenv:Body&gt;' ||
          '&lt;ndf:NDFDgenByDay soapenv:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;' ||
              '&lt;latitude xsi:type=&quot;xsd:decimal&quot;&gt;' || in_latitude_nr ||'&lt;/latitude&gt;' ||
              '&lt;longitude xsi:type=&quot;xsd:decimal&quot;&gt;' || in_longitude_nr ||'&lt;/longitude&gt;' ||
              '&lt;startDate xsi:type=&quot;xsd:date&quot;&gt;' || v_startDate_tx || '&lt;/startDate&gt;' ||
              '&lt;numDays xsi:type=&quot;xsd:integer&quot;&gt;' || v_numDays_nr || '&lt;/numDays&gt;' ||
              '&lt;Unit xsi:type=&quot;dwml:unitType&quot; xmlns:dwml=&quot;http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd&quot;&gt;' || v_unit_tx || '&lt;/Unit&gt;' ||
              '&lt;format xsi:type=&quot;dwml:formatType&quot; xmlns:dwml=&quot;http://graphical.weather.gov/xml/DWMLgen/schema/DWML.xsd&quot;&gt;' || v_format_tx || '&lt;/format&gt;' ||
          '&lt;/ndf:NDFDgenByDay&gt;' ||
      '&lt;/soapenv:Body&gt;' ||
    '&lt;/soapenv:Envelope&gt;';

    -- invoke web service
    v_httpRequest:= utl_http.begin_request(v_endPointURL_tx, 'POST', 'HTTP/1.1');
    utl_http.set_header(v_httpRequest, 'Content-Type', 'text/xml');
    utl_http.set_header(v_httpRequest, 'Content-Length', length(v_soapRequest_tx));
    utl_http.set_header(v_httpRequest, 'SOAPAction', '');
    utl_http.write_text(v_httpRequest, v_soapRequest_tx);
    v_httpResponse:= utl_http.get_response(v_httpRequest);

    -- read web service response into clob
    begin
      loop
        utl_http.read_text(v_httpResponse, v_soapResponseChunk_tx, v_bufferSize_nr);
        dbms_lob.writeappend(v_soapResponse_cl, length(v_soapResponseChunk_tx), v_soapResponseChunk_tx);
      end loop;
    exception
      when utl_http.end_of_body then
        utl_http.end_response(v_httpResponse);
    end;

    -- extract CDATA section from the web service response xml
    v_soapResponse_cl := XMLType.createXML(v_soapResponse_cl).extract('//text()').getClobVal();
    -- decode extracted response XML and create an XMLType variable containing this  XML
    v_NDFDData_xml := XMLType.createXML(dbms_xmlgen.convert(v_soapResponse_cl, dbms_xmlgen.ENTITY_DECODE));
  end if;

  return v_NDFDData_xml;
end;
</pre>
<p>Note that while creating the SOAP request envelope, the function uses null as the “startDate” parameter value to get the earliest date available in NDFD and 1 as  “numDays” parameter. It means that only current date&#8217;s data is requested.</p>
<p>You can further examine the NDFD data XML returned by this function for Florida using the following query:</p>
<pre class="brush: sql; title: ; notranslate">
select webservice_pkg.genCurrentWeatherReportXML(27.766279, -81.686782) from dual
</pre>
<h3>Creating the Formspider application</h3>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File” menu</em>, the <em>“New Application” dialog</em> shows up. Enter <em>“webService”</em> as the name of the application and the name of the schema where you have created <em>“webservice_pkg”</em> package as datasource schema name.  If you are using Formspider Online, you do not need to enter database schema name since your account is already configured to use your online database. Leave other fields empty and click <em>“OK”</em>. This creates the <em>“webService”</em> application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<p>The sample application contains a <em>combobox</em> listing state names, three labels and an <em>image</em> component displaying weather information of the selected state through the <em>combobox</em>.</p>
<p>Create a new <em>datasource definition</em>. To achieve this, expand the <em>“Datasource Definitions” accordion</em>, select the <em>“Datasource Definitions”</em> node and click the <em>“+” button</em>. Alternatively, you may right click the <em>“Datasource Definitions”</em> node and select <em>“New”</em> from the pop up menu. The <em>“New Datasource Definition” dialog</em> shows up. Select the <em>“Query”</em> radio button from the <em>“Based On”</em> section and enter “weatherReport” as <em>“Name”</em> of the <em>datasource definition</em>.<br />
<div class="wp-caption aligncenter" style="width: 714px"><img title="Creating “weatherReport” datasource definition" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_wr1.jpg" alt="" width="704" height="301" /><p class="wp-caption-text">Creating “weatherReport” datasource definition</p></div></p>
<p>This <em>datasource definition</em> holds current weather information for a given point. To populate this information, it queries the SOAP response XML provided by <em>“webservice_pkg.genCurrentWeatherReportXML”</em> function and retrieves necessary information from this XML.</p>
<p>Select <em>“Query”</em> node in the navigation tree on the left. Enter the following SQL Statement:</p>
<pre class="brush: sql; title: ; notranslate">
select maxTempDesc || ': ' || maxTempValue || ' ' || maxTempUnit as maxTempInfo
      ,minTempDesc || ': ' || minTempValue || ' ' || minTempUnit as minTempInfo
      ,weatherIcon
      ,weatherDesc
from(
      select maxTempDesc
            ,maxTempValue
            ,maxTempUnit
            ,minTempDesc
            ,minTempValue
            ,minTempUnit
            ,weatherIcon
            ,weatherDesc
       from xmltable('/dwml/data/parameters'
                      passing webservice_pkg.genCurrentWeatherReportXML(:latitude_nr, :longitude_nr)
                      columns
                      maxTempDesc varchar2(4000) path 'temperature[@type=&quot;maximum&quot;]/name'
                     ,maxTempValue number        path 'temperature[@type=&quot;maximum&quot;]/value'
                     ,maxTempUnit varchar2(255)  path 'temperature[@type=&quot;maximum&quot;]/@units'
                     ,minTempDesc varchar2(4000) path 'temperature[@type=&quot;minimum&quot;]/name'
                     ,minTempValue number        path 'temperature[@type=&quot;minimum&quot;]/value'
                     ,minTempUnit varchar2(255)  path 'temperature[@type=&quot;minimum&quot;]/@units'
                     ,weatherIcon varchar2(4000) path 'conditions-icon/icon-link'
                     ,weatherDesc varchar2(4000) path 'weather/weather-conditions/@weather-summary'
                    )
    )
</pre>
<div class="wp-caption aligncenter" style="width: 708px"><img title="Entering Query for “weatherReport” datasource definition" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_wr2.jpg" alt="" width="698" height="526" /><p class="wp-caption-text">Entering Query for “weatherReport” datasource definition</p></div>
<p>Note that this query contains two bind variables named <em>“latitude_nr”</em> and <em>“longitude_nr”</em>. Click the <em>“Bind Variables”</em> node to register <em>“latitude_nr”</em> and <em>“longitude_nr”</em> bind variables. Click <em>“New BindVar” button</em>, a new row appears in the <em>grid</em>. Enter <em>“latitude_nr”</em> to the <em>“Name”</em> column and select <em>“DefaultNumber″</em> as the <em>“Domain”</em> value.  Click <em>“New BindVar” button</em> again, this time enter <em>“longitude_nr”</em> as <em>“Name”</em> and select <em>“DefaultNumber″</em> as the <em>“Domain”</em> value.<br />
<div class="wp-caption aligncenter" style="width: 716px"><img title="Creating “latitude_nr” and “longitude_nr” bind variables" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_wr3.jpg" alt="" width="706" height="524" /><p class="wp-caption-text">Creating “latitude_nr” and “longitude_nr” bind variables</p></div></p>
<p>Click <em>“OK”</em> to save and close the <em>“New Datasource Definition” dialog</em>. This creates the <em>“weatherReport” datasource definition</em> and the <em>“weatherReport1″ datasource</em>.</p>
<p>Create a new <em>datasource definition</em> holding names, latitude and longitude infornation of major states. To achieve this, select <em>“Datasource Definitions”</em> node and click the <em>“+” button</em> again. Select the <em>“Query” radio button</em>, enter <em>“states”</em> as <em>“Name”</em> of the <em>datasource definition</em>.</p>
<p>Select <em>“Query”</em> node in the navigation tree on the left. Enter the following SQL Statement:</p>
<pre class="brush: sql; title: ; notranslate">
select 'Arizona' as stateName, 33.729761 as latitude, -111.431224 as longitude from dual
union all
select 'California', 36.116203, -119.681563 from dual
union all
select 'Florida', 27.766279, -81.686782 from dual
union all
select 'Illinois', 40.349455, -88.986137 from dual
union all
select 'Indiana', 39.849425, -86.258278 from dual
union all
select 'Michigan', 43.326618, -84.536093 from dual
union all
select 'New York', 42.165724, -74.948052 from dual
union all
select 'Pennsylvania', 40.590752, -77.209755 from dual
union all
select 'Texas', 31.054487, -97.56346 from dual
union all
select 'Washington', 47.400902, -121.490493 from dual
</pre>
<p>Select <em>“Datasource Definition”</em> node in the navigation tree on the left and select <em>“STATENAME”</em> from the <em>“Primary Key” combobox</em>.<br />
<div class="wp-caption aligncenter" style="width: 716px"><img title="Defining primary key for “states” datasource definition" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_states1.jpg" alt="" width="706" height="300" /><p class="wp-caption-text">Defining primary key for “states” datasource definition</p></div></p>
<p>Click <em>“OK”</em> to save and close the <em>“New Datasource Definition” dialog</em>. This creates the <em>“states” datasource definition</em> and the <em>“states1″ datasource</em>.</p>
<p>Expand the <em>“Panels”</em> node from the <em>“Containers”</em> tree and double click the <em>“mainPanel”</em> to open it in the editor. Add a <em>combobox</em> listing states using the <em>“states1” datasource</em>, three <em>label</em>s and an <em>image</em> component displaying current weather information for the selected state using <em>“weatherReport1” datasource</em>. The <em>“mainPanel”</em> XML should look like the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;tableLayout&gt;
    &lt;row/&gt;
    &lt;row height=&quot;55&quot;&gt;
      &lt;cell width=&quot;110&quot; hAlign=&quot;Full&quot; vAlign=&quot;Center&quot;&gt;
        &lt;textLabel label=&quot;Please select a state:&quot; text-align=&quot;Left&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;150&quot; hAlign=&quot;Center&quot; vAlign=&quot;Center&quot; childWidth=&quot;130&quot;&gt;
        &lt;comboBox name=&quot;cb_state&quot; displayColumn=&quot;STATENAME&quot; valueColumn=&quot;STATENAME&quot; displayNullOption=&quot;Y&quot; listDataSource=&quot;states1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Center&quot; vAlign=&quot;Full&quot; childWidth=&quot;58&quot;&gt;
        &lt;image name=&quot;image_weatherCondition&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel font-style=&quot;Bold&quot; text-align=&quot;Center&quot; column=&quot;WEATHERDESC&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel text-align=&quot;Center&quot; column=&quot;MAXTEMPINFO&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel text-align=&quot;Center&quot; column=&quot;MINTEMPINFO&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row/&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p>When a state is selected from the <em>combobox</em>, the weather information corresponding to the selected state should be generated. Therefore the <em>“weatherReport1” datasource</em> should be executed with the corresponding latitude and longitude values each time a state is selected. To achieve this you have to create an <em>action</em> which fires when a state is selected from the <em>combobox</em>.</p>
<p>Open <em>“webservice_pkg”</em> package and create a procedure named <em>“selectState”</em>, this procedure uses <a href="http://theformspider.com/API/api_datasource.html#getcolumnvaluenrbypk(varchar2,varchar2)" target="_blank">api_datasource.getcolumnvaluenrbypk</a> API to obtain latitude and longitude values belonging to the selected state from <em>“states1” datasource</em>. It populates corresponding weather data by executing <em>“weatherReport1” datasource</em> with the obtained latitude-longitude pair and sets the <em>image</em> component&#8217;s url to display graphical representation of the weather condition.</p>
<pre class="brush: sql; title: ; notranslate">
procedure selectState is
  v_selectedState_tx  varchar2(255);
  v_latitude_nr       number;
  v_longitude_nr      number;
begin

  v_selectedState_tx := api_component.getvaluetx('mainPanel.cb_state');
  if v_selectedState_tx is not null then
    v_latitude_nr := api_datasource.getcolumnvaluenrbypk('states1.latitude', v_selectedState_tx);
    v_longitude_nr := api_datasource.getcolumnvaluenrbypk('states1.longitude', v_selectedState_tx);
  end if;

  api_datasource.setbindvar('weatherReport1.latitude_nr', v_latitude_nr);
  api_datasource.setbindvar('weatherReport1.longitude_nr',v_longitude_nr);
  api_datasource.executequery('weatherReport1');

  if api_datasource.getcurrentrowid('weatherReport1') is not null then
    api_component.seturl('mainPanel.image_weatherCondition', api_datasource.getcolumnvaluetx('weatherReport1.weathericon'));
  else
    api_component.seturl('mainPanel.image_weatherCondition', ' ');
  end if;

end;
</pre>
<p>In Formspider IDE expand the <em>“Actions” accordion</em>, select the <em>“Actions”</em> node, click the <em>“+” button</em> to create a new <em>action</em>. Alternatively you may right click the <em>“Actions”</em> node and select <em>“New”</em> from the pop-up menu. The <em>“New Action” dialog</em> shows up. Enter <em>“selectState”</em> as the <em>action name</em> and <em>“webservice_pkg.selectState”</em> as the <em>procedure</em>. Click <em>“OK”</em> to save your <em>action</em>.<br />
<div class="wp-caption aligncenter" style="width: 460px"><img title="Creating “selectState” action" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_createAction.jpg" alt="" width="450" height="201" /><p class="wp-caption-text">Creating “selectState” action</p></div></p>
<p>Open “mainPanel”, add a “valueChanged” triggering “selectState” action to the combobox listing states:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;tableLayout&gt;
    &lt;row/&gt;
    &lt;row height=&quot;55&quot;&gt;
      &lt;cell width=&quot;110&quot; hAlign=&quot;Full&quot; vAlign=&quot;Center&quot;&gt;
        &lt;textLabel label=&quot;Please select a state:&quot; text-align=&quot;Left&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;150&quot; hAlign=&quot;Center&quot; vAlign=&quot;Center&quot; childWidth=&quot;130&quot;&gt;
        &lt;comboBox name=&quot;cb_state&quot; displayColumn=&quot;STATENAME&quot; valueColumn=&quot;STATENAME&quot; displayNullOption=&quot;Y&quot; listDataSource=&quot;states1&quot;&gt;
          &lt;events&gt;
            &lt;valueChanged action=&quot;selectState&quot;/&gt;
          &lt;/events&gt;
        &lt;/comboBox&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Center&quot; vAlign=&quot;Full&quot; childWidth=&quot;58&quot;&gt;
        &lt;image name=&quot;image_weatherCondition&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel font-style=&quot;Bold&quot; text-align=&quot;Center&quot; column=&quot;WEATHERDESC&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel text-align=&quot;Center&quot; column=&quot;MAXTEMPINFO&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell columnSpan=&quot;2&quot;/&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel text-align=&quot;Center&quot; column=&quot;MINTEMPINFO&quot; dataSource=&quot;weatherReport1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row/&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p>Press <em>“Run on Web” button</em> to run your application. Select a state from the <em>combobox</em>, the corresponding weather information is displayed.<a href="http://formspideronline.com/formspider/main.html?name=DemoMain#DemoWebService" target="_blank">You can also click here to run the completed application.</a><br />
<div class="wp-caption aligncenter" style="width: 509px"><img title="Web service successfully used in the Formspider application" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/webservice_appRun.jpg" alt="" width="499" height="500" /><p class="wp-caption-text">Web service successfully used in the Formspider application</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-36-how-to-use-a-web-service-in-a-formspider-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 35: How to use XY Layout</title>
		<link>http://theformspider.com/learningcenter/tutorial-35-how-to-use-xy-layout/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-35-how-to-use-xy-layout/#comments</comments>
		<pubDate>Fri, 04 May 2012 12:16:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[layout]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1859</guid>
		<description><![CDATA[This tutorial describes how the xy layout can be used to design screens in Formspider.]]></description>
			<content:encoded><![CDATA[<p>This tutorial describes how the xy layout can be used to design screens in Formspider.</p>
<p>Formspider <em>mainframe</em>s, <em>dialog</em>s and <em>panel</em>s can be designed using xy layout. Formspider <em>xyLayout</em> is a layout type where the developer specifies the absolute position and the absolute size of the components. Since the size and the position are absolute, the components don&#8217;t stretch up when the container(<em>mainframe</em>, <em>dialog</em> or <em>panel</em>) is resized. <em>xyLayout</em> can be preferred if a container holds components whose size is not affected by the container&#8217;s size or by font, look-and-feel, or language changes.</p>
<p>Formspider <em>xyLayout</em> elements consist of <em>cell</em>s. The attributes of a <em>xyLayout cell</em> are listed below:</p>
<table border="1" align="center">
<tr>
<td><b>Attribute</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td>x</td>
<td>horizontal distance in pixels between to the upper left corner of the cell and upper left corner of the container. If not specified, default value 0  is used.</td>
</tr>
<tr>
<td>y</td>
<td>vertical distance in pixels between to the upper left corner of the cell and upper left corner of the container. If not specified, default value 0  is used.</td>
</tr>
<tr>
<td>width</td>
<td>width of the cell in pixels. If not specified, component&#8217;s default width is used.</td>
</tr>
<tr>
<td>height</td>
<td>height of the cell in pixels. If not specified, component&#8217;s default height is used. Ignored if the <em>heightPolicy</em> value is equal to <em>Dynamic</em>.</td>
</tr>
<tr>
<td>heightPolicy</td>
<td>indicates whether the height of the cell should be dynamically adjusted by layout manager or a static height value will be used. This attribute can be used when the height of the component contained by the cell is unknown and should extend its content. The only valid example to this case is a <em>textLabel</em> where the label content changes dynamically at runtime.<br />
Valid values of heightPolicy attribute are: <b>Static</b>, <b>Dynamic</b>. If not specified, default value <em>Static</em> is used.
</td>
</tr>
<tr>
<td>name</td>
<td>name of the cell</td>
</tr>
</table>
<h3>Using XY Layout</h3>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File”</em> menu. The <em>&#8220;New Application&#8221;</em> dialog will show up. Enter “xyLayout” as the name of the application and “HR” as its Datasource Schema name.  If you are using Formspider Online, you do not need to enter database schema name since your account is already configured to use your online database. Leave other fields empty and click <em>&#8220;OK&#8221;</em>. This creates the “xyLayout” application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<p>Double click the <em>“mainPanel”</em> under the <em>“Panels”</em> node of the <em>“Containers”</em> navigation tree to open it in the editor. The example below places three <em>button</em>s to the <em>“mainPanel”</em> using <em>xylayout</em>:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot;&gt;
  &lt;xyLayout&gt;
    &lt;cell x=&quot;80&quot; y=&quot;5&quot;&gt;
      &lt;button label=&quot;one&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell x=&quot;110&quot; y=&quot;40&quot; height=&quot;30&quot;&gt;
      &lt;button label=&quot;two&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell x=&quot;255&quot; y=&quot;15&quot; height=&quot;40&quot; width=&quot;150&quot;&gt;
      &lt;button label=&quot;three&quot;/&gt;
    &lt;/cell&gt;
  &lt;/xyLayout&gt;
&lt;/panel&gt;
</pre>
<p>The screenshot below shows how the <em>button</em>s are displayed once the application is executed. Note that when the mainFrame window is resized, the sizes and the positions of the <em>button</em>s remain same.<br />
<div class="wp-caption aligncenter" style="width: 510px"><img title="Three buttons are places using xyLayout" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/xyLayout_1.jpg" alt="" width="500" height="501" /><p class="wp-caption-text">Three buttons are places using xyLayout</p></div></p>
<h3>Using heightPolicy</h3>
<p>As explained above, there can be some cases where the height of the component contained by a <em>cell</em> is unknown and should extend its content. In <em>xyLayout</em>, the only valid example to this case is a <em>textLabel</em> where the label content changes dynamically at runtime. In such cases, to let the layout manager decide and adjust <em>cell</em> height dynamically, <em>heightPolicy</em> attribute can be set as <em>“Dynamic”</em> (the default value of this attribute is <em>“Static”</em>, indicating that the layout manager won’t extend <em>cell</em> height dynamically).</p>
<p><b>Note 1:</b> “Dynamic” heightPolicy usage should be limited as much as possible since too much usage of “Dynamic” heightPolicy may slow down the application performance.<br />
<b>Note 2:</b> If any cell height value is set, heightPolicy cannot be set as “Dynamic” for this same cell anymore.</p>
<p>In the XML below <em>“Dynamic”</em> is specified as <em>heightPolicy</em> of the <em>cell</em> containing a <em>textLabel</em></p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot;&gt;
  &lt;xyLayout&gt;
    &lt;cell width=&quot;100&quot; heightPolicy=&quot;Dynamic&quot; x=&quot;100&quot;&gt;
      &lt;textLabel label=&quot;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse massa.&quot;/&gt;
    &lt;/cell&gt;
  &lt;/xyLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 512px"><img title="“Dynamic” heightPolicy" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/05/xyLayout_2.jpg" alt="" width="502" height="501" /><p class="wp-caption-text">“Dynamic” heightPolicy</p></div>
<p>Note that the height of the cell is automatically adjusted by the layout manager according to the content of the <em>textLabel</em> component and the width of the <em>cell</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-35-how-to-use-xy-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 34: How to use Border Layout</title>
		<link>http://theformspider.com/learningcenter/tutorial-34-how-to-use-border-layout/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-34-how-to-use-border-layout/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 11:03:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[layout]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1841</guid>
		<description><![CDATA[This tutorial describes how the border layout can be used to design screens in Formspider.]]></description>
			<content:encoded><![CDATA[<p>This tutorial describes how the border layout can be used to design screens in Formspider.</p>
<p>Formspider <em>mainframe</em>s, <em>dialog</em>s and <em>panel</em>s can be designed using border layout. Formspider <em>borderLayout</em> lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center.</p>
<p>Formspider <em>borderLayout</em> elements consist of <em>cell</em>s corresponding to the five regions above. The attributes of a <em>borderLayout cell</em> are listed below:</p>
<table border="1" align="center">
<tr>
<td><b>Attribute</b></td>
<td><b>Description</b></td>
</tr>
<tr>
<td>docking</td>
<td>region identifier of the cell, it&#8217;s a required attribute. Valid values are: <b>North, South, East, West, Center</b></td>
</tr>
<tr>
<td>width</td>
<td>width of the cell, ignored if the docking value is equal to North, South or Center. If not specified, component&#8217;s default width is used.</td>
</tr>
<tr>
<td>height</td>
<td>height of the cell, ignored if the docking value is equal to East, West or Center. If not specified, component&#8217;s default height is used.</td>
</tr>
<tr>
<td>name</td>
<td>name of the cell</td>
</tr>
</table>
<p>Each region may contain no more than one component, meaning that each <em>docking</em> value may be used only once. The components are laid out according to the size of the <em>cell</em>(specified with <em>width</em> and <em>height</em> attributes). The <em>North</em> and <em>South</em> components may be stretched horizontally; the <em>East</em> and <em>West</em> components may be stretched vertically; the <em>Center</em> component may stretch both horizontally and vertically to fill any space left over. Therefore, the <em>width</em> attribute is ignored for <em>North</em> and <em>South</em> components, the <em>height</em> attribute is ignored for <em>East</em> and <em>West</em> components and both the <em>width</em> and <em>height</em> attributes are ignored for <em>Center</em> component.</p>
<h3>Using Border Layout</h3>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File”</em> menu. The <em>&#8220;New Application&#8221;</em> dialog will show up. Enter “borderLayout” as the name of the application and “HR” as its Datasource Schema name.  If you are using Formspider Online, you do not need to enter database schema name since your account is already configured to use your online database. Leave other fields empty and click <em>&#8220;OK&#8221;</em>. This creates the “borderLayout” application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<p>Double click the <em>“mainPanel”</em> under the <em>“Panels”</em> node of the <em>“Containers”</em> navigation tree to open it in the editor. The example below places two <em>button</em>s to the <em>North</em> and <em>Center</em> regions of the <em>“mainPanel”</em> using border layout:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is borderLayout!&quot;&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;North&quot; height=&quot;100&quot;&gt;
      &lt;button label=&quot;North&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;button label=&quot;Center&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/panel&gt;
</pre>
<p>The screenshot below shows how the <em>button</em>s are displayed once the application is executed. Note that when the <em>mainFrame</em> window is resized, the <em>“North” button</em> is stretched only horizontally and the <em>“Center” button</em> is stretched both horizontally and vertically.<br />
<div class="wp-caption aligncenter" style="width: 509px"><img title="Two buttons are placed to the North and Center regions" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/borderLayout_appRun1.jpg" alt="" width="499" height="499" /><p class="wp-caption-text">Two buttons are placed to the North and Center regions</p></div></p>
<p>The example below places a <em>button</em> to every region of the of the <em>“mainPanel”</em>:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is borderLayout!&quot;&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;North&quot; height=&quot;100&quot;&gt;
      &lt;button label=&quot;North&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;South&quot; height=&quot;60&quot;&gt;
      &lt;button label=&quot;South&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;East&quot; width=&quot;120&quot;&gt;
      &lt;button label=&quot;East&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;West&quot; width=&quot;50&quot;&gt;
      &lt;button label=&quot;West&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;button label=&quot;Center&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 511px"><img title="All regions are used" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/borderLayout_appRun2.jpg" alt="" width="501" height="501" /><p class="wp-caption-text">All regions are used</p></div>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-34-how-to-use-border-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 33: How to Define and Use Key Events</title>
		<link>http://theformspider.com/learningcenter/tutorial-33-how-to-define-and-use-key-events/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-33-how-to-define-and-use-key-events/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 13:38:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[keyEvent]]></category>
		<category><![CDATA[keys]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1819</guid>
		<description><![CDATA[This tutorial describes how to define and use a key event in Formspider.]]></description>
			<content:encoded><![CDATA[<p>This tutorial describes how to define and use a key event in Formspider. In a Formspider application, a <em>keyEvent</em> is triggered when the user presses a combination of keyboard buttons specified by the developer.</p>
<p>A <em>keyEvent</em> can be defined at the <em>mainframe</em>, <em>dialog</em>, <em>panel</em> or <em>component</em> level. A <em>keyEvent</em> defined at a higher level in the view hierarchy delegates down to lower levels. For example, a <em>keyEvent</em> defined at PanelA triggers if the defined key combination is pressed when the focus is in a component that resides in PanelB which is included in PanelA.</p>
<p>When a key is pressed the framework searches for an appropriate <em>keyEvent</em> starting from the focused component. It then climbs higher in the view hierarchy (focused component => panel (recursively) => dialog/mainframe).</p>
<h3>Sample Application</h3>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File” menu</em>. The <em>“New Application” dialog</em> shows up. Enter <em>“keyEvent”</em> as the name of the application and <em>“HR”</em> as its <em>datasource schema</em> name. Leave other fields empty and click <em>“OK”</em>. This creates the <em>“keyEvent”</em> application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<p>In the datasource schema of the application, create a package called “keyEvent_pkg” and open it in your favorite PL/SQL Editor. Add a procedure named <em>“mainframe_shiftB”</em> and ensure that the procedure is exposed in the package specification.</p>
<pre class="brush: sql; title: ; notranslate">
procedure mainframe_shiftB is
begin
  api_application.showpopupmessage('mainFrame''s SHIFT B keyEvent is fired');
end;
</pre>
<p>In the Formspider IDE expand the <em>“Actions” accordion</em>, select the <em>“Actions”</em> node and click the <em>“+” button</em> to create a new <em>action</em>. Alternatively, you may right click the <em>“Actions”</em> node and select <em>“New”</em> from the pop-up menu. The <em>“New Action” dialog</em> shows up. Enter <em>“mainframe_shiftB”</em> as the action name and <em>“keyEvent_pkg.mainframe_shiftB”</em> as the procedure. Click <em>“OK”</em> to save your action.<br />
<div class="wp-caption aligncenter" style="width: 462px"><img title="Creating “mainframe_shiftB” action" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/keyEvent_createAction.jpg" alt="" width="452" height="202" /><p class="wp-caption-text">Creating “mainframe_shiftB” action</p></div></p>
<p>Expand the <em>“Windows”</em> node and then the <em>“Mainframe”</em> node from the <em>“Containers”</em> tree. Double click the <em>“mainFrame”</em> node to open it in the editor. To add the <em>keyEvent</em>, edit the <em>“mainFrame”</em> XML as the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;mainframe title=&quot;keyEvent&quot; width=&quot;500&quot; height=&quot;500&quot;&gt;
  &lt;events&gt;
    &lt;keyEvents&gt;
      &lt;keyEvent action=&quot;mainframe_shiftB&quot; keyCombination=&quot;SHIFT B&quot;/&gt;
    &lt;/keyEvents&gt;
  &lt;/events&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;include panelName=&quot;mainPanel&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/mainframe&gt;
</pre>
<p>Create a new <em>panel</em> containing a <em>button</em> labeled “Fire”. To achieve this, expand the <em>“Containers” accordion</em>, select the <em>“Panels”</em> node in the navigation tree and click the <em>“+” button</em>. Alternatively, you may right click the <em>“Panels”</em> node and select the <em>“New”</em> menu item from the pop-up menu. The <em>“New Panel” dialog</em> shows up. Enter <em>“subPanel”</em> as the name of the <em>panel</em> and <em>“Yellow”</em> as the background color. Select <em>“TitledBorder”</em> option from border type <em>combo box</em> and enter <em>“subPanel”</em> as the border title. Click <em>“OK”</em> to create and open the <em>panel</em> in the editor.<br />
<div class="wp-caption aligncenter" style="width: 461px"><img title="Creating “subPanel”" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/keyEvent_createSubPanel.jpg" alt="" width="451" height="482" /><p class="wp-caption-text">Creating “subPanel”</p></div></p>
<p>Using the procedures below, define two <em>keyEvents</em> on the <em>“subPanel”</em> with “SHIFT A” and “SHIFT B” as <em>keyCombination</em> and define a <em>keyEvent</em> on the <em>button</em> labeled <em>“Fire”</em> with “SHIFT A” as <em>keyCombination</em>. Create the <em>action</em>s corresponding to each <em>keyEvent</em> using the procedure names as the name of the <em>actions</em>.</p>
<pre class="brush: sql; title: ; notranslate">
procedure subPanel_shiftA is
begin
  api_application.showpopupmessage('subPanel''s SHIFT A keyEvent is fired');
end;
</pre>
<pre class="brush: sql; title: ; notranslate">
procedure subPanel_shiftB is
begin
  api_application.showpopupmessage('subPanel''s SHIFT B keyEvent is fired');
end;
</pre>
<pre class="brush: sql; title: ; notranslate">
procedure subPanelButton_shiftA is
begin
  api_application.showpopupmessage('subPanel''s “Fire” button SHIFT A keyEvent is fired');
end;
</pre>
<p>The “subPanel” XML should look like the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;subPanel&quot;&gt;
  &lt;events&gt;
    &lt;keyEvents&gt;
      &lt;keyEvent action=&quot;subPanel_shiftA&quot; keyCombination=&quot;SHIFT A&quot;/&gt;
      &lt;keyEvent action=&quot;subPanel_shiftB&quot; keyCombination=&quot;SHIFT B&quot;/&gt;
    &lt;/keyEvents&gt;
  &lt;/events&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;button label=&quot;Fire&quot;&gt;
        &lt;events&gt;
          &lt;keyEvents&gt;
            &lt;keyEvent action=&quot;subPanelButton_shiftA&quot; keyCombination=&quot;SHIFT A&quot;/&gt;
          &lt;/keyEvents&gt;
        &lt;/events&gt;
      &lt;/button&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/panel&gt;
</pre>
<p>Double click the <em>“mainPanel”</em> to open it in the editor. Using the following procedures, define two <em>keyEvents</em> on the <em>“mainPanel”</em> with “SHIFT A” and “SHIFT C” as <em>keyCombination</em>. Create the <em>actions</em> corresponding to each key event using procedure names as the name of the <em>actions</em>.</p>
<pre class="brush: sql; title: ; notranslate">
procedure mainPanel_shiftA is
begin
  api_application.showpopupmessage('mainPanel''s SHIFT A keyEvent is fired');
end;
</pre>
<pre class="brush: sql; title: ; notranslate">
procedure mainPanel_shiftC is
begin
  api_application.showpopupmessage('mainPanel''s SHIFT C keyEvent is fired');
end;
</pre>
<p>Include the <em>“subPanel”</em> in <em>“mainPanel”</em> and add a <em>button</em> labeled <em>“test”</em> into <em>“mainPanel”</em>. The <em>“mainPanel”</em> XML should look like the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Pink&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;mainPanel&quot;&gt;
  &lt;events&gt;
    &lt;keyEvents&gt;
      &lt;keyEvent action=&quot;mainPanel_shiftA&quot; keyCombination=&quot;SHIFT A&quot;/&gt;
      &lt;keyEvent action=&quot;mainPanel_shiftC&quot; keyCombination=&quot;SHIFT C&quot;/&gt;
    &lt;/keyEvents&gt;
  &lt;/events&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;include panelName=&quot;subPanel&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button label=&quot;test&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p>The screenshot of the application is below;<br />
<div class="wp-caption aligncenter" style="width: 510px"><img title="“keyEvent” application" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/keyEvent_applicationRun.jpg" alt="" width="500" height="501" /><p class="wp-caption-text">“keyEvent” application</p></div></p>
<p>Run the application to examine the results. If the user presses &#8220;shift and &#8220;A&#8221; buttons on the keyboard while the focus is on the <em>button</em> with the label &#8220;Fire&#8221;(you can click to the component to set the focus on it) then the <em>&#8220;subPanelButton_shiftA” action</em> executes. However, if the focus is on the <em>“test” button</em>, pressing the same keyboard buttons causes the <em>action “mainPanel_shiftA”</em> to execute. The <em>action &#8220;subPanel_shiftA&#8221;</em> is never executed.</p>
<p>Similarly, if the user presses &#8220;shift and &#8220;B&#8221; buttons while the focus is on the <em>“Fire” button</em> then the <em>“subPanel_shiftB” action</em> executes. On the other hand, if the focus is on the <em>“test” button</em>, pressing the same keyboard buttons causes the <em>action “mainframe_shiftB”</em> to execute.</p>
<p>Finally,  if the user presses &#8220;shift and &#8220;C&#8221; buttons, <em>“mainPanel_shiftC” action</em> executes regardless of where the focus is.</p>
<h3>Defining a Key Combination</h3>
<p>The keys are split into two groups; modifiers (SHIFT, CONTROL and ALT) and virtual keys (rest of the keys). A <b><em>keyCombination</em></b> consists of one mandatory virtual key and one or more optional modifiers.</p>
<p>The list of modifiers is below:<br />
SHIFT<br />
CONTROL<br />
ALT</p>
<p>The most commonly used virtual keys are:<br />
A B C &#8230; Z<br />
0 1 2 3 &#8230; 9<br />
F1 F2 F3 &#8230; F12<br />
NUMPAD0 NUMPAD1 &#8230; NUMPAD9<br />
UP<br />
DOWN<br />
LEFT<br />
RIGHT<br />
ENTER<br />
ESCAPE<br />
HOME<br />
END<br />
PAGE_UP<br />
PAGE_DOWN<br />
ADD<br />
DIVIDE<br />
MULTIPLY<br />
SUBTRACT<br />
INSERT<br />
DELETE<br />
NUM_LOCK<br />
CAPS_LOCK<br />
SCROLL_LOCK<br />
BACK_SPACE<br />
COMMA<br />
LESS<br />
PAUSE</p>
<p>Below is a list of examples that define various key combinations;</p>
<table border="1" align="center">
<tr>
<td><b>keyCombination</b></td>
<td><b>Result</b></td>
</tr>
<tr>
<td>“A”</td>
<td>Correct. Pressing on A fires the event.</td>
</tr>
<tr>
<td>“SHIFT”</td>
<td><b>Incorrect</b>. One virtual key must be used in the <em>keyCombination<em>.</td>
</tr>
<tr>
<td>“SHIFT A”</td>
<td>Correct. Pressing on shift and A fires the event.</td>
</tr>
<tr>
<td>“SHIFT A F1”</td>
<td><b>Incorrect</b>. Cannot use more than one virtual key in one <em>keyCombination</em>.</td>
</tr>
<tr>
<td>“SHIFT ALT ENTER”</td>
<td>Correct. The event fires when the user presses shift, alt and enter.</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-33-how-to-define-and-use-key-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 32: How to use Table Layout</title>
		<link>http://theformspider.com/learningcenter/tutorial-32-how-to-use-table-layout/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-32-how-to-use-table-layout/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 08:14:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[tableLayout]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1734</guid>
		<description><![CDATA[This tutorial describes how the table layout can be used to design screens in Formspider.]]></description>
			<content:encoded><![CDATA[<p>This tutorial describes how the table layout can be used to design screens in Formspider. Formspider <em>mainframe</em>s, <em>dialog</em>s and <em>panel</em>s can be designed using table layout. Formspider <em>tableLayout</em> elements consist of <em>row</em>s and <em>cell</em>s. Each <em>row</em> may contain a different number of <em>cell</em>s.</p>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File” menu</em>. The <em>“New Application” dialog</em> will show up. Enter <em>“tableLayout”</em> as the name of the application and <em>“HR”</em> as its <em>datasource schema</em> name. Leave other fields empty and click <em>“OK”</em>. This creates the <em>“tableLayout”</em> application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<p>Double click the <em>“mainPanel”</em> under the <em>“Panels”</em> node of the <em>“Containers”</em> navigation tree to open it in the editor. The example below places six <em>button</em>s to the <em>“mainPanel”</em> using table layout:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p>The screenshot below shows how the <em>button</em>s are displayed once the application containing the <em>“mainFrame”</em>, is executed. Note that the <em>label</em>s on <em>button</em>s indicate the row and column that the button is placed in.For example, the <em>button</em> with the <em>label</em> 3.2 is located in the second column of the third row in the <em>panel</em>.<br />
<div class="wp-caption aligncenter" style="width: 510px"><img title="Figure 1: Example TableLayout with default alignment" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure1.jpg" alt="" width="500" height="502" /><p class="wp-caption-text">Figure 1: Example TableLayout with default alignment</p></div></p>
<h3>Component Alignment</h3>
<p>A <em>component</em> in a <em>cell</em> is by default aligned to the center of the <em>cell</em> (Figure 1). This behavior can be changed using the <em>hAlign</em> and <em>vAlign</em> attributes for horizontal and vertical alignment respectively.</p>
<p>The valid values for these two attributes are listed below;<br />
<b>hAlign:</b> <em>Left Center Right Full</em><br />
<b>vAlign:</b> <em>Top Center Bottom Full</em></p>
<p>The XML below expands the <em>button “btn1-1”</em> so that it fills its <em>cell</em> completely.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 509px"><img title="Figure 2: Example TableLayout with full alignment" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure2.jpg" alt="" width="499" height="501" /><p class="wp-caption-text">Figure 2: Example TableLayout with full alignment</p></div>
<p>The XML below aligns the <em>button “btn1-1”</em> to the top-left of its <em>cell</em>.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Left&quot; vAlign=&quot;Top&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 513px"><img title="Figure 3: Example TableLayout with Top-Left alignment" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure3.jpg" alt="" width="503" height="501" /><p class="wp-caption-text">Figure 3: Example TableLayout with Top-Left alignment</p></div>
<h3>Cell / Row / Component Sizes </h3>
<p>If the sample application shown above is resized, the columns and rows in the table layout resize themselves automatically to share the available space. Developers can control the area that a row or a cell occupies using the <em>height</em> and <em>width</em> attributes respectively. </p>
<h4>Cell Width</h4>
<p><em>Cell width</em> can be set as pixel or percentage. In the example below, the <em>cell width</em> for the <em>button</em> named <em>“btn1-2”</em> is set to 100 pixels. All alignment values are specified as “Full” to show the effect of the cell width change clearly (Figure 4).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;100&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 511px"><img title="Figure 4: Cell width specified in pixels" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure4.jpg" alt="" width="501" height="504" /><p class="wp-caption-text">Figure 4: Cell width specified in pixels</p></div>
<p>Setting the <em>width</em> attribute value to 100 pixels effects cells 2.2 and 3.2 as well. This happens because, when the application runs the table layout manager places the logical <em>cell</em>s 1.2, 2.2 and 3.2 to the same physical column.</p>
<p>The layout manager determines the width of physical columns by processing logical <em>cell</em>s starting from the first <em>cell</em> in the first <em>row</em> moving to the next <em>cell</em> in the first <em>row</em> and ending with the last <em>cell</em> in the last <em>row</em>. Hence the physical column width is determined by the <em>cell</em> in the physical column that has the biggest <em>width</em> value.</p>
<p>The XML below specifies <em>cell width</em> values for <em>cell</em>s 1.2 and 2.2. (See Figure 5 for the rendered screen)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;300&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;100&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 512px"><img title="Figure 5: Cell width specified in pixels" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure5.jpg" alt="" width="502" height="502" /><p class="wp-caption-text">Figure 5: Cell width specified in pixels</p></div>
<p>The <em>cell width</em> can also be specified using a percentage as shown in the XML below(See Figure 6 for the rendered screen). The first and second <em>cell width</em>s are set to 25% and 75% respectively. The table layout manager will preserve this ratio between the areas the two columns cover when the <em>mainframe</em> is resized.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell width=&quot;25%&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;75%&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 513px"><img title="Figure 6: Cell width specified as percentage" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure6.jpg" alt="" width="503" height="503" /><p class="wp-caption-text">Figure 6: Cell width specified as percentage</p></div>
<p>The XML below uses both pixel and percentage to specify the <em>cell width</em>.(See Figure 7 for the rendered screen)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell width=&quot;100&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell width=&quot;50%&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Figure 7: Cell width specified both as percentage and in pixels" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure7.jpg" alt="" width="500" height="501" /><p class="wp-caption-text">Figure 7: Cell width specified both as percentage and in pixels</p></div>
<p>As seen in the example above, the table layout manager sets first physical column width to 100 pixels. Then, 50% of the remaining space in the panel is designated for the second physical column.</p>
<p>In some cases, the width of the <em>component</em> should dynamically increase following its content where the width of the physical column containing this <em>component</em> should also dynamically increase. The best example of this state could be a <em>textLabel</em> where the <em>label</em> content changes dynamically at runtime. In such cases where setting a fixed percentage or pixel width is insufficient, <em>cell width</em> can be set as <em>“auto”</em> to let the layout manager decide and adjust <em>cell width</em> dynamically. In fact this is a special value which can be used only for <em>cell</em>s containing <em>textLabel</em> component.</p>
<p>In the XML below <em>“auto”</em> is specified as <em>cell width</em> of <em>“label1-1”</em>.(See Figure 8 for the rendered screen)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell width=&quot;auto&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel name=&quot;label1-1&quot; label=&quot;width of the cell is automatically adjusted following textLabel's content&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 511px"><img title="Figure 8: Cell width specified as “auto”" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure8.jpg" alt="" width="501" height="500" /><p class="wp-caption-text">Figure 8: Cell width specified as “auto”</p></div>
<p>As seen in the example above, the table layout manager sets first physical column width dynamically following the content length of the <em>“label1-1” textLabel</em>.</p>
<h4>Row Height</h4>
<p><em>height</em> attribute operates similar to the <em>width</em> attribute. Unlike <em>cell width</em>, <em>row height</em> can only be specified in pixels. If no <em>height</em> attribute is specified, <em>row</em>s will cover all the available area.</p>
<p>The XML example below specifies the first <em>row height</em> as 100 pixels(See Figure 9 for the rendered screen). When <em>mainframe</em> is resized the first row will preserve its height of 100 pixels, while the height of the other two rows changes.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row height=&quot;100&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 510px"><img title="Figure 9: Row height" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure9.jpg" alt="" width="500" height="503" /><p class="wp-caption-text">Figure 9: Row height</p></div>
<p>The XML example below shows a <em>panel</em> with a table layout manager that has pixel value for all of its <em>cell width</em>s and <em>row height</em>s(See Figure 10 for rendered screen). The layout manager of this <em>panel</em> will not adjust the contents of the <em>panel</em> when the <em>panel</em> is resized.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row height=&quot;100&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; width=&quot;100&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; width=&quot;100&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;100&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;100&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 511px"><img title="Figure 10: Row height and cell width" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure10.jpg" alt="" width="501" height="500" /><p class="wp-caption-text">Figure 10: Row height and cell width</p></div>
<h4>Row Height Policy</h4>
<p>Similarly to <em>cell width</em>, there can be some cases where the <em>height</em> of the <em>component</em> contained by a <em>row</em> is unknown and should extend its content. Again the best example to this case is a <em>textLabel</em> where the <em>label</em> content changes dynamically at runtime. In such cases, to let the layout manager decide and adjust <em>row height</em> dynamically, <em>heightPolicy</em> attribute can be set as <em>“Dynamic”</em>(the default value of this attribute is <em>“Static”</em>, indicating that the layout manager won&#8217;t extend <em>row height</em> dynamically).</p>
<p><b>Note 1:</b> <em>“Dynamic” heightPolicy</em> usage should be limited as much as possible since too much usage of <em>“Dynamic” heightPolicy</em> may slow down the application performance.<br />
<b>Note 2:</b> If any <em>row height</em> value is set, <em>heightPolicy</em> cannot be set as <em>“Dynamic”</em> for this same row anymore.</p>
<p>In the XML below <em>“Dynamic”</em> is specified as <em>heightPolicy</em> of the first row in the <em>panel</em>.(See Figure 11 for the rendered screen)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row heightPolicy=&quot;Dynamic&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel name=&quot;label1-1&quot; label=&quot;height of the row is automatically adjusted following textLabel's content&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 511px"><img title="Figure 11: “Dynamic” heightPolicy" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure11.jpg" alt="" width="502" height="502" /><p class="wp-caption-text">Figure 11: “Dynamic” heightPolicy</p></div>
<h4>Cell Spacing</h4>
<p><em>cellSpacing</em> attribute is used to create a blank area between table layout <em>cell</em>s.</p>
<p>The XML below sets <em>cellSpacing</em> to 5(See Figure 12 for the rendered screen).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout cellSpacing=&quot;5&quot;&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 512px"><img title="Figure 12: Cell Spacing" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure12.jpg" alt="" width="502" height="502" /><p class="wp-caption-text">Figure 12: Cell Spacing</p></div>
<h4>Component Size</h4>
<p><b>When alignment is set to a value other than <em>“Full”</em></b>, <em>cell</em>&#8216;s <em>childWidth</em> and childHeight attributes can be used to determine the size of the component in it as shown in the sample XML below(See Figure 13 for the rendered screen).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Left&quot; vAlign=&quot;Top&quot; childWidth=&quot;100&quot; childHeight=&quot;100&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 513px"><img title="Figure 13: Component size" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure13.jpg" alt="" width="503" height="504" /><p class="wp-caption-text">Figure 13: Component size</p></div>
<h3>Span Values</h3>
<h4>Column Span</h4>
<p>In the XML below the <em>cell</em> 1.2 is deleted and <em>cell</em> 1.1 is extended to cover two physical columns using the <em>columnSpan</em> attribute(See Figure 14 for the rendered screen).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; columnSpan=&quot;2&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-2&quot; label=&quot;3.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 512px"><img title="Figure 14: Column spans values" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure14.jpg" alt="" width="502" height="502" /><p class="wp-caption-text">Figure 14: Column spans values</p></div>
<p>The XML below uses <em>columnSpan</em> for a more complex display(See figure 15 for the rendered screen).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row height=&quot;300&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; width=&quot;100&quot;&gt;
        &lt;button name=&quot;btn1-2&quot; label=&quot;1.2&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-3&quot; label=&quot;1.3&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn1-4&quot; label=&quot;1.4&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row height=&quot;50&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; columnSpan=&quot;3&quot; width=&quot;400&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 513px"><img title="Figure 15: Column Spans values" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure15.jpg" alt="" width="503" height="503" /><p class="wp-caption-text">Figure 15: Column Spans values</p></div>
<p>The XML above defines two <em>row</em>s. The first <em>row</em> has four <em>cell</em>s and a <em>height</em> of 300 pixels. The second row has two <em>cell</em>s and a <em>height</em> of 50 pixels. <em>Cell</em> 1.2 <em>width</em> is specified as 100 and <em>cell</em> 2.1 has its <em>columnSpan</em> and <em>width</em> attributes set to 3 and 400 respectively.</p>
<p>Note that resizing the <em>mainframe</em> will only cause the <em>cell</em> 1.4 and <em>cell</em> 2.2 to resize.</p>
<h4>Row Span</h4>
<p>In the XML below, the <em>cell</em> 3.2 is deleted and the <em>cell</em> 2.1 is extended vertically using the <em>rowSpan</em> attribute(See Figure 16 for the rendered screen).</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel backgroundColor=&quot;Yellow&quot; borderType=&quot;TitledBorder&quot; borderTitle=&quot;my layout type is tableLayout!&quot;&gt;
  &lt;tableLayout&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; columnSpan=&quot;2&quot;&gt;
        &lt;button name=&quot;btn1-1&quot; label=&quot;1.1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot; rowSpan=&quot;2&quot;&gt;
        &lt;button name=&quot;btn2-1&quot; label=&quot;2.1&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn2-2&quot; label=&quot;2.2&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;button name=&quot;btn3-1&quot; label=&quot;3.1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<div class="wp-caption aligncenter" style="width: 513px"><img title="Figure 16: Row spans values" src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/tableLayout_figure16.jpg" alt="" width="503" height="502" /><p class="wp-caption-text">Figure 16: Row spans values</p></div>
<p>Note that, even though the <em>cell</em> 3.1 is defined as the first column in its row, when the <em>panel</em> is rendered, it is displayed in the second physical column due to the <em>rowSpan</em> attribute in <em>cell</em> 2.1</p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-32-how-to-use-table-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying Formspider Middle Tier to OC4J</title>
		<link>http://theformspider.com/learningcenter/deploying-formspider-middle-tier-into-oc4j/</link>
		<comments>http://theformspider.com/learningcenter/deploying-formspider-middle-tier-into-oc4j/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 14:03:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1688</guid>
		<description><![CDATA[This tutorial explains deployment of Formspider middle tier to an OC4J standalone instance.]]></description>
			<content:encoded><![CDATA[<p>It is possible to deploy Formspider middle tier to any JEE compliant container. This tutorial explains deploying Formspider to an OC4J standalone instance. Please contact us at contact (at) theformspider dot com to be able to download the Formspider WAR File for the OC4J deployment.</p>
<h2>Deploying the Formspider WAR File</h2>
<p>Open OC4J console from the browser (It should have a URL address similar to the following: <em>http://localhost:8888/em/</em>). Navigate to the Applications menu and click the Deploy button. The Select Archive screen shows up.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/deploy.png" /><p class="wp-caption-text">Deploying a new application</p></div>
<p><br/></p>
<p>Proceed with the &#8220;Archive is present on local host&#8230;&#8221; option which is selected by default. Press the &#8220;Browse&#8221; button to select the Formspider middle tier war file from your local drive. Press the &#8220;Next&#8221; button.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img style="border:solid 1px;"  src="http://theformspider.com/learningcenter/images/deployIntoOC4J/selectArchive.png" /><p class="wp-caption-text">Select archive</p></div>
<p><br/></p>
<p>Application Attributes screen shows up. Enter the value &#8220;formspider&#8221; for both &#8220;Application Name&#8221; and &#8220;Context Root&#8221; fields. Click &#8220;Next&#8221; to continue.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/applicationAttributes.png" /><p class="wp-caption-text">Application attributes</p></div>
<p><br/></p>
<p>The Deployment Settings screen shows up. Press the &#8220;Deploy&#8221; button.</p>
<h2>Configuring the Database Connection</h2>
<p>After the deployment is completed, its time to configure the database connection. There are two ways to define database connection parameters. You can either use &#8220;JDBC Resouces&#8221; or application web.xml parameters.</p>
<h4>Connecting with JDBC Resources</h4>
<p>This way gives the opportunity to tune the pooling parameters and it is generally the preferred method in a production environment. Navigate to Administration menu and go to task &#8220;JDBC Resources&#8221;.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/JDBCResourcesTask.png" /><p class="wp-caption-text">Administration menu</p></div>
<p><br/></p>
<p>There are two resource type in the &#8220;JDBC Resources&#8221; screen. &#8220;Data Sources&#8221; and &#8220;Connection Pools&#8221;. Click the &#8220;Create&#8221; button under the &#8220;Connection Pools&#8221; header.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/JDBCResources.png" /><p class="wp-caption-text">JDBC Resources</p></div>
<p><br/></p>
<p>&#8220;Create Connection Pool &#8211; Application&#8221; screen shows up. Proceed with the default values and click &#8220;Continue&#8221;.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/CreateConnectionPool.png" /><p class="wp-caption-text">Create Connection Pool - Application</p></div>
<p><br/></p>
<p>&#8220;Create Connection Pool &#8221; screen shows up. Enter the value &#8220;Formspider Pool&#8221; for the &#8220;Name&#8221; field. Set &#8220;JDBC URL&#8221;, &#8220;Username&#8221; and &#8220;Password&#8221; of the Formspider schema. Click &#8220;Finish&#8221; to continue.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/CreateConnectionPool2.png" /><p class="wp-caption-text">Create Connection Pool</p></div>
<p><br/></p>
<p>&#8220;JDBC Resources&#8221; screen shows up again. Click &#8220;Create&#8221; in the the &#8220;Data Sources&#8221; section. &#8220;Create Data Source &#8211; Application &#038; Type&#8221; screen shows up. Press &#8220;Continue&#8221; to proceed with the default values.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/CreateDataSource.png" /><p class="wp-caption-text">Create Data Source - Application &#038; Type</p></div>
<p><br/></p>
<p>&#8220;Create Data Source &#8211; Managed Data Source&#8221; screen shows up. Enter the values &#8220;Formspider Data Source&#8221; and &#8220;jdbc/formspider&#8221; for the fields &#8220;Name&#8221; and &#8220;JNDI Location&#8221; respectively. Select &#8220;Formspider Pool&#8221; (which is already defined) for the field &#8220;Connection Pool&#8221;. Click &#8220;Finish&#8221; to complete.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img  style="border:solid 1px;" src="http://theformspider.com/learningcenter/images/deployIntoOC4J/CreateDataSource2.png" /><p class="wp-caption-text">Create Data Source</p></div>
<p><br/></p>
<p>JDBC Resources are created. To enable Formspider deployment to use these resources, navigate to the OC4J main directory. This is where OC4J is installed. Find the Web.xml file of the newly deployed application. The Web.xml file path may differ depending on the OC4J application name and the Formspider WAR file name. It should look something similar to this:</p>
<p>C:\[OC4J Installation Path]\j2ee\home\applications\formspider\fs-1.0\WEB-INF\</p>
<p>In the web.xml file, set &#8220;engineJdbcName&#8221; parameter to the value &#8220;jdbc/formspider&#8221; which is defined in the &#8220;JNDI Location&#8221; field in the &#8220;Create Data Source&#8221; screen.</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
  &lt;param-name&gt;engineJdbcName&lt;/param-name&gt;
  &lt;param-value&gt;jdbc/formspider&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
<p><p class="wp-caption-text">Defining &quot;engineJdbcName&quot; parameter in web.xml file</p></div>
<p><br/></p>
<p>Save the file and restart the OC4J.</p>
<h4>Connecting with Web.xml File Parameters</h4>
<p>It is also possible to define the database connection parameters in the web.xml file without creating any resources in the OC4J. This way is generally preferred in s development environment. Open web.xml file (how to find the web.xml file is described above) and edit the parameters, &#8220;engineSchemaURL&#8221;, &#8220;engineUsername&#8221;, &#8220;enginePassword&#8221; as the following:</p>
<ul>
<li>set &#8220;engineSchemaURL&#8221; to JDBC URL of Formspider schema</li>
<li>set &#8220;engineUsername&#8221; to Formspider schema name</li>
<li>set &#8220;enginePassword&#8221; to Formspider schema password</li>
</ul>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
  &lt;param-name&gt;engineSchemaURL&lt;/param-name&gt;
  &lt;param-value&gt;jdbc:oracle:thin:@192.168.1.122:1521:ORA10G&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
  &lt;param-name&gt;engineUsername&lt;/param-name&gt;
  &lt;param-value&gt;FORMSPIDER&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
  &lt;param-name&gt;enginePassword&lt;/param-name&gt;
  &lt;param-value&gt;FORMSPIDER&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
<p><p class="wp-caption-text">Connection parameters in web.xml file</p></div>
<p><br/></p>
<p>Save the file and restart the OC4J.</p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/deploying-formspider-middle-tier-into-oc4j/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E-Business Suite &amp; Formspider Integration</title>
		<link>http://theformspider.com/learningcenter/e-business-suite-formspider-integration/</link>
		<comments>http://theformspider.com/learningcenter/e-business-suite-formspider-integration/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 08:05:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[e-business suite]]></category>
		<category><![CDATA[integration]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1426</guid>
		<description><![CDATA[This tutorial explains how to build a Formspider application using EBS data and how to call a Formspider application from EBS main menu.]]></description>
			<content:encoded><![CDATA[<h2>1. Introduction</h2>
<p>Oracle E-Business Suite (EBS) covers a wide range of business processes. However, there are use cases where you want to extend your information system beyond the range of Oracle EBS. To achieve this, you can easily create complementary applications with Formspider which are securely integrated with Oracle EBS and its data. </p>
<p>This tutorial explains how to build a Formspider application using EBS data and how to call a Formspider application from EBS main menu.<br />
<br/></p>
<h2>2. Architecture</h2>
<h3>2.1 Formspider Architecture</h3>
<p>In a Formspider application, a client request goes to the database through the middle tier. By default, Formspider uses Apache Tomcat and it can also be deployed into any JEE compatible web application servers. Formspider middle tier uses JDBC connection and connects to the Formspider schema in the database. Formspider schema is the engine of the Formspider framework. </p>
<p>Each Formspider application has its own schema. Formspider runs an application by running its queries, delete-update-insert statements, PL/SQL procedures in the application’s own schema. For instance, if your application data model (tables, packages&#8230;) are in SCHEMA1, then Formspider runs the queries of the application in SCHEMA1. In Formspider jargon, SCHEMA1 is called as the “datasource schema” of the application.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/formspider%20architecture.png" title="Formspider Architecture" width="680" /><p class="wp-caption-text">Formspider Architecture</p></div><br />
<br/></p>
<h3>2.2 EBS Architecture</h3>
<p>EBS has a middle tier, as well. EBS middle tier connects to the APPS schema in the database. EBS has a separate schema for each of its modules. APPS is the main schema which has the public API’s of EBS database tier. APPS contains synonyms referencing objects of the other EBS schemas.</p>
<p><div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/ebs%20architecture.png" title="Formspider Architecture" width="680"  /><p class="wp-caption-text">EBS Architecture</p></div><br />
<br/></p>
<h2>3. Integrating Architectures</h2>
<p>To make Formspider work with EBS data, install Formspider database tier to the same database that EBS lives. Application Servers can stay separate. You can find detailed information about installing Formspider <a href="http://theformspider.com/gettingstarted.php">here</a>.</p>
<p>In the scenario presented in this tutorial, a user calls a custom Formspider Application from the EBS main menu. </p>
<p>To achieve this, create a new Formspider application and a new datasource schema for this application called “FS_APPS”.</p>
<h3>3.1 Calling Formspider Application From EBS Main Menu</h3>
<p>To call an external application from the EBS menu, define the menu item and its function. This function opens a URL pointing to the Formspider application. In order to bypass the EBS authentication for the Formspider application, (since the user is already logged in to the EBS) pass several EBS session parameters like user id, application id, etc&#8230; to the Formspider application and use these parameters for authorizing the Formspider application automatically.</p>
<p>The EBS session parameters should not be passed to the Formspider application in the URL string because of security reasons. Therefore, instead of calling the Formspider application directly, the EBS function calls a custom JSP page, named “fs.jsp” added to EBS middle tier. When a request to open the Formspider application arrives to fs.jsp, it validates the user session and connects to the APPS schema to create access token which is essentially a key-value pair, in the database. This access token is stored in a table. The key is a randomly generated string that is returned to the JSP. The value is kept in the database because it contains the EBS application session parameters that will be passed to the Formspider application. When fs.jsp receives the key, it appends the key to the URL string and redirects the page to the Formspider application. The Formspider application retrieves the key from the URL and validates it against the table in which the key value pair is kept. If the key is not valid, Formspider application does not start (there are several ways to prevent starting the Formspider application. For instance, it can show an empty screen).</p>
<p><div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/integration.png" title="Integration of Formspider and EBS Architectures" width="680"  /><p class="wp-caption-text">Integration of Formspider and EBS Architectures</p></div><br />
<br/></p>
<h3>3.2 Authentication and Authorization</h3>
<p>If the key is valid Formspider application uses the value associated with it to authenticate itself to EBS.</p>
<p>After the Formspider application is opened and user is authenticated, it checks which parts of the application user can access with EBS public APIs, fnd_global.apps_initialize and fnd_function.test. The examples of these APIs are below.<br />
<br/></p>
<h2>4. Creating and Calling Custom JSP From EBS</h2>
<h3>4.1 Creating the JSP File</h3>
<p>The source of fs.jsp:<br />
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: java; html-script: true; title: ; notranslate">
&lt;%@ page contentType=&quot;text/html;charset=windows-1252&quot;%&gt;
&lt;%@ page import=&quot;oracle.apps.fnd.common.WebRequestUtil&quot;%&gt;
&lt;%@ page import=&quot;oracle.apps.fnd.common.WebAppsContext&quot;%&gt;
&lt;%@ page import=&quot;java.sql.CallableStatement&quot;%&gt;
&lt;%@ page import=&quot;java.sql.Types&quot;%&gt;
&lt;%@ page import=&quot;java.sql.SQLException&quot;%&gt;

&lt;html&gt;

&lt;%

WebAppsContext ctx = WebRequestUtil.validateContext(request, response);

String userId = &quot;&quot; + ctx.getUserId();
String respId = &quot;&quot; + ctx.getRespId();

String sql = &quot;begin ?:= fs_apps.ebs_main_pkg.createToken(?,?); end;&quot;;
String token = &quot;&quot;;
CallableStatement stmt =null;

try
{
  	stmt = (ctx.getJDBCConnection()).prepareCall(sql);
  	stmt.registerOutParameter(1, Types.VARCHAR);
  	stmt.setString(2, userId);
  	stmt.setString(3, respId);
  	stmt.execute();
  	token = stmt.getString(1);
}
catch (SQLException e)
{
  	e.printStackTrace();
}

//Enter the URL of your Formspider Application
String redirectURL = &quot;http://127.0.0.1/fs_ebs/main.jsp?name=EBS%20Test#&quot; + token;
response.sendRedirect(redirectURL);

%&gt;

&lt;/html&gt;
</pre>
<p><p class="wp-caption-text">fs.jsp file</p></div>
<p><br/></p>
<p>Note that “ebs_main_pkg.createToken” function is owned by FS_APPS schema and it returns the key of the token.</p>
<p>Copy fs.jps file to EBS middle tier to the target path below (the path may be different depending on the EBS version):</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: bash; title: ; notranslate">
/u01/E-BIZ/apps/apps_st/comn/webapps/oacore/
</pre>
<p><p class="wp-caption-text">The path of fs.jsp</p></div>
<p><br/></p>
<p>Then, navigate to oacore directory and run the following command to compile the JSP file.</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: bash; title: ; notranslate">
$FND_TOP/patch/115/bin/ojspCompile.pl --compile -s 'fs.jsp' -p 2
</pre>
<p><p class="wp-caption-text">Compiling fs.jsp</p></div>
<p><br/></p>
<p>If the command above doesn’t work use the following command:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: bash; title: ; notranslate">
perl -x /u01/E-BIZ/apps/apps_st/appl/fnd/12.0.0/patch/115/bin/ojspCompile.pl --compile -s fs.jsp
</pre>
<p><p class="wp-caption-text">Compiling fs.jsp</p></div>
<p><br/></p>
<p>After compilation, restart the apache server and core using the following commands:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: bash; title: ; notranslate">
adstpall.sh apps/apps
adstrtal.sh apps/apps
</pre>
<p><p class="wp-caption-text">Restarting the apache server and core</p></div>
<p><br/></p>
<p>The JSP file is deployed to the EBS middle tier. Next, define necessary objects to call this JSP from the EBS main menu.</p>
<h3>4.2 Calling the JSP</h3>
<p>Login to EBS with SYSADMIN user.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/login.png" title="Login to EBS with SYSADMIN" width="680"  /><p class="wp-caption-text">Login to EBS with SYSADMIN</p></div>
<p><br/></p>
<p>At the main menu, click the item “Function” under the path “System Administrator &#8211; Application”.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/mainmenuOpenFunction.png" title="Open the Function Menu" width="680"  /><p class="wp-caption-text">Open the Function Menu</p></div>
<p><br/></p>
<h4>4.2.1 Creating The Function</h4>
<p>Create a new function. Enter the following values for the fields:</p>
<ul>
<li>&#8220;FS_FUNCTION&#8221; for Function and User Function Name</li>
<li>&#8220;SSWA jsp function&#8221; for Type</li>
<li>&#8220;fs.jsp&#8221; for HTML Call</li>
</ul>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/function1.png" title="Defining the EBS Function - 1" width="680"  /><p class="wp-caption-text">Defining the EBS Function - 1</p></div>
<p><br/></p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/function2.png" title="Defining the EBS Function - 2" width="680"  /><p class="wp-caption-text">Defining the EBS Function - 2</p></div>
<p><br/></p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/function3.png" title="Defining the EBS Function - 3" width="680"  /><p class="wp-caption-text">Defining the EBS Function - 3</p></div>
<p><br/></p>
<h4>4.2.2 Creating The Menu</h4>
<p>Next, create the menu item that calls the function created in the step above by selecting “System Administrator &#8211; Application &#8211; Menus” from the EBS menu. Enter the following values to the fields:</p>
<ul>
<li>&#8220;FS_MENU&#8221; for Menu and User Menu Name fields</li>
<li>&#8220;Standard&#8221; for Menu Type</li>
<li>&#8220;Start FS App&#8221; for Prompt</li>
<li>&#8220;FS_FUNCTION&#8221; for Function</li>
</ul>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/menu.png" title="Creating the EBS Menu" width="680"  /><p class="wp-caption-text">Creating the EBS Menu</p></div>
<p><br/></p>
<h4>4.2.3 Creating The Responsibility</h4>
<p>Create a new responsibility by selecting “System Administrator &#8211; Application &#8211; Responsibilities” from the EBS menu. Enter the following values to the fields:</p>
<ul>
<li>&#8220;FS_RESPONSIBILITY&#8221; for Responsibility Name and Responsibility Key fields</li>
<li>&#8220;Application Object Library&#8221; for Application field</li>
<li>&#8220;Oracle Self Service Web Applications&#8221; for Available From</li>
<li>&#8220;FS_MENU&#8221; for Menu field</li>
<li>&#8220;Standard&#8221; for Data Group Name</li>
<li>&#8220;Application Object Library&#8221; Data Group Application</li>
</ul>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/resp.png" title="Creating the EBS Responsibility" width="680"  /><p class="wp-caption-text">Creating the EBS Responsibility</p></div>
<p><br/></p>
<h4>4.2.4 Creating The User</h4>
<p>Create a new user from by selecting “System Administrator &#8211; Application &#8211; Users” from the EBS menu. Enter the following values:</p>
<ul>
<li>&#8220;FORMSPIDER&#8221; for User Name</li>
<li>Enter a password</li>
<li>Create a new record for Direct Responsibilities block and enter values “FS_RESPONSIBILITY”, “Application Object Library”, “Standard” for fields Responsibility, Application, Security Group respectively.</li>
</ul>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/user.png" title="Creating EBS User &quot;FORMSPIDER&quot;" width="680"  /><p class="wp-caption-text">Creating EBS User &quot;FORMSPIDER&quot;</p></div><br />
<br/></p>
<h2>5. Developing a Formspider Application Using EBS Data</h2>
<h3>5.1 Creating FS_APPS Schema</h3>
<p>Connect to the EBS database with &#8220;SYS&#8221; user and run the following scripts.</p>
<p><div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
CREATE USER FS_APPS
IDENTIFIED BY FS_APPS
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP
/
GRANT CREATE PROCEDURE TO FS_APPS
/
GRANT CREATE SEQUENCE TO FS_APPS
/
GRANT CREATE SESSION TO FS_APPS
/
GRANT CREATE SYNONYM TO FS_APPS
/
GRANT CREATE TABLE TO FS_APPS
/
GRANT CREATE TRIGGER TO FS_APPS
/
GRANT CREATE TYPE TO FS_APPS
/
GRANT CREATE VIEW TO FS_APPS
/
GRANT UNLIMITED TABLESPACE TO fs_apps
/
</pre>
<p><p class="wp-caption-text">User FS_APPS</p></div>
<p><br/></p>
<p>Then, connect to APPS schema and create the package &#8220;formspider_global&#8221;. This package wraps APPS APIs which will be used by the Formspider application. Please note the &#8220;authid definer&#8221; keyword added to the package specification in order to run it with the APPS schema privileges.</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
CREATE OR REPLACE
PACKAGE formspider_global AUTHID DEFINER AS

procedure apps_initialize(user_id number,
                          resp_id number,
                          resp_appl_id number,
                          security_group_id number := 0,
                          server_id number := -1);

function function_test(function_name in varchar2) return boolean;

function createToken(in_user_id varchar2, in_resp_id varchar2) return varchar2;

procedure updateUser(in_userName_tx varchar2, in_email_tx varchar2);

end;

end;
/

CREATE OR REPLACE
PACKAGE BODY formspider_global AS
--------------------------------------------------------------------------------
procedure apps_initialize(user_id in number,
                          resp_id in number,
                          resp_appl_id in number,
                          security_group_id number := 0,
                          server_id in number := -1) is
begin
  fnd_global.apps_initialize(user_id, resp_id, resp_appl_id,
  security_group_id, server_id);
end;
--------------------------------------------------------------------------------
function function_test(function_name varchar2) return boolean is
begin
  return fnd_function.test(function_name);
end;
--------------------------------------------------------------------------------
function createToken(in_user_id varchar2, in_resp_id varchar2) return varchar2 is
begin
  return fs_apps.ebs_main_pkg.createToken(in_user_id,in_resp_id);
end;
--------------------------------------------------------------------------------
procedure updateUser(in_userName_tx varchar2, in_email_tx varchar2) is
  pragma autonomous_transaction;
begin
  fnd_user_pkg.updateuser(
    x_user_name =&gt; in_userName_tx,
    x_owner =&gt; in_userName_tx,
    x_email_address =&gt; in_email_tx);
  commit;
end;
--------------------------------------------------------------------------------
END;
/

grant execute on formspider_global to FS_APPS
/
</pre>
<p><p class="wp-caption-text">Package Formspider_Global</p></div>
<p><br/></p>
<p>Next, connect to FS_APPS and run the following scripts to create “t_token” table and “ebs_main_pkg” package. T_token table is used to keep key value pairs. The package is used by Formspider application.</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
create table t_token(token_id varchar2(200) primary key, user_id number, resp_id number)
/
</pre>
<p><p class="wp-caption-text">Table t_token</p></div>
<p><br/></p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
CREATE OR REPLACE
PACKAGE ebs_main_pkg IS

procedure postOpen;
procedure populate;
procedure save;
function createToken(in_user_id varchar2, in_resp_id varchar2) return varchar2;

END;
/

CREATE OR REPLACE
PACKAGE BODY ebs_main_pkg IS
--------------------------------------------------------------------------------
function appsAuthorise(in_user_id number, in_resp_id number) return boolean is
begin
  if in_resp_id is null then
    return false;
  end if;

  -- Init user and resp
  apps.formspider_global.apps_initialize(in_user_id, in_resp_id, 0);

  -- Check if user has permission on EBS Function
  return apps.formspider_global.function_test('FS_FUNCTION');

end;
--------------------------------------------------------------------------------
procedure postOpen is
  v_bookmark varchar2(4000);
  v_user_id number;
  v_resp_id number;

  --Get user_id and resp_id values from the t_token table and delete the row.
  --So that token will be used only once
  procedure useToken(in_token_id varchar2) is
    pragma autonomous_transaction;
  begin
    delete from t_token
    where token_id = in_token_id
    returning user_id, resp_id into v_user_id, v_resp_id;
    commit;
  end;

begin

  v_bookmark := api_application.getBookmark;
  useToken(v_bookmark);

  if appsAuthorise(v_user_id, v_resp_id) then
    api_session.add('user_id',v_user_id);
    api_session.add('resp_id',v_resp_id);
    api_frame.addPanel('mainFrame','centerCell','mainPanel');
  end if;

end;
--------------------------------------------------------------------------------
procedure populate is
begin
  api_datasource.setBindvar('EBS_USER1.user_id',api_session.getValueNR('user_id'));
  api_datasource.executeQuery('EBS_USER1');
end;
--------------------------------------------------------------------------------
procedure save is
begin
  api_application.doCommit;
end;
--------------------------------------------------------------------------------
function createToken(in_user_id varchar2, in_resp_id varchar2) return varchar2 is
  v_token_id varchar2(255);
  pragma autonomous_transaction;
begin

  --create a random string as token id
  v_token_id := utl_raw.cast_to_raw( DBMS_RANDOM.STRING('p', 10) ||
                  to_char(SYSTIMESTAMP, 'YYYYMMDDHH24MISSFF6'));

  insert into t_token(token_id,user_id,resp_id)
  values (v_token_id,in_user_id,in_resp_id);

  commit;

  return v_token_id;
end;
--------------------------------------------------------------------------------
END;
/
</pre>
<p><p class="wp-caption-text">Package Ebs_main_pkg</p></div>
<p><br/></p>
<h3>5.2 Creating Formspider Application</h3>
<p>Open Formspider IDE and click “New Application” under the “File” menu. The “New Application” dialog will show up. Enter the application name and datasource schema name and then press “OK”.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/NewApplication.png" title="Creating new Formspider application, &quot;EBS Test&quot;"  /><p class="wp-caption-text">Creating new Formspider application, &quot;EBS Test&quot;</p></div>
<p><br/></p>
<h3>5.3 Creating the Model</h3>
<p>Create the view that queries the EBS data in the FS_APPS schema. Connect to the APPS schema and grant the necessary object privileges to FS_APPS:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
grant select, insert, update, delete on apps.fnd_user to fs_apps;
</pre>
<p><p class="wp-caption-text">Grants for FS_APPS object</p></div>
<p><br/></p>
<p>Run the following DDLs in FS_APPS:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
create or replace view ebs_user (
  user_id, user_name, email_address,
  constraint ebs_user_pk primary key (user_id) rely disable novalidate
) as
select user_id, user_name, email_address
from apps.fnd_user
/

CREATE OR REPLACE TRIGGER ebs_user_iud
INSTEAD OF UPDATE ON ebs_user
REFERENCING NEW AS NEW OLD AS OLD
begin
  if updating then
    apps.formspider_global.updateUser(:new.user_name,:new.email_address);
  end if;
end;
/
</pre>
<p><p class="wp-caption-text">View EBS_User</p></div>
<p><br/></p>
<p>After creating the view, create the Formspider objects; datasource definition and datasource which will be used to query the “EBS_USER” view. Go to the Formspider IDE again and expand the “Datasource Definitions” accordion, right click the “Datasource Definitions” node and select “New” from the pop up menu.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/createDSD.png" title="Creating a new datasource definition"  /><p class="wp-caption-text">Creating a new datasource definition</p></div>
<p><br/></p>
<p>The “New Datasource Definition” dialog shows up. Select “View” radio button from “Based On” section. Choose USER_ID column as the Primary Key and enable “Delete, Insert, Update” from “DML Permissions” section.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/datasource%20definition.png" title="Creating &quot;EBS_USER&quot; datasource definition"  /><p class="wp-caption-text">Creating &quot;EBS_USER&quot; datasource definition</p></div>
<p><br/></p>
<p>To filter retrieving only the data of one user, go to the “Query” section, enter the following where clause:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: sql; title: ; notranslate">
user_id = :user_id
</pre>
<p><p class="wp-caption-text">Where clause of EBS_USER datasource definition</p></div>
<p><br/></p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/query.png" title="Defining where clause"   /><p class="wp-caption-text">Defining where clause</p></div>
<p><br/></p>
<p>Define the bind variable “user_id”:</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/bindvar.png" title="Defining bind variable"   /><p class="wp-caption-text">Defining bind variable</p></div>
<p><br/></p>
<h3>5.4 Creating the User Interface</h3>
<p>Create a simple form with user id, user name and email fields.</p>
<p>Expand the “Containers” accordion, select the “Panels” node in the navigation tree and click the “+” button to create a new panel. Alternatively, you may right click the “Panels” node and select the“New” menu item from the pop up menu. The “New Panel” dialog shows up. Enter “userPanel” as the name of the panel and click “OK”. Edit the “userPanel” XML so that it looks like the following:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel preferredHeightPolicy=&quot;Dynamic&quot;&gt;
  &lt;tableLayout cellSpacing=&quot;5&quot;&gt;
    &lt;row heightPolicy=&quot;Dynamic&quot;&gt;
      &lt;cell width=&quot;100&quot; hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel label=&quot;USER_ID&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textField editable=&quot;N&quot; column=&quot;USER_ID&quot; dataSource=&quot;EBS_USER1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row heightPolicy=&quot;Dynamic&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel label=&quot;USER_NAME&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textField editable=&quot;N&quot; column=&quot;USER_NAME&quot; dataSource=&quot;EBS_USER1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
    &lt;row heightPolicy=&quot;Dynamic&quot;&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textLabel label=&quot;EMAIL_ADDRESS&quot;/&gt;
      &lt;/cell&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Full&quot;&gt;
        &lt;textField column=&quot;EMAIL_ADDRESS&quot; dataSource=&quot;EBS_USER1&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p><p class="wp-caption-text">Panel userPanel</p></div>
<p><br/></p>
<p>Add two buttons to the application named populate and save. The Populate button will fill in the user data fields in the application with the current user’s information. Save button commits the changes of the form to the EBS system. Please see ebs_main_pkg.populate and ebs_main_pkg.save procedures above.<br />
Define action objects to use these procedures in the Formspider application. Go to the Formspider IDE and expand the “Actions” accordion, select the “Actions” node, click the “+” button to create a new action. Alternatively, you may right click the “Actions” node and select “New” from the pop up menu. The “New Action” dialog shows up. Enter “populate” as the action name and “ebs_mainl_pkg.populate” as the procedure. Click “OK” to save your action. Similarly, create a new action for “ebs_main_pgk.save” procedure. Open the “New Action” dialog, enter “save” as the action name and “ebs_mainl_pkg.save” as the procedure.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/actionPopulate.png" title="New action &quot;populate&quot;"   /><p class="wp-caption-text">New action &quot;populate&quot;</p></div>
<p><br/></p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/actionSave.png" title="New action &quot;save&quot;"   /><p class="wp-caption-text">New action &quot;save&quot;</p></div>
<p><br/></p>
<p>You are now ready to create the buttons. Create a new panel, enter “buttonPanel” as the name of the panel and save the new panel pressing “OK” button. Then go to “buttonPanel” XML. Edit the panel XML so that it looks like the following:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;tableLayout cellSpacing=&quot;10&quot;&gt;
    &lt;row height=&quot;20&quot;&gt;
      &lt;cell&gt;
        &lt;button label=&quot;query&quot;&gt;
          &lt;events&gt;
            &lt;buttonPress action=&quot;populate&quot;/&gt;
          &lt;/events&gt;
        &lt;/button&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
        &lt;button label=&quot;save&quot;&gt;
          &lt;events&gt;
            &lt;buttonPress action=&quot;save&quot;/&gt;
          &lt;/events&gt;
        &lt;/button&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p><p class="wp-caption-text">Panel buttonPanel</p></div>
<p><br/></p>
<p>Go to the main panel that is automatically created with the application and include the two panels into the mainPanel:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;North&quot; height=&quot;40&quot; &gt;
      &lt;include panelName=&quot;buttonPanel&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
      &lt;include panelName=&quot;userPanel&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/panel&gt;
</pre>
<p><p class="wp-caption-text">Panel mainPanel</p></div>
<p><br/></p>
<p>When the application runs, the populate button does not retrieve any data because in the populate procedure the user data is received from the Formspider session. However, the session is not yet populated with this information yet. Set it by reading the key that is sent from the EBS through the URL. If there is not a key in the URL, show an empty screen. To achieve this, create a new panel and name it “emptyPanel”. Edit the “emptyPanel” so that its XML definition is as the following:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;tableLayout cellSpacing=&quot;30&quot;&gt;
    &lt;row&gt;
      &lt;cell hAlign=&quot;Full&quot; vAlign=&quot;Center&quot;&gt;
        &lt;textLabel font-color=&quot;Red&quot; font-style=&quot;Bold&quot; name=&quot;errorLabel&quot; label=&quot;Invalid token!&quot; text-align=&quot;Center&quot;/&gt;
      &lt;/cell&gt;
    &lt;/row&gt;
  &lt;/tableLayout&gt;
&lt;/panel&gt;
</pre>
<p><p class="wp-caption-text">Panel emptyPanel</p></div>
<p><br/></p>
<p>Add the emptyPanel to the main frame. Replace emptyPanel with mainPanel if the key is validated. To find the main frame, expand the “Containers” accordion, expand “Windows” and “Mainframe” nodes. Edit the mainframe to look like the following:</p>
<div class="wp-caption aligncenter" style="width: 690px"></p>
<pre class="brush: xml; title: ; notranslate">
&lt;mainframe title=&quot;EBS Test&quot; width=&quot;500&quot; height=&quot;500&quot;&gt;
  &lt;borderLayout&gt;
    &lt;cell docking=&quot;Center&quot; name=&quot;centerCell&quot;&gt;
      &lt;include panelName=&quot;emptyPanel&quot;/&gt;
    &lt;/cell&gt;
  &lt;/borderLayout&gt;
&lt;/mainframe&gt;
</pre>
<p><p class="wp-caption-text">The mainframe</p></div>
<p><br/></p>
<h3>5.5 Using the Key-Value Pair</h3>
<p>As mentioned before, the key is present in the URL string. Use the api_application.getBookmark API to retrieve the key in the Post-Open event of the Formspider application. Query the t_token table to find the key-value pair in the table. Get corresponding user id and responsibility id values. Please see ebs_main_pkg.postOpen procedure for more details.</p>
<p>To define the Post Open action, go to Formspider IDE and create a new action. Enter “postOpen” as the action name and “ebs_mainl_pkg.postOpen” as the procedure.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/actionPostOpen.png" title="New action &quot;postOpen&quot;"   /><p class="wp-caption-text">New action &quot;postOpen&quot;</p></div>
<p><br/></p>
<p>Open “Appliaction Edit Dialog” from the File menu or using edit button right to the Application combo box.  In the dialog, open the “Events” tab and select postOpen action for the Post Open event.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/eventPostOpen.png" title="Defining &quot;Post Open&quot; event"   /><p class="wp-caption-text">Defining &quot;Post Open&quot; event</p></div><br />
<br/></p>
<h2>6. Running the Application</h2>
<p>Login to EBS with FORMSPIDER user.</p>
<p><div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/loginEBSFormspider.png" title="Login to EBS with FORMSPIDER user"   /><p class="wp-caption-text">Login to EBS with FORMSPIDER user</p></div>
<p><br/></p>
<p>Expand the menu “FS_RESPONSIBILITY” and click “Start FS App”. Please note that, when you try to expand the menu FS_RESPONSIBIILTY, EBS may open the Formspider application since there is just one menu item defined under FS_RESPONSIBIILTY.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/Oracle%20Applications%20Home%20Page.png" title="Click &quot;Start FS App&quot;"   /><p class="wp-caption-text">Click &quot;Start FS App&quot;</p></div>
<p><br/></p>
<p>The Formspider application starts. Press the query button in order to populate the data of the user FORMSPIDER. The application retrieves FORMSPIDER user id from the access token in the database. You can edit email field and save the changes.</p>
<div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/EBS%20Test.png" title="Formspider application started"   /><p class="wp-caption-text">Formspider application started</p></div>
<p><br/></p>
<p>Try to open the application outside of the context of the EBS (from the browser or IDE without creating a key-value pair). Note that the application only displays an empty panel. </p>
<p>Refresh the application opened from the EBS menu, to see that you get the same result. This is because the key-value pair was designed to be single use.</p>
<p><div class="wp-caption aligncenter" style="width: 690px"><img alt="" src="http://theformspider.com/learningcenter/images/EBSIntegration/EBS%20Test%20invalid%20user.png" title="Formspider application started but not authenticated"   /><p class="wp-caption-text">Formspider application started but not authenticated</p></div><br />
<br/></p>
<h2>7. Conclusion</h2>
<p>Formspider enables PL/SQL developers build great enterprise WEB applications with just PL/SQL. Formspider applications run using 100% AJAX, DHTML and JavaScript without the need to know any of them. You can easily integrate Formspider applications with EBS to extend the capabilities of your information system.</p>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/e-business-suite-formspider-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 31: How to upload any image file and display it on Image component at run time</title>
		<link>http://theformspider.com/learningcenter/how-to-upload-photo-to-image-component-at-run-time/</link>
		<comments>http://theformspider.com/learningcenter/how-to-upload-photo-to-image-component-at-run-time/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 07:00:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1539</guid>
		<description><![CDATA[This tutorial explains how to bind the image component to a datasource column of data type BLOB.]]></description>
			<content:encoded><![CDATA[<p>This tutorial explains how to bind the image component to a datasource column of data type BLOB. This tutorial creates a new application which uploads an image to datasource column and displays the uploaded image with an image component. You may want to check <a href="http://theformspider.com/learningcenter/tutorial-15-how-to-upload-a-file/">Tutorial 15: How to upload a file</a> tutorial first.</p>
<h3>Creating the Formspider Application</h3>
<p>Open Formspider IDE and click <em>“New Application”</em> under the <em>“File”</em> menu. The <em>&#8220;New Application&#8221; dialog</em> shows up. Enter “image” as the name of the application and select any schema as its <em>Datasource Schema</em> name.  If you are using Formspider Online, you do not need to enter database schema name since your account is already configured to use your online database schema. Leave other fields empty and click <em>&#8220;OK&#8221;</em>. This creates the “image” application with a default <em>mainframe</em> (called <em>“mainFrame”</em>) and a default <em>panel</em> (called <em>“mainPanel”</em>).</p>
<h4>a- Creating Datasource</h4>
<p>Create a new table named <em>T_IMAGE</em> in your <em>Datasource Schema</em> which has a BLOB column and insert empty row into table. Here is a sample DDL:</p>
<pre class="brush: sql; title: ; notranslate">
CREATE TABLE &quot;T_IMAGE&quot;
(
    &quot;PHOTO&quot; BLOB
)
/
INSERT INTO T_IMAGE VALUES (null)
/
</pre>
<p>Then create a new <em>datasource definion</em> based on this table. To achieve this, expand the <em>“Datasource Definitions”</em> accordion panel, select the <em>“Datasource Definitions”</em> root node and click the “+” button from the toolbar of the accordion panel. The <em>“New Datasource Definition”</em> dialog shows up.</p>
<p>Select <em>“Table”</em> from the <em>“Based On”</em> section and <em>T_IMAGE</em> table from the combobox. Note that, the name of the <em>“Datasource Definitions”</em> is <em>&#8220;T_IMAGE1&#8243;</em>. Create an empty row in table.</p>
<h4>b- Creating GUI of the application</h4>
<p>As the first step, double click the <em>“mainPanel”</em> under the <em>“Panels”</em> node of the <em>“Containers”</em> navigation tree to open it in the editor. Edit <em>panel</em> XML so that it contains a <em>fileUpload</em> component and an <em>image</em> component.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;xyLayout&gt;
    &lt;cell x=&quot;5&quot; y=&quot;5&quot;&gt;
      &lt;fileUpload name=&quot;upload_photo&quot; domain=&quot;DefaultBLOB&quot; column=&quot;PHOTO&quot; dataSource=&quot;T_IMAGE1&quot; uploadOnEvent=&quot;valueChanged&quot; uploadFrom=&quot;mainPanel.upload_photo&quot;&gt;
        &lt;events&gt;
          &lt;valueChanged&gt;&lt;/valueChanged&gt;
        &lt;/events&gt;
      &lt;/fileUpload&gt;
    &lt;/cell&gt;
    &lt;cell x=&quot;5&quot; y=&quot;60&quot;&gt;
      &lt;image name=&quot;img&quot; column=&quot;PHOTO&quot; dataSource=&quot;T_IMAGE1&quot;/&gt;
    &lt;/cell&gt;
  &lt;/xyLayout&gt;
&lt;/panel&gt;
</pre>
<p>In this panel, fileUpload and image components are bound to the same column. This way, when the value of fileUpload component is changed, the display of the image component changes. Note that, there is an empty <em>&#8220;valueChanged&#8221;</em> event without an action which is used to send uploaded file to the database.</p>
<h3>Running application</h3>
<p>Press <em>“Run on Web”</em> button or press <em>F7</em> to run the <em>application</em>. Use the <em>Browse</em> button to select an image file. Upload the image. Note the image component shows the last uploaded image.</p>
<div class="wp-caption aligncenter" style="width: 744px"><img src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/upload_image.jpg" width="250" height="150"/></a><p class="wp-caption-text">Binding image component to a datasource column</p></div>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/how-to-upload-photo-to-image-component-at-run-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial 30: Integrating Oracle Reports into Formspider using htmlRenderer component &#8211; 2</title>
		<link>http://theformspider.com/learningcenter/tutorial-30-integrating-oracle-reports-into-formspider-using-htmlrenderer-component-2/</link>
		<comments>http://theformspider.com/learningcenter/tutorial-30-integrating-oracle-reports-into-formspider-using-htmlrenderer-component-2/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 16:28:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[reports]]></category>

		<guid isPermaLink="false">http://theformspider.com/learningcenter/?p=1508</guid>
		<description><![CDATA[This is tutorial explains how to use the new Formspider servlet that makes easier for developers to render reports produced by Oracle Reports.]]></description>
			<content:encoded><![CDATA[<p>Since version 1.0, Formspider has a servlet that makes it easier for developers to render reports produced by Oracle Reports. This is tutorial shows how to use this new feature.</p>
<h3>1- Creating Reports using Oracle Reports Designer</h3>
<p>If you already created the report file in &#8220;<a href="tutorial-17-integrating-oracle-reports-into-formspider-using-htmlrenderer-component/" target="_blank">Tutorial 17: Integrating Oracle Reports into Formspider using htmlRenderer component</a>&#8220;, please skip to step 2.<br />
As the first step, create a report that shows data from <em>Human Resources (HR)</em> schema tables. Open <em>Reports Designer</em> and create a new report using <em>Report Wizard</em>. Select <em>“Create both Web and Paper Layout”</em> as layout type;<br />
<div class="wp-caption aligncenter" style="width: 610px"><br />
<img src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-1.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">Select “Create both Web and Paper Layout” option as layout type</p></div></p>
<p>Then, select <em>“Group Above”</em> as report style;</p>
<div class="wp-caption aligncenter" style="width: 610px"><img class="aligncenter size-full wp-image-778" src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-2.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">Select “Group Above” as report style</p></div>
<p>This report queries “Employees” and “Departments” tables using the “dep_id” parameter and shows employees working in a particular department. Type the following query as the report&#8217;s data source definition:</p>
<pre class="brush: sql; title: ; notranslate">
select e.employee_id
      ,e.first_name
      ,e.last_name
      ,e.phone_number
      ,e.salary
      ,d.department_name
      ,m.first_name as manager_name
      ,m.last_name as manager_surname
  from employees e, departments d, employees m
 where e.department_id = d.department_id
   and d.manager_id = m.employee_id
   and d.department_id = :dep_id
</pre>
<div class="wp-caption aligncenter" style="width: 610px"><img class="aligncenter size-full wp-image-781" src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-3.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">Datasource definition query</p></div>
<p>Select <em>department_name</em> field as a group field;<br />
<div class="wp-caption aligncenter" style="width: 610px"><br />
<img class="aligncenter size-full wp-image-782" src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-4.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">Group field selection</p></div></p>
<p>And remaining fields as display fields;</p>
<div class="wp-caption aligncenter" style="width: 610px"><br />
<img class="aligncenter size-full wp-image-783" src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-5.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">Display field selection</p></div>
<p>Use the <em>“Wine”</em> template in this report;</p>
<div class="wp-caption aligncenter" style="width: 610px"><br />
<img class="aligncenter size-full wp-image-784" src="http://theformspider.com/learningcenter/wp-content/uploads/2011/09/RESIM-6.jpg" alt="" width="600" height="381" /><p class="wp-caption-text">“Wine” template selected</p></div>
<p>Save the report with <em>“employeesOfDepartments”</em> as file name and <em>Reports Binary(rdf)</em> as file type.</p>
<p>You may also download this report file from the following link:</p>
<p><a href="http://theformspider.com/learningcenter/codesamples/tutorial17/employeesOfDepartments.rdf"> employeesOfDepartments.rdf</a></p>
<p>Finally, create a &#8220;reports&#8221; folder under &#8220;C:\&#8221; and place the report file under it. Also create a &#8220;temp&#8221; folder under the newly created &#8220;C:\reports\&#8221; folder. You may change the paths of these folders by editing the <em>web.xml</em> file in your Tomcat installation.</p>
<h3>2- Setting Connection Parameters</h3>
<p>Formspider has a built-in Oracle Reports servlet. You just need to set connection parameters and path of the Oracle Reports files. Open the <em>web.xml</em> file in &#8220;\webapps\formspider\WEB-INF&#8221; folder in your <em>Tomcat</em> installation and edit the following connection parameters.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
       &lt;param-name&gt;reportCommand&lt;/param-name&gt;
       &lt;param-value&gt;rwrun.exe&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
       &lt;param-name&gt;fileDirectory&lt;/param-name&gt;
       &lt;param-value&gt;c:\reports\&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
       &lt;param-name&gt;tempDirectory&lt;/param-name&gt;
       &lt;param-value&gt;c:\reports\temp\&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
	&lt;param-name&gt;databaseTNSName&lt;/param-name&gt;
	&lt;param-value&gt;YOUR_TNSNAME&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
	&lt;param-name&gt;databaseUsername&lt;/param-name&gt;
	&lt;param-value&gt;YOUR_USERNAME&lt;/param-value&gt;
&lt;/context-param&gt;
&lt;context-param&gt;
	&lt;param-name&gt;databasePassword&lt;/param-name&gt;
	&lt;param-value&gt;YOUR_PASSWORD&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
<p>The “reportCommand” parameter is path of the “rwrun.exe” file. The <em>rwrun</em> command runs a report using the Reports Server. You may start the Reports Server as a stand alone server with <em>rwserver server=server_name</em> command from the Command Line. The “fileDirectory” is the directory where the Oracle Reports files reside. “tempDirectory” is the place that Formspider uses to create PDF files. The “databaseTNSName”, “databaseUsername”, and “databasePassword” parameters are database connection parameters.</p>
<p>Once the correct settings are made, you must see the &#8220;Welcome.. Please select a report and press run.&#8221; message, when you go to the &#8220;[ApplicationServerURL]/formspider/oraclereportsservlet&#8221; webpage.</p>
<h3>3- Creating a Formspider application that displays reports in htmlRenderer component</h3>
<p>This sections explains creating a simple Formspider application that shows reports inside an <em>htmlRenderer</em> component. </p>
<p>Open <em>Formspider IDE</em> and create an application named “OracleReports_ReportsServer”. Set &#8220;HR&#8221; as datasource schema name.</p>
<h4>3a- Creating Datasources</h4>
<p>Create a new <em>datasource definion</em> based on a table;</p>
<p>To achieve this, expand the <em>“Datasource Definitions”</em> accordion Panel, select the <em>“Datasource Definitions”</em> root node and click the “+” button from the toolbar of the accordion panel. The <em>“New Datasource Definition”</em> dialog shows up.</p>
<p>Select <em>“Table”</em> from the <em>“Based On”</em> section and <em>“Departments”</em> table from the combobox. This datasource definition is used as the datasource of a combobox so that users can select the department of the employees to be shown in <em>“employeesOfDepartments”</em> report.</p>
<h4>3b- Creating GUI of the application</h4>
<p>Expand the <em>“Containers”</em> accordion Panel, expand <em>“Windows”</em> node and then <em>“Mainframe”</em> node from the tree, double-click <em>“mainFrame”</em> node and edit the XML as the following;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;mainframe title=&quot;Oracle Reports Demo&quot; width=&quot;1280&quot; height=&quot;800&quot; maximizeOnStartUp=&quot;Y&quot;&gt;
 &lt;borderLayout&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
     &lt;include panelName=&quot;mainPanel&quot;/&gt;
    &lt;/cell&gt;
 &lt;/borderLayout&gt;
&lt;/mainframe&gt;
</pre>
<p>Note that maximizeOnStartUp attribute is set as <em>“Y”</em> and the title as <em>“Oracle Reports Demo”</em>.</p>
<p>Select the <em>“Panels”</em> node and click the “+” button from the toolbar of the accordion panel to create a new panel. Enter <em>“menuPanel”</em> as panel name and click <em>“OK”</em>. Edit panel XML so that it looks like this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
  &lt;xyLayout&gt;
    &lt;cell x=&quot;5&quot; y=&quot;5&quot; width=&quot;80&quot;&gt;
      &lt;textLabel label=&quot;Department:&quot; text-align=&quot;Right&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell x=&quot;100&quot; y=&quot;5&quot; width=&quot;150&quot;&gt;
      &lt;comboBox name=&quot;dep&quot; displayColumn=&quot;DEPARTMENT_NAME&quot; valueColumn=&quot;DEPARTMENT_ID&quot; listDataSource=&quot;DEPARTMENTS1&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell x=&quot;260&quot; y=&quot;5&quot; width=&quot;120&quot;&gt;
      &lt;button name=&quot;report&quot; label=&quot;Run Report&quot;/&gt;
    &lt;/cell&gt;
  &lt;/xyLayout&gt;
&lt;/panel&gt;
</pre>
<p>Next, open and edit the XML of the <em>“mainPanel”</em>:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;panel&gt;
 &lt;borderLayout&gt;
    &lt;cell docking=&quot;North&quot; height=&quot;30&quot;&gt;
     &lt;include panelName=&quot;menuPanel&quot;/&gt;
    &lt;/cell&gt;
    &lt;cell docking=&quot;Center&quot;&gt;
     &lt;htmlRenderer name=&quot;renderer&quot;/&gt;
    &lt;/cell&gt;
 &lt;/borderLayout&gt;
&lt;/panel&gt;
</pre>
<p>Add the <em>“menuPanel”</em> to the north of this panel with a height of “30”. The Reports are displayed inside the htmlRenderer named <em>“renderer”</em> and cover most of the screen.</p>
<h4>3c- Creating the Database Procedures</h4>
<p>At this step, create a package named <em>“ORACLEREPORTS_REPORTSSERVER”</em>:</p>
<p><b>Package Spec:</b></p>
<pre class="brush: sql; title: ; notranslate">
CREATE OR REPLACE
PACKAGE ORACLEREPORTS_REPORTSSERVER is
 procedure showReport;
end;
</pre>
<p><b>Package Body:</b></p>
<pre class="brush: sql; title: ; notranslate">
create or replace
PACKAGE BODY ORACLEREPORTS_REPORTSSERVER is
--------------------------------------------------------------------------------
procedure showReport is
 -- report url
 v_reportUrl_tx              varchar(32767);
begin
 v_reportUrl_tx := '[ApplicationServerURL]/formspider/oraclereportsservlet?';

 v_reportUrl_tx := v_reportUrl_tx || 'rep_name=employeesOfDepartments.rdf';

 v_reportUrl_tx := v_reportUrl_tx || '&amp;application_id=' || api_application.getid;

 -- get dep_id parameter value from &quot;Department&quot; combobox'
 v_reportUrl_tx := v_reportUrl_tx || '&amp;dep_id=' || api_component.getvaluenr('menuPanel.dep');

 -- show report
 api_component.seturl('mainPanel.renderer', v_reportUrl_tx);

end;
--------------------------------------------------------------------------------
end;
</pre>
<p>The <em>“showReport”</em> procedure builds the report URL according to the selected parameters and modifies the URL of the htmlRenderer component.<br />
You may need to update <em>v_reportUrl_tx</em> variable in the package with appropriate values for your evironment.</p>
<h4>3d- Creating Actions and attaching to the Components</h4>
<p>Create an action named <em>“showReport”</em> pointing to the procedure <em>ORACLEREPORTS_REPORTSSERVER.showReport</em></p>
<p>Open the XML of the <em>“menuPanel”</em> and add a buttonPress event to the button named <em>“report”</em>:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;button name=&quot;report&quot; label=&quot;Run Report&quot;&gt;
 &lt;events&gt;
    &lt;buttonPress action=&quot;showReport&quot;/&gt;
 &lt;/events&gt;
&lt;/button&gt;
</pre>
<h3>Running reports</h3>
<p>Run the application and see the report output showing in the application after you select a department and an output format.</p>
<div class="wp-caption aligncenter" style="width: 744px"><img src="http://theformspider.com/learningcenter/wp-content/uploads/2012/04/Capture1.jpg" alt="" title="" width="734" height="229" class="aligncenter size-full wp-image-877" /></a><p class="wp-caption-text">Oracle Reports successfully integrated into Formspider Application</p></div>
]]></content:encoded>
			<wfw:commentRss>http://theformspider.com/learningcenter/tutorial-30-integrating-oracle-reports-into-formspider-using-htmlrenderer-component-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

