ServerStorage: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Line 13: Line 13:
{| class="wikitable"
{| class="wikitable"
|-
|-
| clear() || The name of the form to go to if this button is clicked.
| clear() || Clear all entries in the current namespace.
|-
|-
| getItem(key) || round or square. jQuery Mobile only.
| deleteItem(''key'') || Deletes item ''key''.
|-
|-
| key(n) || If you have a group of buttons, set this to Start Vertical, Start Horizontal, Start Vertical Mini or start Horizontal Mini. jQuery Mobile only.
| getItem(''key'') || Get the item which is saved under ''key''. String.
|-
|-
| length || If you have a group of buttons, set this to Yes on the last one. jQuery Mobile only.
| key(''n'') || Get the ''n''th item in the namespace.
|-
|-
| namespace || Set to false for no icon. You have a choice of 18 standard icons otherwise. jQuery Mobile only.
| length || The number of items in the current namespace.
|-
|-
| setItem(key, value) || Position of the icon. Can be none, left, right, top, bottom or notext. jQuery Mobile only.
| namespace || The group used by all serverStorage methods. Defaults to app ID.
|-
| setItem(''key'', ''value'') || Sets item ''key'' to ''value''. Creates item if it does not exist.
|}
|}



Revision as of 16:24, 6 November 2014

serverStorage(string | variable)

Description

serverStorage allows you to save string data on the server so it is available next time you run the program. An entry can be created by assigning to serverStorage.setItem(variableName, value), where variableName is chosen by you. Data is retrieved the same way.

serverStorage is shared among all apps deployed from the same web server. This can be useful if you have a family of apps which need to share data.

This feature is currently experimental. It only works on apps deployed to nsbapp.com. It will not work locally or on your server at this time. Since the data is on the nsbapp.com test server, do not assume that data you save will be permanently available.

Properties and Methods

clear() Clear all entries in the current namespace.
deleteItem(key) Deletes item key.
getItem(key) Get the item which is saved under key. String.
key(n) Get the nth item in the namespace.
length The number of items in the current namespace.
namespace The group used by all serverStorage methods. Defaults to app ID.
setItem(key, value) Sets item key to value. Creates item if it does not exist.

Example

Rem serverStorage Save Example
serverStorage.data = "This is Data."
(run and exit program)
Rem serverStorage Retrieve Example
Print serverStorage.data
 
Rem Test if Private Browsing is turned on
Try
  serverStorage.private = "test"
Catch err
   MsgBox "Please turn Private Browsing off"    
End Try

Rem Some additional samples:
serverStorage.setItem("key", value) 'creates serverStorage.key with defined value
serverStorage["key"] = value 'alternative method for above
serverStorage.getItem("key") 'calls serverStorage.key...useful to check if it exists 
serverStorage.removeItem("key") 'deletes serverStorage.key
delete serverStorage.key 'alternative method for above
delete serverStorage["key"] 'another alternative method for above
serverStorage.clear() 'nuclear deletion of all serverStorage variables in the domain. Use with care.
serverStorage[DBRecords.rows.item(0)["ModsType"]] = "alpha"

Output

This is Data.

Related Items

LocalStorage, SessionStorage, SQL