Skip to main content

Retrieving a TicketItem

Now, we can retrieve each TicketItem object, using the GetAt method. Once we have an object, we display the start time, film title, and theater name.

Notice that we use the ObjectScript function $ZTIME, abbreviated by $ZT, to format the start time for display. For more on $ZTIME and other ObjectScript functions read the $ZTIME entry in the Caché ObjectScript Reference.

—Order.csp—
Order.csp
<html> <head></head>
<body>
<csp:class super="%CSP.Page,Cinema.Utils">
<csp:if condition='$D(%session.Data("Order"))'>
    <img src="YourTicketOrder.gif"><br>
    <script language="cache" runat="server">
        // Open Order object for display
        Set ord = ##class(Cinema.TicketOrder).%OpenId(%session.Data("Order"))
    </script>
    <csp:loop counter="num" from=1 to=#( ord.Items.Count() )#>
        <script language="cache" runat="server">
            Set itm = ord.Items.GetAt(num)
        </script>
        For the #($ZT(itm.Show.StartTime,4))#
        showing of #(itm.Show.Film.Title)#
        at #(itm.Show.Theater.TheaterName)#
        <br><br>
    </csp:loop>
</csp:if>
</body> </html>
FeedbackOpens in a new tab