addedValues Plugin

...Powerful Free! Database Expansion for Manila
logoBottle:

(1 or more words)


Get tropes here!
Click to see internals
Report bug


AECC

sitepic_aeccSite.gif:
Viewable with Any Browser

Members
Join Now
Login

Value Is

Value is Stored.

Normally variables are stored inside objects in your website, such as messages , member records, gems, etc. They are entered through the medium of forms, or perhaps imported, but the value can be located inside the websites internal tables. These is called Stored variables and they are the most common default case. Variables which use other methods of returning a value are labelled collectively, Virtual Variables. Virtual variables are shown in smallCaps in the menu on the variables main page, and in most places where lists of variables are presented.

Value is Computed.

Another type of variable whose value is calculated every time it is accessed, is also available. A value of 'Value Is' of Computed means that it an expression, supplied by the Managing Editor is evaluated every access. The expression may involve any variable normally accessible in the current context except computed variables, macros and the same builtins available in reports. If a variable is assigned Computed in the Value Is row , the expression which defines it must be edited by clicking the Edit Virtual button. If there is more than candidate visible, you indicate which variable to edit by checking a radio button. Changing the expression for a Computed Variable, causes addedValues to recreate the tailored Usertalk scripts that it uses to work with the variable.

Value is External Virtual Script.

One further way a create values for a variable is to use an external variable script ; which must be configured and installed in the administration website by a system administrator, using the addedValues Controlpanel Interface. The names of any eligible external virtual scripts are shown in the dropdown menu for the Value Is attribute. When these scripts are called they passed information which describes the website, variable and the current context (message, gems etc.). There is no restriction on what that script can do before returning a value, though it is wise to remember that every access to the variable calls this script. The value returned must agree with the Usertalk type that the external Virtual script was declared to have, if it does not unexpected and unwelcome results will likely occur.

Usage of Virtual Variables.

Neither type of virtual variable can be written to; any attempt to do so will cause an error. For this reason they cannot appear as fields in forms. Nor can they be indexed, so they cannot be used in query expressions. They can be used everywhere else, such as reports, updaters triggers etc. They may also be used as the sortedBy variable in queries and forms and this is the primary reason to implement them. For example, the messages builtins images.width and images.height are available and can be used as numbers in reports, but previously there was no way to sort the hit list of a query by the size (number of pixels) of an image. Now by defining a variable imageSize as a virtual variable whose value is image.height * image.width, you can order in this way. There are many similar potential uses for virtual variables.