BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Data Management

Documentation > Handbook > Variables > Data Management

Even without a database you can store data values invisibly on BoltWire pages and retrieve them on other pages. This is particularly useful for storing user input, to update interconnected pages, to populate pages with pre-stored values, or for dynamically generating content -- even mathematical formulas. It' called page data variables or data fields. This concept makes BoltWire extremely useful.

The name of a page data variable must be a single word, consisting of letters, numbers, hyphens or underscores.

A page data variable can contain from single letters or numbers to links, whole paragraphs and even math equations or markup.

Setting up


To set up and populate a data field you can use a form like this:

<code> [form] [session savedata mydata] [form] </code>

Line 1 introduces the form. Line 2 provides a text field with "mydata" as the name of the data field and "{:mydata}"] to show the current value of the data field. It is initially empty. Line 3 provides a submit button. Line 4 tells BoltWire to store the value of mydata on the current page. Line 5 marks the end of the form, do not forget this.

To store the data values on a different page add a line like the following somewhere in the form before the savedata line:

<code> [session target other.page] </code>

To have more than one data field on a page you simply add additional input lines, e.g. [text mydata2 "{:mydata2}"]. You also have to add the new fields to Line 4, e.g. [session savedata mydata,mydata2]

Retrieving the data


Data fields are stored invisibly on the page. You can see them if you open the page in a text editor. Just look at the bottom of the page for the ~data~ marker. These data values are NOT visible however, when editing a page from within BoltWire.

You can get a list of the data field on a given page with {data} or {:data}. In the example above this would retrieve "mydata", or perhaps "mydata,mydata2".

To retrieve the actual data field values, you have to know the field name and use {:field}, e.g. {:mydata}.

To fetch the data field names or their contents from another page you simply indicate the page name where the data is stored like {test.main:data} or {test.main:mydata}. These variable markups can be placed anywhere on a page.

Formatting the data


You can use standard markup to format your data values. Let's say you have a data field "name: bob" on page test.main. To display the data value "bob" on another page in italics, just put //{test.main:name}// somewhere on the page.

You can populate whole pages by retrieving data values from other pages and formatting them in a header or footer page. You can also create a simple action to make it possible to update the data values in this page using a form like the one indicated above.

There are of course, many more things you can do with BoltWire and data, but hopefully this is enough to get you started!

These page data variables are one type of BoltWire's variables?.

Copyright © 2013, all rights reserved.