netFORUM Variables
A netFORUM Variable, also known as a Parsed Value, is an element whose value is substituted at runtime, such as {cst_key}, {CurrentUser}, {DefaultCountryGuid}, etc.
Parsed Values
Many areas of the netFORUM Toolkit and CMS support parsed values. In netFORUM, a parsed value is always enclosed with braces. Parsed Values may refer to certain system variables such as {CurrentDate}, or they may refer to Object Controls such as {org_cst_key}, or to System Options such as {ReportLoginUserName}.
When a Parsed Value is located in metadata, such as in a Child Form SQL expression or in a Form Control's default value, netFORUM will dynamically substitute the value in memory at runtime.
Parsed values are case sensitive because netFORUM runs in a case sensitive programming language (C#). Technically, the values are parsed in the Avectra.netForum.Data.DataUtils.ParseValues method (which has several overloads), and then to Avectra.netForum.Data.FacadeClass.GetValue.
Where Do Parsed Values Apply?
Many areas of the netFORUM Toolkit and CMS support parsed values. There are too many to mention, but basically the key areas include:
- Child Form SQL
- Web Page Detail content definition
- Web Site Default pane.
- Visibility SQL
- Correspondence Template in the message body (html and plain text)
What Can Be Parsed
Generally, these are the elements that can be parsed in certain metadata:
Variables
- Any control that belongs to the Object that is active in the item being parsed. Example, on an eWeb Page Detail, any controls in the content definition can be parsed if they are "understood" by the Object of the Form or Wizard of that Page Detail. Example, if you are on a Page Detail based on a Form based on the Individual object than you can parse {ind_first_name}.
- System Options - Any System Option value can be parsed.
- User Options - Any user option can be parsed.
- Non-Standard Parsed Values - see below.
Request Object Variables
You can parse anything from the Request object collection. This includes Request.Form, Request.QueryString, Request.ServerVariables, Request.Cookies. The syntax for this is {request:variable_name} for example {request:LOCAL_ADDR}. Technically, you may omit the request: prefix but we recommend keeping it to inform yourself (and others) that you are looking for something in the Request object and not something in a Facade Object, for example. We also recommend using the request: hint as it will speed processing timeāthe netFORUM engine will not have to guess what this variable is, it will just go directly to the Request object and get the variable.
- Form inputs -- anything from Request.Form
- Cookie -- on eWeb, you can parse the value of a cookie from Request.Cookie.
- Querystring - on eWeb, you can parsed the value of any querystring parameters. Note that this can get tricky if the querystring parameter name is the same as a control in the Object active on that page. If you run into conflicts or ambiguity, you can rename the querystring parameter. Example, instead of
DynamicPage.aspx?WebCode=XYZ&ind_cst_key=abc-123
you might want to craft the URL to be instead:
DynamicPage.aspx?WebCode=XYZ&indcstkey=abc-123
In the latter example, you might have some List SQL that looks like this:
{BeginListSQL}SELECT a, b, c FROM dbo.co_customerWHERE cst_key ={indcstkey}{EndListSQL}
You can also request cookies or form values by putting "request:" in front of what you're looking for, example: {request:cookiename}.
- Server Variables - In eWeb you can parse anything in the Request.ServerVariables collection such as IP address using {request:REMOTE_ADDR}, for example. For list of all server variables, see Server Variables.
Application Object Variables
- Application Variables - Anything in the application collection, use syntax {application:ApplicationVariableName}.
Session Object Variables
- Session Variables - anything in the collection of Session Variables if you pass in "session:" in front of the session variable you want. Example, if the session variable is called "LoggedIn", then if you look for {session:LoggedIn} then you will get the value of that session variable.
Note: A List Control must have an associated Form in order to reference a Session Variable.
Parsing Conditional Logic
Parsed values can conditionally display information based on a test case using the following syntax:
{? << condition to evaluate true/false>> ? <<output if true>> ? <<output if false>> }
For example:
{?Product=="CPU"?You've bought a CPU?Not a CPU}
and:
{?pin_cc_auth==""?Invoice Date: {inv_add_date}?Transaction Date: {pin_add_date}}
In this last example, if the Parsed Value of pin_cc_auth is empty, then the contents between the 2nd and 3rd question mark character will be output; otherwise the contents between the 3rd question mark character and the last brace will be output.
Non-Standard Parsed Values
These are various configuration settings that can be parsed. Here is a list of some commonly used non-standard Parsed Values:
Value | Usage |
---|---|
~ in iWeb | Parses the value, but will not include single quotes for fields that are strings. This may be useful when you don't need single quotes to enclose the value. |
~ in eWeb | Replaces the ~ character with the application path. |
* | Parses the original value, for example: AND ind_dob = {*ind_dob}. Useful for contrasting the original value of a control versus its current value that the user might have altered. See Avectra.netForum.Data.FacadeClass.GetOriginalValue for more, as it is this method that evaluates this type of parsed value. |
# | Parses multiple values, separated by single quotes. For example, a,b,c,d will, when parsed, convert to 'a','b','c','d'. This can be useful for writing a SQL IN clause, for example, AND cst_key IN {#cst_key_list}. |
: | Indicates a mask should be applied after the value has been parsed. This can be a regular expression or a value such as used for input masks on columns - see Column. This should be added after the name of the value to parse, e.g. {ind_dob:99/99/9999} |
{application:variable_name} | See the Application Object Variables section above. |
{ApplicationPath} | Web application path |
{child_form_text^key_of_child_form} | Run the SQL of a child form and display the results as text. Note: You may need to remove white space if using child form SQL to generate a Dynamic Variable for use as default value or report parameter. Add REGEX expression :\W*(.+)\W*~$1 after the child form GUID value, and before the closing bracket (<ttb>}</ttb>). |
{child_form_html^key_of_child_form} | Run the SQL of a child form and display the results within an HTML table. |
{CustomerKey} | Customer Key of logged in eWeb Login user; for eWeb purposes |
{currentkey} | returns the value of the primary key, via the FacadeClass, of the current object. |
{CurrentUserEmail} | Email of iWeb user. |
{CurrentUserFriendlyName} | Friendly Name of iWeb user. |
{CurrentUserGroups} | Security groups of logged in iWeb users, separated by semicolons, e.g. netForumUser;netForumAdmin;netForumEvents |
{CurrentUserKey} | User Key of logged in iWeb user based on fw_user.usr_key. |
{CurrentUserName} | Login name of iWeb user. |
{CurrentDate} | The system current date from the web server's clock. Will appear in MM/DD/YYYY format, e.g. 07/13/2012. |
{CurrentDateTimeMinusOneMonth} | The date one month ago from the current date, plus one day. For example, if today is 11/22/2011, then this parsed value will return 10/23/2011. This is intended to be used for general cases where you're looking for any date within the past month. Will appear in MM/DD/YYYY format, e.g. 07/13/2012 First available in 2011.05. |
{CurrentMonthStart} | A date time for the first day of the current month/year |
{CurrentMonthEnd} | A date time for the last day of the current month/year |
{currentdatetime} | Returns DateTime.Now.ToString() from web server clock. |
{currenterrormessage} | Contents of Config.LastError.Message |
{currenterrornumber} | Contents of Config.LastError.Number.ToString() |
{CustomerKeyPricingControl} | If eWeb user not logged in, returns 00000000-0000-0000-0000-000000000000 (web user), else returns {CustomerKey} |
{eWeb} | If the application is in eWeb, will return 1 else 0 |
{eWebCurrentUserName} | The username of the user logged into eWeb |
{ewebsitecode} | Returns the eWeb web site code in session, if any. First available in 2013.01.02. |
{HttpServerName} | Server name |
{HttpServerPath} | Qualified http server path, e.g.: http://www.mysite.com/iweb/ |
{isoriginalrow} | returns 1 if true, else 0 |
{iWeb} | If the application is in iWeb, will return 1 else 0 |
{ListWhere} | the current WHERE clause of a List Results, Find or Query |
{ObjectName} | returns name of Object of Page |
{ObjectDescription} | returns description of Object of Page |
{orgcustomerkey} | eWeb Organization Customer Key |
{request:variable_name} | See the Request Object Variables section above. |
{session:variable_name} | See the Session Object Variables section above. |
{sessionid} | returns Config.Session.SessionID.ToString() |
{ShoppingCartCustomerKey} | returns the Customer Key of the shopping cart customer. In eWeb, this is typically the Customer Key of the logged in user unless the user has chosen to shop on behalf of one of the organization(s) they are authorized to shop on behalf of. |
{superuser} | returns true if logged in User is super user |
{userentitydescription} | returns User's Entity description |
{userentitykey} | returns User's Entity key |
{webcode} | Passes the md_web_content.wbc_code of the Web Page you are viewing. |