## ## Document History ## ## Created (peeje01) ## 27-Apr-1999 (peeje01) ## Change include file name from -h.html to _h.html ## 02-Apr-2004 (fanra01) ## Bug 112091 ## Editorial changes from griel02. ##
<html>
<head>
<title>Graphical Switched Hyper Link to Shakespeare's Plays by type</title>
</head>
<body>
<h1>Graphical Switched Hyper Link to Shakespeare's Plays by type</h1>
<!-- #ICE REPEAT INCLUDE=`plays[play_TxnCndCmt_h.html]` -->
<!-- #ICE REPEAT
DATABASE = `icetutor`
SQL=`select distinct type from plays`
TRANSACTION=`t_type`
CURSOR=`c_type`
ROWS=`10`
TYPE=`UNFORMATTED`
HTML=`<p><!--
#ICE SWITCH=``:type``
CASE ``comedy``=
``<a href=/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=:type>
<img src="/ice-bin/oiice.dll/playgroup/plays[comedy.gif]" alt="Laugh at the Comedy plays">
</a>``
CASE ``tragedy``=
``<a href=/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=:type>
<img src="/ice-bin/oiice.dll/playgroup/plays[tragedy.gif]" alt="Be moved by the tragedy plays">
</a>``
CASE ``history``=
``<a href=/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=:type>
<img src="/ice-bin/oiice.dll/playgroup/plays[history.gif]" alt="Look back at the history plays">
</a>``
-->`
-->
<p>
<!-- #ICE COMMIT=`t_type` -->
<!-- #ICE DECLARE=`session.e_return=play_typeGSLink.html` -->
<!-- #ICE REPEAT INCLUDE=`plays[play_SessionControl_h.html]` -->
</body>
</html>
The first thing we notice is that the select statement is simple once again. Second, there is a large block of HTML code appearing at the end of the entire statement, following the HTML keyword. This implements a switch taking the value of the type column as its variable. There are three recognised play types in this application: comedy, tragedy and history. There is a CASE for each. Note: we have not made use of the DEFAULT case in this example. For each CASE we specify the same target document, pass in the variable type and set individual picture files and alternative text for them. The SWITCH statement appears in the HTML statement and this requires us to
CASE ``comedy``=
``<a href=/ice-bin/oiice.dll/playgroup/plays[play_typeLinkSubSet.html]?type=:type>
<img src="/ice-bin/oiice.dll/playgroup/plays[comedy.gif]" alt="Laugh at the Comedy plays">
</a>``
Each CASE of the SWITCH statement is similar. Here we examine the comedy case. First, we build a hyperlink to the display document, play_typeLinkSubSet.html and pass in the variable type with the value :type, which comes from the column of that name. We then provide an image for this link and this is no longer constrained to be the value of the column; neither is the alternative text.
We have now covered most of the Web Deployment Options macro keywords and features. We would like to build an electronic commerce application next.