
WAFFL (Web and Flo
Functional Language)
OVERVIEW
§
Kontinuum has a parser that evaluates WAFFL (Web and Flo
Functional Language) code
§
It is used to evaluate all the different business rules and
logic in the system whether they relate to questions, subforms or processes
§
There are two parts to the WAFFL Language:
o
Functions
o
Parameters
FUNCTIONS
§
Functions return 3 types of results:
o
A text string
o
A series of results
o
A boolean value
§
The series of results have the following two formats:
§
[value1][value2][value3] or [value1,,display1][value2,,display2][value3,,display3]
this format is called Web and Flo series formats
§
In the format style [value1][value2][value3] the
value to be stored in the database is the same as the value to be shown to the
user
§
In the second format the value displayed to the user and value
stored in the database is different
§
The series of results format is most generally used for
either the selection statements for SideBars, Check
Boxes, List Boxes and Radio Buttons or to retrieve values that will later be
used in aggregate functions
§
The results of functions can be used as parameters inside
other functions
§
The syntax for a Function is: FunctionName{parameter1,parameter2,....}
§
Note: The names of the functions are not case sensitive
NON-AGGREGATE FUNCTIONS
- These functions do not accept
arrays of values as any of their parameters.
Definition of Sqlset
- The syntax for the function is:
- sqlset{SQL statement}
- Where SQL statement is a proper
SQL statement to be executed
- The function returns a series
of results in the Web and Flo series format
- Note: This series may only have
one item so it is possible to use the results of the sqlset
function as a parameter to a non-Aggregate Function
- It is also possible to use the results
as a parameter for the aggregate functions
- For example: sqlset{select Name from sysdatabases} would return the string similar
to: [help1v1][master][northwind][tempdb][WebandFlo1v1] depending on the
databases on your SQL server
Definition of Sqlval
- The syntax for the function is:
- sqlval{SQL statement}
- Where SQL statement is a proper
SQL statement to be executed
- The function returns a text
string that is the result of the SQL statement
Definition
of eval
- This returns the result after evaluating
a VB Script statement
- The syntax for the function is:
- eval{VB Script statement}
- For example: eval{“a” & mid(“1234”,2,2)}
evaluates to the string: a23
Definition
of isempty
- The syntax for the function is:
- Isempty{String} and it returns a
Boolean
- If the value of the 'string' is
empty or a blank string then it returns true otherwise it returns false
- For example: isemtpy{ } returns the
string true
Definition
of If Function
§
The syntax for the function is:
§
if{comparison,if return,else return} and it returns a string or a series of
values in Web and Flo series format, or a Boolean
§
If the comparison is 1 or true, it returns the string in the
‘if return parameter’, otherwise if the if condition evaluates to 0 or false,
it returns the string specified in the ‘else return’ if it is not specified then
it returns an empty string
§
For example if{1,bob,bill} returns bob
while if{false,bob,bill} returns bill
AGGREGATE FUNCTION
- The Aggregate function works
not on one element of data but an array of data
- This can be a series of values
that are returned from a form, or results from a recordset,
or a series of hard coded values.
- The syntax for the function is:
- Agg{Aggregate Function Type, [val1][val2][val3]...}
- It works by putting all the
values into a temporary table and then performs an SQL aggregate function
on these values
- If all the values come from the
database it is recommended that you perform the aggregation in the sqlset select statement
Definition of Sum
- The Sum function returns the
sum of a series of values that are in Web and Flo series format
- The syntax for the function is:
- For example the Agg{Sum,[1][2][3]} returns
string string 6
Definition
of Average
- The Average function returns
the sum of a series of values that are in Web and Flo series format
Definition of Min
- The Min function returns the
smallest or (if a string, the first alphabetically) of a series of values
which are in Web and Flo series format
Definition of Max
- The Max function returns the
largest or (if a string the last alphabetically) of a series of values
which are in Web and Flo series format
Definition of Count
- The Count function returns the
number of items that are in a series of values that are in Web and Flo
series format
Definition
of Product
- The Product function returns
the Product of a series of values that are in Web and Flo series format.
Definition
of Stddev
- The Stddev
function returns the Standard Deviation of a series of values that are in
Web and Flo series format
- See MSSQL help for more details
Definition
of Var
- The Var
function returns the Variance of a series of values that are in Web and
Flo series format
- See MSSQL help for more details
PARAMETERS
- WAFFL allows designers to get
information from forms, the database, and the session to use as parameters
in WAFFL statement
Evaluate
Form Information
- The syntax for the parameter is
- @@Form.[subformName][.rownumber||.RowStart:RowEnd]QuestionName
- If the Subform name is not
given it defaults to the name of the Subform that is the parent of the
question for the rule being evaluated
- If the row number or a rowstart
and row end is not given it defaults to the current row of the question
whose rule this is
- The RowNumber
can either be a single value or a range of values with a Row Start and a
Row End
- If it is a range of values then
the function will not return one single value but a series of values in
Web and Flo series format
- For example: If the following was
a Subform called mySubform
|
MyDay
|
AmountSold
|
GST
|
|
Monday
|
12.00
|
1.20
|
|
Tuesday
|
3.50
|
.35
|
|
Wednesday
|
10.00
|
1.00
|
- then @@Form.mySubForm.1.AmountSold
would evaluate to 12.00
- @@Form.mySubForm.1:2.AmountSold would evaluate to 15.50
- @@Form.mySubForm.all.AmountSold would evaluate to 25.50
- @@Form.mySubForm.3.GST would evaluate to 1.00
- Also if evaluating the default
rule for the GST column in the Wednesday row then @@Form.AmountSold would evaluate to 10.00
- Note: There is no need to supply
a Subform name or a row because they are already being retrieved from the
current question that has a rule being evaluated
Evaluate
User Information
The
syntax for the parameter is:
- @@User.[key]
- The key can have any string
value that is in the User_Item_Types table
- It then scans this table for
the associated key for this particular user
- If no key can be found it will
return empty
- If the key is Full Name
it returns the current users full name as specified in the Users Table
- For example: If I have entered
the current users email address as george@webandflo.com then @@User.Email evaluates to george@webandflo.com
- Also, if my user name is SA and
my Full Name is George Smith then @@User.UserName
evaluates to SA
- In addition my @@User.FullName evalutes
to the string George Smith
Evaluate
Database Information
- The syntax for the parameter
is:
- @@DB[SubFormName.][RowNumber.||RowStart:RowEnd.]question
- If the name of the process is
not supplied then Kontinuum retrieves the first value it can from the
specified table regardless of if the Subform is used at many locations in
the workflow
- If the Subform is not supplied
then Kontinuum gets the value for the current Subform name if one is
supplied
- Either a specific row number
can be supplied or a range of row numbers
- If a range of row numbers is
supplied then a colon separates the start row and the second row
- The name of the question/column
is required
- Note: For check boxes, the
column name must be supplied not the name of the question
- The name of the column is QuestionName_Number of the checkbox for which you wish
to retrieve an answer
- For example if the following
data was in the table mySubForm
|
MyStore
|
RowNumber
|
MyDay
|
AmountSold
|
GST
|
|
Melbourne
|
1
|
Monday
|
12.00
|
1.20
|
|
Melbourne
|
2
|
Tuesday
|
3.50
|
.35
|
|
Melbourne
|
3
|
Wednesday
|
10.00
|
1.00
|
|
Sydney
|
1
|
Monday
|
11.00
|
1.10
|
|
Sydney
|
2
|
Tuesday
|
2.50
|
.25
|
|
Sydney
|
3
|
Wednesday
|
9.00
|
.90
|
- and the object that is
currently selected is the Melbourne Store then:
- @@DB.mySubForm.1.AmountSold would evaluate to 12.00
- @@DB.mySubForm.1:2.AmountSold would evaluate to 15.50
- @@DB.mySubForm.all.AmountSold would evaluate to 25.50
- @@DB.mySubForm.3.GST would evaluate to 1.00
- Also if evaluating the default
rule for the GST column in the Wednesday row then @@ DB.AmountSold would evaluate to 10.00
- Note: There is no need to
supply a Subform name or row because they are already being retrieved from
the current question being evaluated
- If we now change the object we
have select to the Sydney
store then:
- @@DB.mySubForm.1.AmountSold would evaluate to 11.00
Evaluate
Session Information
- The syntax for the parameter
is:
- @@Session.[key]
- The most important information
in the session is the values for all the Primary key items
- If you have a workflow where
the primary key is a question called My_ID and
there is a need to reference that information from a form that is not the
primary form do the following:
- Enter @@Session.My_ID where there is a requirement for
the current value of my ID
Evaluate
All Types
- The syntax for the parameter
is:
- @@All.QuestionName
- This will try to find information
first from the User Information,
- If no corresponding information
is found it will then try to find the information from the session
information
- If still no data is found it
will search through the form information and finally the database information