In-Page Queries

Percent entities are used to extract values of variables and data object members in webapps. They take the form of a percent sign, a lower case letter to indicate the source class, a colon, the source name or address, a display format argument where applicable and a terminating semi-colon - e.g. &percent;e:firstname; or &percent;x:today(FMT_DT_INET); Percent entities within page HTML are translated to the text value. Percent entities elsewhere in the configs, such as within a form handler, are translated to the value in internal form, which includes the data type.

The available source classes are as follows:-

X-Class System Variables

  %x:today; Current date.
  %x:time; Current time.
  %x:datetime; Current date and time.
  %x:usecs; Current microsecond count (part of time function). Commonly used as a 6-digit random number generator
  %x:referer; Referer to the current page.
  %x:cookie; Current cookie (only if a session exists)
  %x:username; Username of the current user (if applicable)

E-Class Event Variables Variables associated with the current HTTP event. In the case of a form submission, all fields in the form can be addressed as %e:fieldname;

S-Class Session Variables Variables associated with a user session. These are explicitly set within formhandlers and will persist for the duration of the session, unless explicitly deleted beforehand.

U-Class User Variables Variables associated with a login, i.e. the members of the applicable user class. E.g. u:username;

V-Class Visitor Variables Members of the current data object (if loaded), addressed as %v:memberName; OR members of a specific data object, which must be addressed as %v:reposName.objectId.memberName;

Things to Note

Pages containing percent entities are active and so must be generated each time they are requested. However in the general case, percent entities are fast because they are lookups on memory resident data. The speed is such that the overhead of page generation can be neglected. It is practical for output HTML to contain hundreds of retrieved values without a noticable hit on response times.

Note the convention of using upper case letters when referring to percent entity classes in documentation, but lower case letters in the entities themselves. The first part of the percent entitiy sequence (upto and including the colon), is reserved for percent entities. For example the sequence '%x:' is a config error, except as a part of a complete and meaningful percent entity. If such a sequence is intended in the text, you must use the &percent; HTML entity.

The webapp config validation process rejects percent entities that refer to variables or data object members, which either do not exist or would be out of scope within the resource in which they appear. Note that pages used to display a data object have extended URLs of the form /pagename.classname.objectid, instead of just /pagename. It is by this means that the item referred to by a percent entity falls within the page.

Percent entities produce no HTML output if the referred variable has no value. This is not an error condition.