XML dataisland and input fields a new type of db column

To use this code you need Explorer 5.5, think a view and a db column without any @formulas or the 65k problem.

Xml is the answer although limited to Explorer 5.5. This example shows you how you can let a user choose and go through a view and choose an item which can then be saved on an order form.


Code: the xml:
<?xml version="1.0"?>
<partscatalog>
<part><partname>12 Volt Corded Spotlight</partname><partnumber>CS9586</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>15.77</regprice><saleprice>13.83</saleprice></part><part><partname>Automotive meter</partname><partnumber>AM8754</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>108.36</regprice><saleprice>106.95</saleprice></part><part><partname>Gravity Feed Spray Gun</partname><partnumber>GFSG2224</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>134.36</regprice><saleprice>133.56</saleprice></part><part><partname>6X9 Inch 3-Way 160 Watt Speaker Set</partname><partnumber>SS4982</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>19.95</regprice><saleprice>18.50</saleprice></part><part><partname>40 Watt Power Booster</partname><partnumber>PB5423</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>14.95</regprice><saleprice></saleprice></part><part><partname>Digital Battery Analyzer</partname><partnumber>BA85914o367a</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>313.86</regprice><saleprice>280.12</saleprice></part><part><partname>Ignition Firing Indicator</partname><partnumber>IFI518764</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>22.36</regprice><saleprice>20.67</saleprice></part><part><partname>Engine Rebuild Kits</partname><partnumber>RB98i0965</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>101.28</regprice><saleprice>95.95</saleprice></part><part><partname>11-1/2" Carburetor Linkage</partname><partnumber>CL856222</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>8.67</regprice><saleprice>6.80</saleprice></part><part><partname>Acme Deluxe Fuel Pump</partname><partnumber>DFP98402883</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>447.99</regprice><saleprice>410.99</saleprice></part><part><partname>Acme Cam and Lifter</partname><partnumber>ACL9978523</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>101.28</regprice><saleprice></saleprice></part><part><partname>Cordless Drill</partname><partnumber>CD5894s</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>75.50</regprice><saleprice></saleprice></part><part><partname>Electric Power Washer</partname><partnumber>EPW85497</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>188.10</regprice><saleprice></saleprice></part><part><partname>5X7 Rectangular Light Cover</partname><partnumber>RLC5871s</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>10.95</regprice><saleprice></saleprice></part><part><partname>Back-up Lights</partname><partnumber>BL3321</partnumber><manufacturer>Acme</manufacturer><stock>In Stock</stock><regprice>95.42</regprice><saleprice>85.95</saleprice></part>
</partscatalog>



the script (take away the //):
//<SCRIPT LANGUAGE="JavaScript">
//<!-- 
//function movenext()
//{
//x=xmldso.recordset
//if (x.absoluteposition < x.recordcount)
	//{
	//x.movenext()
	//}
//}
//function moveprevious()
//{
//x=xmldso.recordset
//if (x.absoluteposition > 1)
	//{
	//x.moveprevious()
	//}
//}
// -->
//</SCRIPT>

add this div tag;
<xml src="./GetParts?OpenPage" id="xmldso" async="false">

the html:
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR VALIGN=top><TD WIDTH="210" BGCOLOR="E1E1E1" COLSPAN=2>
<INPUT TYPE=button onClick="moveprevious()" VALUE="<<"> 
<INPUT TYPE=button onClick="movenext()" VALUE=">>"> <B><FONT SIZE=2 FACE="Arial">Choose from parts:</FONT></B></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Arial">PartName:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="PartName" VALUE="" TITLE="PartName" datasrc="#xmldso" datafld="PartName" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Arial">PartNumber:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="PartNumber" VALUE="" datasrc="#xmldso" datafld="PartNumber" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Arial">manufacturer:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="manufacturer" VALUE="" datasrc="#xmldso" datafld="manufacturer" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Arial">stock:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="stock" VALUE="" datasrc="#xmldso" datafld="stock" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Times New Roman">regprice</FONT></B><B><FONT SIZE=2 FACE="Arial">:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="regprice" VALUE="" datasrc="#xmldso" datafld="regprice" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="C0E1FF"><B><FONT SIZE=2 FACE="Arial">saleprice:</FONT></B></TD><TD WIDTH="129">
<INPUT NAME="saleprice" VALUE="" TITLE="saleprice" datasrc="#xmldso" datafld="saleprice" size="35"></TD></TR>

<TR VALIGN=top><TD WIDTH="81" BGCOLOR="FFFFFF"> </TD><TD WIDTH="129"><IMG SRC="/icons/ecblank.gif" BORDER=0 HEIGHT=1 WIDTH=1 ALT=""></TD></TR>
</TABLE>

Tips: by adding datasrc="#xmldso" datafld="regprice" to every field you get the first value in the xml doc.


This was last published in January 2001

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close