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.

<html> <head></head>
<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"))
    <csp:loop counter="num" from=1 to=#( ord.Items.Count() )#>
        <script language="cache" runat="server">
            Set itm = ord.Items.GetAt(num)
        For the #($ZT(itm.Show.StartTime,4))#
        showing of #(itm.Show.Film.Title)#
        at #(itm.Show.Theater.TheaterName)#
</body> </html>
FeedbackOpens in a new tab