Home
Main Introduction Features Constants Statements Database Objects Parser Serial-Communication Samples Misc
Constants>Persistent Variables (Session Variables)
Caravan Business Server>Help>Constants>Persistent Variables (Session Variables)
Syntax Var variable object name
To make a variable persistent
variable object name(persistent)="true"
To delete a persistent variable
variable object name(persistent)="null"
Text You can use the Persistent variable to store information needed for a particular user-session.Values stored in the Persistent variables are not discarded when the user jumps between pages in the application, instead, these values persist for the entire user-session.One common use for the Persistent variable is to store user preferences. For example, if a user indicates that they prefer not to view graphics, you could store that information in a Persistent object.
Note: The behavior of persistent variables is the same as temporary variables.
Sample <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>

When the page containing the above code is accessed for the first time, in the above example, 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.
Back