Search these areas:
Support Forums
Product Info

DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
View Basics
Converting HTML Pages to Views
Incorporating Script in a View
-HotRAD Substitution Syntax
-Calling Functions
-The Record Object
View Property Reference
View XML Reference
URL Parameters Reference
SQL Expression Reference
Data Analysis
Object Model
Full-Text Search
Domain and Email Hosting
HotBlock Modules
Account Management
New Responsive UI Module

DataWeb Help
Support Forums
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

DataWeb Substitution Syntax
Simple Pound Sign Delimiters: # #

An easy way to lend your application custom behavior is to use substitution syntax in conjunction with the predefined objects provided by DataWeb JavaScript, such as the User object, which provides information about the current user of the web application. For example, if you wish to provide a custom greeting for visitors to your web, place the following code within the source code of your view.

     Hello  Welcome to my web application.
     Hello john.  Welcome to my web application.

Inside of view files, code that appears within pound delimiters (# #) signals a script variable, expression, function or statement so that outputs the current value of

Similarly, you can output the current date and time by using the prototype Date object, as in the following example.

     The current date and time are #Date()#.

You can use a similar technique to dynamically assign values to attributes within your view file. For example, to display a HTML block only to "John", you can use pound delimiters within the ws:htmlblock tag as in the follow example.

     <ws:htmlblock visible="'john'#">

If the expression within the pound delimiters resolves to TRUE, then the HTML block will be displayed, if it resolves to FALSE, it will not displayed.

HTML Comment Delimiters: <!--# #-->

Oftentimes you will want to perform some operation in script and then output the result at some point within your view. In these cases, execute the operation within HTML comment delimiters (<!--# #-->) and then use pound delimiters (# #) to output the result of the operation later in the view.

     var d = Date();
     d = d.getYear();
     d = d - 1776;
     It has been #d# years since 1776.


     It has been 225 years since 1776.

Note that HTML comment delimiters are used to prevent the final expression, d = d - 1776;, from being output to the view. If pound sign delimiters alone had been used, the value of d would have been output to the view twice, once by the expression d = d - 1776; and again by #d#.

Placement of script in a view

The placement of a script within a .view file depends on the sort of data that the script is designed to access.

If your script includes a reference to the record object, then place your script after the the <ws:dataregion> tag, since the values of the record object are defined only within or after the dataregion.

If you want your script to run before the body of the view is rendered, such as when your script contains conditional redirects to other pages, place your delimited script within the head tags of your view.



    var strFile = request.getParameter("TopicID");
        response.throwRedirect("http://" + + "." + web.domain
                + "/default.view?TopicId=37");    

Otherwise, place your script after the opening body tag and before the opening ws:dataregion tag.

var szgh = request.getParameter("_mode", ""); 

References to the record object should appear after the ws:dataregion tag, and that data region must contain a ws:field tag for the referenced field.
       <ws:field name="Email">


To embed DataWeb Script in client-side script that's running in a view, put the script in substitution syntax within a CData tag, as follows:

Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us