Dynamic Variable

To create a Dynamic Variable for use where Parsed Values are evaluated, you can use Child Form SQL to calculate the value of the variable, and use the {child_form_text^key_of_child_form:\W*(.+)\W*~$1} method to use this dynamic variable within NetForum. When this variable is parsed by netFORUM, what will be returned is the result of the SQL command.

This technique can be used anywhere in the Toolkit or CMS where values are parsed.

In order for a single value to be evaluated, the child form SQL should be written to ensure only one value is returned (i.e. use Select TOP 1... ) and the column that is to be returned needs to have a blank name alias (e.g. arp_code = [ ] note: there is a space between the brackets).

The remainder of this page shows you how to use this technique to default the value of a Search Control on a Find page.

Steps

Example: To force a search column drop down value default to the current accounting period.

Step 1: Create child form to generate the desired value


Step 2: Reference Child Form using Parsed Value {child_form_text^key_of_child_form:\W*(.+)\W*~$1} in search field default value.


Result: Search Column now defaults to the current period based on the current system date.


Note: This tip doesn’t work for datetextbox controls as the regular expression {child_form_text^key_of_child_form:\W*(.+)\W*~$1} specially the \W* removes all the characters except [a-zA-Z0-9_] this will render date value without the backward slashes like 03182010 and that is not the desired result for date field. This can be improved by debugging baseline and adding the right regular expression that can accommodate the date value.

See Also

Dynamic_Subject_Lines - example of using Dynamic Variables in a Correspondence Template