Objects>Persistent Variables (Session Variables)
Introduction Installation Beginning Admin Quick Ref FTP Server SMTP Server Database Security
Statements Objects String Parsing Events Queues Samples Special names Error Handling Accessories   Back
Caravan Business Server>Help>Objects>Persistent Variables (Session Variables)
Syntax   
   <caravan>
            To make a variable persistent :
                  variable object name(persistent)="true"  
            To delete a persistent variable
                  variable object name(persistent)="null"
   </caravan>
  
Text
You can use the Persistent object to store information needed for a particular user-session (similar to session variables).

Variables stored in the Persistent object are not discarded when the user goes between pages. Instead, these variables persist for the entire user-session.

Note: The behavior of persistent variables is the same as temporary variables.
Sample
Example

<caravan>
if temp(cnt)
       "I was here  ";temp(cnt);" times"
        temp(cnt)+="1"
else      
       "I am here for the first time"
        var temp
        temp(cnt)="1"
        temp(persistent)="true"
endif  
</caravan>
In the above example, when the page containing the above code is accessed for the first time, a variable object temp with variable cnt is initialized to value 1 and made persistent. If the page is accessed again, then, the number of times the page was accessed is displayed.

To remove the persistent varible:
<caravan>
temp(persistent)="null"
</caravan>
Home       Back