Operators And functions
iKen Studio Beta Help: Operators and Functions

The space is not considered as token separator. However, more than once space/new line etc. is automatically trimmed to single space. Do not include unnecessary spaces. The expressions are evaluated from right to left.

Functions

General Relational and logical operators Conversion Text SQL Lookup table
List Menu Range Math Matrix Session
Trend Graph Variable Date Report CBR
Other functions (GOTO, Conditional etc.)


Data Types

Literals: any text other than variable, operator or function is treated as literal.  However, explicit text can be included in quotes in case it uses reserved words.

Data Type

Description

Examples/Literals

Number Hold the (32 bit) integer data.

455 2334
Number without decimal point is treated as number 

Real Hold the double data 23.45, 34.5677
Boolean Holds Boolean true or false X := true 
Text Holds text data. When a menu is linked the variable takes values from the menu options/codes. ABCD
"*+/-"  text containing keywords should be entered in quotes
Matrix Holds the matrix.

M={10 2 3,5 6 7}; //space (column separator) or comma (row separator) as a separator. Any literal starting with { is treated as matrix data type. However, CONVERT/READ_MATRIX function can be used to convert text into Matrix.

Trend Holds the trend data. Array of numeric values (real).

Sales=|100 120 125 129 140|, space as a separator. Any literal starting with | treated as trend data type. However if trend contains negative values it is recommended to use trend inside quotes like "|-1 2 3|"

Compound (List) Holds list (array) of numbers, real, text or even mix of them.

Customer.Assets = [Car, Two Wheeler, Color TV, Washing Machine].  Comma ',' is used as a separator. Any literal starting with [ would be treated as compound list. In case any element of list contains , itself then separator | can be used. e.g. |a,b|c,d].

Date Holds the date. Any literal starting with _ is treated as date type for example _21.Jan.2005. The syntax is _DDMMMYYYY.
URL This is same as Text data type except the value would be displayed as URL link when shown in the report. -
Document This holds any type of document including images Depending upon type of document like XML, etc. different treatment is given.

Operators and functions

Syntax Description Example

+,-,/,*,^ append

Expression1 [+|-|*+|/|^] Expression2
Expression1 APPEND Expression2
+ Operators allow use of text variables. If one of the variable is text the concatenation operation is performed. If Expression1 is compound type then Expression2 is added to the item list of Expression1 and returned. The Expression1 remains unchanged. append operator is used to add an item to the compound list and return the result. Unary + operator is not allowed. Operator ^ is used for Power.

12 + ABC would return 12ABC.

[Color TV,Car]+Washing Machine would return [Color TV,Car, Washing Machine]

Customer.Assets APPEND Washing Machine: would add Washing Machine item to the existing Customer.Assets

List Functions Main

Expression1 IN Compound_Expression2
Expression1 IS [WITHIN|IN|PART OF|INCLUDED IN] Compound_Expression2

It checks whether Expression1 exists in compound list. In case Expression1 is of compound type, it checks whether all items in the Expression1 exist in the List. 1. Color TV IS IN Customer.Assets:
would return true if Customer.Assets variable contain Color TV in the list.
2. [Color TV, Car] IS IN Customer.Assets:would return true if both items: Color TV and Car exist in the Customer.Assets variable.
Compound_Expression1 INCLUDE Expression2

Compound List [INCLUDE|INCLUDES|CONTAIN|CONATAINS] Expression2
This is opposite to within operator. It checks whether Expression2 is included in the Compound_Expression1. In case Expression2 is of compound type, it checks whether all items in the Expression2 exist in the List.

1. Customer.Assets INCLUDE Color TV

2. Customer.Assets INCLUDE [Color TV, Car]

Compound_Expression1 INCLUDE|INCLUDES|
CONTAIN|CONTAINS ANY OF Compound_Expression2

Checks whether Compound_Expression1 has any item from the Compound_Expression2

1. Customer.Assets INCLUDE ANY OF [Color TV, Car]: would return true of Customer.Assets contain either Color TV or Car.


GET_AT(Compound List,Position)

SET_AT(Compound List,Position,New Value)

INSERT_AT(CompoundList,
FromPosition,
Value|Compound List)

LEN(Compound List)|COUNT(Compound List)

APPEND(Compound List,Expression)

FILL_LIST(Size,FromValue,IncrValue)

FILL_TREND(Size,FromValue,IncrValue)

SLICE(List,FromPos,ToPos)

GET_RANDOM_SEQ(FromValue,ToValue,Size)

SPLIT(Text_Expression1,SeperatorString)

SORT(CompoundList,A|D)

EVALUATE (
CompoundList,
ConditionalOperator,
Value)

REMOVE(List,Element)

REMOVE_WEIGHTS(List,ALL|IndexNumber)

SET_WEIGHTS(List,All|IndexNumber|,Weight|WeightList|Trend)

RW(List)

GET_WEIGHTS(List,ALL|List|Option|IndexNumber)

GW(List)

UNIQUE(List)

RELATIVE_WEIGHTS(KeywordList, TimeLapsedTrend, KeywordWeightTrend)

RELATIVE_WEIGHTS_MULTIVALUED(KeywordList, TimeLapsedTrend, KeywordWeightTrend)
GET_AT is used to retrieve an item from the list by index Position. First index position is 1. Expression1 must be compound data type.

SET_AT sets the value (including list) at index position. It always returns true.

INSERT_AT inserts value or compound list into the existing list. Always returns true.

LEN returns number of values in the list. Since list is like array which holds different types of values,

APPEND adds items to the existing list at the end and returns true

FILL_LIST returns a filled list of size: Size filled with values starting from FromValue and incremented by IncrValue

FILL_TREND returns a Trend of size: Size filled with values starting from FromValue and incremented by IncrValue

SLICE returns the portion of list from the source string

GET_RANDOM_SEQ returns a list containing random numbers (Size) between FromValue to ToValue. 

SPLIT splits the Text_Expression1 using characters in SeperatorString as seperators and returns list of values (it removes blanks).

SORT returns sorted (by ascending/descending order) based on option selected. If variable is used in expression, then variable is sorted.

EVALUATE compares values in the list against expression that consists of conditional operator and value

REMOVE removes element from the list.

REMOVE_WEIGHTS gets the values ignoring weights (in round brackets or =) and returns value list or value.

RW returns list of only option values (ignoring weights)

SET_WEIGHTS sets the option weights from the Weight List or Trend or sets weight of particular option (index) to given weight 

GET_WEIGHTS gets the weights attached to element/s in trend. The second argument can be ALL (GE function can be used for this), Option, List etc.

GW returns trend of only option weights (ignoring values)

UNIQUE returns list of unique values from list

RELATIVE_WEIGHTS and RELATIVE_WEIGHTS_MULTIVALUED are special functions added to calculate relative weights of keywords based on time elapsed (e.g. since download) and number of times (or weights) that keywords have been accessed. First argument is list of keywords, second arguments is time elapsed (in minutes) and weights of each keyword. RELATIVE_WEIGHTS_MULTIVALUED allows Keywords to be multivalued.

Customer.Assets:= [Color TV, Car, Washing Machine]

GET_AT([Color TV, Car, Washing Machine], 2) would return Car.

GET_AT([Yogesh,23,B.E.,Unmarried],2) would return 23.

GET_AT([Yogesh|B.Tech.,M.B.A|Unmarried],2) would return [B.Tech.,M.B.A.].

SET_AT(Customer.Assets,2, Two Wheeler] would set value of Customer.Assets  to [Color TV, Two Wheeler, Washing Machine]

INSERT_AT(Customer.Assets,2, Two Wheeler] would set value of Customer.Assets  to [Color TV, Two Wheeler, Car, Washing Machine]

APPEND([Color TV, Car, Washing Machine],Two Wheeler) would return [Color TV, Car, Washing Machine,Two Wheeler]

FILL_LIST(5,2,1) would return [2,3,4,5,6]

FILL_TREND(5,2,2) would return |2 4 6 8 10|

SLICE([Color TV, Car, Washing Machine, Refrigerator, Two Wheeler],2,4) would return [
Washing Machine, Refrigerator]

GET_RANDOM_SEQ(10,25,5) may return [11,15,12,24,18]: random numbers from 10-25.

GET_RANDOM_SEQ([Color TV, Car, Washing Machine, Refrigerator, Two Wheeler],1_TO_5, 3) may return  [Color TV,Refrigerator, Two Wheeler]

SPLIT("A,B,C D E;K",", ;") would return [A,B,C,D,E,K]

EVALUE([A,B,C,D],"=",A) would return A

REMOVE([A,B,C,D],B) would return [A,C,D]

REMOVE_WEIGHTS([A(15.5),B(12.4),C],ALL) would return [A,B,C]

REMOVE_WEIGHTS([A=15.5,B=12.4,C],ALL) would return [A,B,C]

REMOVE_WEIGHTS([A(15.5),B(12.4),C],2) would return B

RW([A(15.5),B(12.4),C(23)]) would return [A,B,C]

SET_WEIGHTs([A,B,C=12],ALL,[10,20,30]) would return [A=10,B=20,C=30]

SET_WEIGHTs([A,B,C=12],ALL,|10 20 30|) would return [A=10,B=20,C=30]

SET_WEIGHTs([A,B,C=12],1,10) would return [A=10,B,C=30]

GET_WEIGHTS([A(15.5),B(12.4),C],ALL) would return |51.5 12.4 0|

GW([A(15.5),B(12.4),C(23)]) would return |15.5 12.4 23|

GET_WEIGHTS([A(15.5),B(12.4),C(23)],B) would return 12.4

GET_WEIGHTS([A(15.5),B(12.4),C(23)],[A,C]) would return |15.5 12.4|


GET_WEIGHTS([A(15.5),B(12.4),C],2) would return 12.4

UNIQUE([A,B,A,C] would return [A,B,C]

RELATIVE_WEIGHTS([Classic,Drama,Health,Kids],|10 5 1 15|, |0.5 1 1 0.5|)
would return [Classic=0.143|Drama=0.287|Health=0.433|Kids=0.137]
where |10 5 1 15| is time lapsed since keywords accessed respectively means Classic keyword was accessed 10 minutes back. |0.5 1 1 0.5| shows the access frequency (including whether keyword is liked or not).

RELATIVE_WEIGHTS_MULTIVALUED([A,B|C,D|E|B,F],|10 5 1 15|,|0.5 1 1 0.5|)
would return [A=0.090|B=0.165|C=0.180|D=0.180|E=0.300|F=0.085]

IS Operator
[Number|Real|Text|Compound List] IS Compound List
IS Operators is used to compare the two lists or other data type for equality. [CAR, CTV] IS [CTV,CAR] would return true. Today IS [Saturday,Sunday] is same as Today IS Saturday OR Today IS Sunday, where Today is Text variable. Similary 10
  SLICE([A,B,C,D,E],2,4) would return [B,C,D]
Relational Operators and Logical Operators Main

Expression1 = Expression2
Expression1 [IS|ARE|HAS BEEN|] Expression2

Expression1 <> Expression2
Expression1 IS NOT Expression2

Expression1 > Expression2
Expression1 IS [BETTER|GREATER|MORE] THAN Expression2

Expression1 <Expression2
Expression1 IS [LESS|LOWER] THAN Expression2

'Expression1 <= Expression2
Expression1 IS NOT [GREATER|BETTER|MORE] THAN Expression2

Expression1>=Expression2
Expression1 IS NOT [LESS|LOWER] THAN Expression2

Expression1 [BETWEEN|IS BETWEEN] [From_Value,To_Value]

Bool_Expression1 OR Bool_Expression2:Boolean

Bool_Expression1 AND Bool_Expression2:Boolean

NOT Bool_Expression1:Boolean

IF_THEN_ELSE(Condition, Expression1,  Expression2)

ADD_SCORE(Variable, Value)

Relationaloperators>,>=,<,<=,= ,<> are supported onmostofthebasicdatatypes:Number,Real,TextandincludingDate.Operators>,>=,<,<=, BETWEEN can be used with text variables which are linked to menu. The result would be true depending upon the order of options (it should not have indexed menu). In case text variable is not linked to menu, simple strings comparisons are made in case Expression is of text type.

IF_THEN_ELSE returns Expression1 if condition is true otherwise returns Expression2 
Customer.Education IS BETTER THAN Diploma.
If a menu that contains options [Higher Secondary, Diploma, Graduate, Post Graduate] is linked to the variable Customer.Education. This expression would return true for values Graduate and Post Graduate because they are on higher order in option list. Same way it is used for other Operators.

Suppose Customer.Education is Diploma
Customer.Education
IS BETWEEN [Higher Secondary, Graduate]  would return true;

D IS BETWEEN [A,E] would return true
12 IS BETWEEN [10,23] would return true

 IF_THEN_ELSE(X<10,AAA,BBB) would return AAA if X is less than 10 otherwise BBB

ADD_SCORE(Str_X,ABC) would add ABC to variable Str_X.

Menu functions Main
GET_CODE(Variable)

GET_CODE_LIST(Variable)

GET_INFERENCE(Variable,Class/Type)

GET_OPTION(Variable)

GET_MENU(MenuName,MenuOption,Expression)

GET_MENU_CODE(MenuName,Expression)

GET_MENU_OPTION(MenuName,Expression)
Expression must be variable and linked to. It returns the code/inference/option corresponding to value (option or code) of Expression.

GET_MENU_CODE returns code of expression2 using menu id. Returns blank value if expression2 is not found in option list: recommended to use GET_MENU function



GET_MENU_OPTION returns option of expression2 using menu id. Returns blank value if expression2 is not found in code list: recommended to use GET_MENU function



GET_MENU returns results based on option selected in second parameter. The options are described as follow

Option:
returns option corresponding to given expression (menu code). If expression (menu code) is list, result has first option in each code in the list.



Code
returns code corresponding to given expression (menu option) . If expression (menu option) is list, result has list of codes corresponding to option list.

Inference
returns inference corresponding to given expression (menu option). Class/Type can be added with inference to return corresponding inference using hash (#). GET_MENU returns inferences separated by <BR> in case of multi-valued options or types.

OptionList
returns list of options corresponding to given expression (menu code/code list). If the expression is list, then options corresponding to each menu code in the list are added to the result.

CodeList
returns list of codes corresponding to given expression (menu option list).

MaxOption
returns the maximum option (in chronological order) value from the list. If the expression is blank the first option in the menu options is returned. 

MinOption
returns the  minimum option value from the list. If the expression is blank the first option in the menu options is returned

City Menu
Option Code
Mumbai A
Delhi A
Chennai A
Pune B
Patna B
Hyderabad B
Indore C
Nasik C

Suppose Customer.City is set to Mumbai. GET_CODE (Customer.City) would return the code of the city Mumbai.

GET_MENU("City", Code, Mumbai) returns A

GET_MENU("City",CodeList,[Mumbai,Pune]) returns [A,B]

GET_MENU("City",Code,[Mumbai,Pune]) returns [A,B]

GET_MENU("City",Option,A) would return first city (may change in case index option is used for menu) of class A in this case Mumbai

GET_MENU("City",OptionList,A) would return all A class cities [Mumbai,Delhi,Chennai]

GET_MENU("City",OptionList,[A,B]) would return all A and B class cities [Mumbai,Delhi,Chennai,Pune,Patna,Hyderabad]

GET_MENU("City",MaxOption," ") would return Nasik (on chronological order)

GET_MENU("City",MaxOption,"[Mumbai,Chennai]") would return Chennai

GET_MENU("HandAnalysis.Signs",Inferenence,Star) would return inference corresponding to option star .

GET_MENU("HandAnalysis.Signs",Inferenence,[Star, Square]) would return inference corresponding to options Star and Square .

GET_MENU("HandAnalysis.Signs",Inferenence#Wealth, Star) would return inference corresponding to option Star of type Wealth .

GET_MENU("HandAnalysis.Signs",Inferenence#Wealth, Star) would return inference corresponding to option Star of type Wealth .

GET_MENU("HandAnalysis.Signs",Inferenence#[Wealth,Health], [Star,Squre]) would return inference corresponding to options Star and Square of type Wealth and Health.

GET_INFERENCE(HandAnalysis.Life_Line_Signs," ") would return inference of value of variable HandAnalysis.Life_Line_Signs (based on menu linked)

GET_INFERENCE(HandAnalysis.Life_Line_Signs,Wealth) would return inference of type Wealth of value of variable HandAnalysis.Life_Line_Signs

GET_INFERENCE(HandAnalysis.Life_Line_Signs,[Health,Wealth]) would return inference of type Wealth and Health of value of variable HandAnalysis.Life_Line_Signs (based on menu linked)

SQL functions Main    

SQL_FILTER(Expression)

ADD_TO_SQL(Expression)

CBR_FILTER(Expression)

ADD_TO_CBR(Expression)

GET_DB_FIELD(DynamicQuery,Default)

GET_DB_RECORD(DynamicQuery)

DB_QUERY(DB_ID,SQLQry)

LOAD_FROM_DB("GoalVar[#QueryID]",Expression)

UPDATE_TO_DB("GoalVar[#QueryID])

INSERT_INTO_DB("GoalVar[#QueryID])

OPEN_CURSOR(
"CursorVar",
"GoalVar[#QueryID]"
,Filter)

FETCH_CURSOR(RowNo,CursorVar)

EXECUTE_QUERY(DB_ID,"DML Query")

 

 

The system maintains a session filter (criteria/condition) to filter the query results for expert system. This filter is appended to where clause of SQL query linked to current Goal Variable.

SQL_FILTER: is used to initialize filter while ADD_TO_SQL is used to append to existing filter more conditions. CBR_FILTER and ADD_TO_CBR are used when condition is required for filtering the matching cases from databases.

GET_DB_FIELD fires the query set in DynamicQuery and brings the result. If query does not return the result, the default value is returned.

GET_DB_RECORD fires the query set in DynamicQuery and brings the result in List. Only first row is returned like GET_DB_FIELD


DB_QUERY fires the query:SQLQry set in and brings the result in List. Only first record is returned. The variable names can be used inside the SQLQry filter to return the record based on filter.

LOAD_FROM_DB fires the query connected to the specified goal variable by appending the filter. The query result is populated into current session directly. Ideally it should return only one row. It returns "OK:" in case the query is successfully executed. Otherwise returns "ERR:"+ actual error. The goal variable name must be inside the double quote.

UPDATE_TO_DB updates the current session to the database by using the query connected to goal variable. It returns "OK:Number of Rows Updated" in case the query is successfully executed. Otherwise returns "ERR:"+ actual error. The goal variable name must be inside the double quote.

INSERT_TO_DB inserts the current session to the database by using the query connected to goal variable. It returns "OK:Number of Rows Inserted" in case the query is successfully executed. Otherwise returns "ERR:"+ actual error. The goal variable name must be inside the double quote.

OPEN_CURSOR returns number of rows returned by database SQL query connected to GoalVar and Query ID. Filter is applied at run-time. It loads data retrieved from database into the variable Cursor Variable: a variable which stores XML dataset, it must be a text variable.

FETCH_CURSOR loads session with variable values stored at specified row number. There is no need to explicitly move field values into variable values. It is automatically done by the system. 

The results returned by these functions would contain transformed values depending upon the mapping set.

EXECUTE QUERY executes the DML query in database DB_ID. Returns the status of result. Status returned is OK:Number of records affected in case query is executed successfully otherwise ERR:<i>Error Message</i>

ASK(Insurance.Age)
AND SQL_FILTER "([Insurance.Age]>=Min_eAge AND [Insurance.Age]<=Max_eAge)" 
AND ASK(Insurance.Sex)
AND ADD_TO_SQL "
AND ([$Insurance.Sex]= '[Insurance.Sex]' OR Sex= 'Both')"

Above example initialises the filter using the condition " [Insurance.Age]>=Min_eAge AND [Insurance.Age]<=Max_eAge" where Min_eAge and Max_eAge are the field names. The system would replace value of variable Insurance.Age at run time. $ symbol can be used when field name is mapped to variable. Otherwise explicit field names can be specified like Min_eAge and Max_eAge are the field names in select clause of corresponding SQL query. The filter must be included in double quoates in order to avoid conflict with rule-Operators and functions. Insurance.Sex variable is includes in single quoate because field Sex is of text data type. The variable names must be included in square brackets.The filter should not start with "[". The system treats it as compound literal, so add round brackets around filter.

Rule No=4 ID=Information Search.4
IF  Banking.Show Trans Option INCLUDES On Transaction Type
AND ASK(Banking.Transaction Mode)
AND ADD_TO_SQL "AND $[Banking.Transaction Mode] IN (CHAR_SET [Banking.Transaction Mode])"
THEN Banking.Trans Search Criteria IS Transaction Type

Some special functions can be used inside the filter for example CHAR_SET as given in example, it converts data into comma delimited format. This facilitates IN operations. SET instead of CHAR_SET can be used to convert numeric values into separated by commas. If above example of variable Banking.Transaction Mode has values [CW,CC] then CHAR_SET would return 'CW','CC'.

DB_QUERY(LDB,"select * from LoanProducts where S_No=62") would return the record whose serial number is 62. The list would look like this: [62,BOB,10,25,10,False,Self-Employeed,To buy a plot,100,M,0,5000000,0,4,20,0.25,0,3,21,65,False]

LOAD_FROM_DB("CreditRating.Credit Case","$[Customer.ID]=[Customer.ID]") IS "OK:" would fire the query connected to goal:CreditRating.Credit Case with filter of Customer.ID and would load the customer profile into the current session.

UPDATE_TO_DB("CreditRating.Credit Case") would update the current session data to database.

OPEN_CURSOR("Customer.SelectedCustomers","Customer.Queries#Details","Salary>1000") would load data from query ID Details linked to goal Customer.Queries with filter Salary>1000 into variable Customer.SelectedCustomers

FETCH_CURSOR(10,Customer.SelectedCustomers) would load values from 10th row of cursor variable Customer.SelectedCustomer

EXECUTE_QUERY(MovieMart,"update downloads set d_processed='Y' where u_id=[MovieMart.User_ID]") would return result "OK:Number of rows updated". Variables can be included at any part in query, at run time value would be replaced.

Test.City
:='Mumbai'
Test.Code:=101
EXECUTE_QUERY('Update City set Name='[Test.City]' where Code=[Test.Code]")

Range List Conversion Main  

PROFILE_OF(Expression,RangeID)

STATUS_OF(Expression,RangeID)

SCORE_OF(Expression,RangeID)

MAX_SCORE_OF(Expression,RangeID)

See Also: Range Interface

SCORE_OF is used to convert numeric (within the range of numeric values) or symbolic value into numeric value. MAX_SCORE_OF is applicable when Range ID is multivalued. It returns highest score from the options available.



PROFILE_OF and STATUS_OF convert symbolic value into qualitative value.

Age Status Range List
From To Value
-- 17 Minor
18 25 Very Young
25 40 Young
41 60 Matured
61 -- Old

PROFILE_OF(20,Age Status) would return Very Young .

Households Range List
Symbolic Value Value/score
Car 5
Two Wheeler 2
Color TV 2
Washing Machine 2
Computer 3
Microwave 2
AC 3
Refrigerator 2

SCORE_OF(Car, Households) would return 5. SCORE_OF([Car,AC], Households) would return 8.
MAX_SCORE_OF([Car,AC], Households) would return 5.

Income Range List

From To Value
-- 74999 5
75000 124999 8
125000 174999 10
175000 -- 15
SCORE_OF(150000,Income) would return 10

Variable functions Main

ASK(Variable)

RESET_VAR("Variable"|VariableList)

SET_VAR_VALUE(
"VariableName"|VariableList, Expression):Boolean

GET_VAR_VALUE(
"VariableName"|Variable|VariableList, Expression)

IS_NULL(
"VariableName"|Variable)

IS_NULL_THEN("VariableName"|Variable Name)

CLONE(Variable)

To explicitly ask user to enter the value of the variable through Web interface. It always Variable must be of input type. System does not ask value of a variable if it appears only in the sub-expression without function, operator etc. For example: consider the following Rule.

IF Customer.Age
> AND Customer.Sex IS Male...

In the first sub-expression, there must be ASK Customer.Age because it appears only variable and system would expect boolean expression. While in second sub-expression, value of Customer.Sex would be asked to the user at run-time.

RESET_VAR resets the variable to null. The variable must be inside quote. Alternatively many variables can be set to null by including them in the list.

SET_VAR_VALUE sets the expression value to variable. The variable must be inside quote. It returns true if operation is successful otherwise returns false. Alternatively many variables can be set to specific value by including them in the list.

GET_VAR_VALUE gets the value of variable whose name is evaluated as a result of expression value. It returns value of variable. If expression is list, then list of values corresponding to variable names are returned.

CLONE is useful when copy of object is to be assigned instead of reference. 

ASK Customer.Age

RESET("Customer.Age")

RESET([Customer.Name,Customer.Age])

SET_VAR_VALUE("Customer.Age", 30)

SET_VAR_VALUE([Customer.Income, Customer.Savings],0)

Str_X:="Exam.Marks"

SET_VAR_VALUE("Str_X",12.34) will set value of Exam.Marks to 12.34

SET_VAR_VALUE([Exam.A,Exam.B],0) would set value 0 to vars Exam.A and Exam.B

GET_VAR_VALUE(Str_X) would return 12.34

IS_NULL_THEN(Str_X,ABCD) if the value of Str_X is null then ABCD would be returned otherwise value of Str_X would be returned.

Compound1:=[A,B,C,D]
Compound2:= CLONE(Compound1)  creates a copy of list [A,B,C,D] and sets to Compound2. if Compound1 is modified, Compound2 is not modified.

Text/String functions Main

SUBSTRING(
TextExpression,
From_Index,
Length)

LEFT(TextExpression,Length)

RIGHT(TextExpression,Length)

REVERSE(TextExpression)

REPLACE(
TextExpression,
TextToBeReplaced,
ReplacementText)

SLICE(TextExpression,From_Index,To_Index)

INDEX_OF(TextExpression,TextToBeFound)

LEN(TextExpression)

TO_UPPER(TextExpression)

TO_LOWER(TextExpression)

TRIM(TextExpression)

APPEND(TextVar,Expression)

SPACE(Number_Expression2)

MAX(TextExpression1, TextExpression2)

MIN(TextExpression1, TextExpression2)

SPLIT(Text_Expression1,SeperatorString)

SUBSTRING:Returns the text consisting number of characters (specified in length) from TextExpression starting at From_Index. In case From_Index is incorrect, then TextExpression is returned as it is. Index starts at 1.

LEFT: Returns Length: number of characters starting from first character.

RIGHT: Returns Length: number of characters from right hand side.

REVERSE: Returns the reversed the text.

REPLACE: Returns the text by replacing the TextToBeReplaced by ReplacementText

SLICE: Returns the text by removing number of characters starting from index:From_Index to index:To_Index

SPACE: Returns string with specified number of spaces

INDEX_OF: Returns whether TextToBeFound exists in TextExpression. Returns the Index of TextToBeFound text. Returns 0 if Text is not found.

LEN: Returns the length of Text

TO_UPPER:Returns the uppercase text.

TO_LOWER:Returns the lowercase text.

TRIM: Removes the leading and trailing blank spaces and returns the text

APPEND adds the value to the text variable.

MAX and MIN return maximum and minimum of two strings.

SPLIT splits the Text_Expression1 using characters in SeperatorString as separators and returns list of values (it removes blanks).


Trend functions Main

AMD(Trend)

COUNT(Trend)

HIGHEST(Trend)

LOWEST(Trend)

AVERAGE(Trend)

STD_DEV(Trend)

R_SQUARE(Trend)

INCREASE_IN(Trend)

CORRELATION(Trend)

GROWTH(Trend)

GET_AT(Trend,Pos)

SET_AT(Trend,Pos,Value)

LEN(Trend)|COUNT(Trend)

APPEND(Trend,Expression)

SLICE(Trend,FromPos,ToPos)

STAT(Trend,StatOption)

EVALUATE(CompoundList,ConditionalOperator,Value)

FILL_LIST(FromValue,IncrValue,Size)

FIT_TREND(TrendType,X_Trend,Y_Trend)

FORECAST_TREND(
TrendType,
CoefficientTrend,XTrend)

TREND_EQUATION(TrendType,CoefficientTrend,NumberOfDigitAfterDecimal)

Most of the math functions like EXP, LOG etc. are available for TREND data type

These functions work on trend.

AMD Calculated absolute mean deviation.

COUNT counts the number elements in Trend.
 
HIGHEST and LOWEST determine lowest and highest numeric values in Trend.

AVERAGE and STD_DEV return mean and standard deviation.

GROWTH return the Average % increase

R_SQUARE returns the correlation coefficient with linear regression on trend 1,2,3...This is useful in case of checking the trend whether it is increasing or decreasing.

INCREASE_IN returns the trend whose element show % increase in each subsequent trend element

CORRELATION: returns the correlation coefficient between two trends.

GET_AT and SET are used to set values in trend at particular position.

LEN shows number of elements in trend

APPEND adds value at the end.

SLICE returns the subset of trend.

Option: based on what kind of statistics one wants to return one of the following option can be selected

Count, Lowest, Min, Highest, Max, Sum, Average, Mean, Avg, StdDev, AbsMeanDev, IncreaseIn, Co_Coefficient, AvgGrowth, All

STAT with option All returns the trend containing |count  min  max sum avg stddev mean deviation co-coefficient|

EVALUATE compares values in the list against expression that consists of conditional operator and value

FILL_LIST returns a filled trend of size: Size filled with values starting from FromValue and incremented by IncrValue

FIT_TREND fits linear, exponential, logarithmic etc. using Xs and Ys from trends and return trend containing coefficients, rSquare and absolute average deviation.

FORECAST_TREND returns forecasted trends based on coefficient values depending upon trend type selected. It returns trend in the form |a b rSqr AMD| where a and b are coefficients and rSqr is r-square value and AMD:absolute mean deviation (between actual and forecasted values).

In case of polynomial trend type, the function selects the best possible n with best rSquare value and it returns n+1 coefficients starting with lowest to highest.

TREND_EQUATION returns forecasted trends based on coefficient values depending upon trend type selected.

TrendType

Linear
Fits linear trend of form y=ma+b

Exponential
Fits exponential trend of form: y=ae^(bx)

Logarithmic
Fits the logarirthmic trend of form y=aLn(x)+b

Power
Fits the power trend of form y=ax^b

where a and b are coefficients

Polynomial
Fits the power trend of form y=ax^n+a1x^n-1+...+b
where n is degree of polynomial

Trend Var:=|10 20 15 50 24|;

AMD(Trend Var) would return 1.2.

HIGHEST(Trend Var) would return 50

LOWEST((Trend Var) would return 10

AVERAGE(Trend Var) returns 23.8

STD_DEV(Trend Var) returns 15.56

R_SQUARE(Trend Var) would return 0.59

GROWTH(Trend Var) would return 64.08

GET_TREND(INCREASE_IN(Trend Var)) would return |100 -25 233.33 -52| where 100 means 100% increase from 10 to 20, -25 means 25% decrease from 20 to 15 etc. The size of resulting Trend is one less than source trend size.

CORRELATION(|10 20 25 40 90|,|5 15 20 25 40|) would return 0.96.

R_SQUARE(Trend Var) and CORRERATION(Trend Var,|1 2 3 4 5|) would return the same result.

APPEND(Trend Var,39) would return |10 20 15 50 24,39|

SLICE(Trend Var,2,4) would return |20 15 50|

EVALUATE(Trend Var,">=",20) would return |20 50 24|

STAT(Trend Var) returns |5 10 50 119 23.8 15.56 0.54 0.59| 

FIT_TREND(Linear,|1 2 3 4 5|,|34 56 78 90 100|) would return |16.6 21.8, 0.9692 3.68|  where 16.6 is slope (m), 21.8 is Y intercept(c), 0.9692 is rSquare and 3.68 is average deviation between actual and calculated values.

FORECAST_TREND(Linear, |16.6 21.8, 0.9692 3.68|, |6 7 8|) would return |138 154.6 171.2|

TREND_EQUATION(Polynomial,|1 2 4 5 78 98|,4) would return 1.0000X^3.0000+2.0000X^2.0000+4.0000X^1.0000+5.0000

Math functions Main

MAX(Value1,Value2)

MIN(Value1,Value2)

EXP(doubleExpression)

ABS(doubleExpression)

ROUND(Value,NumberOfDecimalDigits)

SQR(Value)

SQRT(doubleExpression)

LOG10(doubleExpression)

LOG(doubleExpression,base)

FLOOR(doubleExpression)

CEILING(doubleExpression)

Common math operations.
Graph functions Main

SET_GRAPH_OPTION(
GraphID,
Option,
Value_Expression)

CREATE_GRAPH(GraphID,MatrixExpression) 




GraphOption

Options applicable to graph

Title
: To set the title of the graph
GraphSize: To set the size of the graph specified in RowxColumn format
Type: To set the type of the graph: LINE,BAR,PIE,XY
GridType: To set grid option:Verticle, Horizontal, Both, No
GridColor: Color of grid
BorderColor: border color of graph
LabelColor: Color of X and Y axis label
MaxYValue: Max Y value
MinYValueMin Value
GraphBackColor: Background color of graph
 XAxisTitle: X axis title
YAxisTitle: Y axis title
SecondYAxisTitle: Second Y axis title
XIntent: X intent (distance from left to graph Y axis line, distance to right from second right Y axis line)
YIntent: Y intent (distance from top to graph X top axis line, distance to right from the bottom X axis line)
LabelAlignment: alignment of X axis labels:Left,Right (appropriate in case of bar chart)
MarkerSize:Size of the marker in pixels

Options applicable to columns (each series), third arguement is compound type
MarkerType: Circle,Square,FilledCircle,FilledSquare,Diamond,FilledDiamond
ShowYValues:Shows the position of Y values:Bottom,Right,Left,Top,No compared to marker
ShowLine: whether to show line or not.
Label:X axis labels
Color: colors for bar/line/marker
Legend:Series names
IgnoreValues: Applicable in Line chart, values which to be skipped from displaying
LineAndBarOptions: whether to show line or not (along with bar): Line (Default),Line&Bar,Bar

Expression1 can be of Matrix or Trend Type
Exam.MatVar:=CREATE_MATRIX(5,10,0.01)  would create matrix of 10 columns (series) each consisting of five values
SET_MATRIX_COLUMN (Exam.MatVar,1,|1 2 4 4 5|) would set value to column 1
CREATE_GRAPH(A,Exam.MatVar)  would create an instance of graph whose ID is A
SET_GRAPH_OPTION(A,GraphSize,500x400)
SET_GRAPH_OPTION(A,Title,Test Graph Title)
SET_GRAPH_OPTION(A,Type,Bar)
SET_GRAPH_OPTION(A,MaxYValue,200.0)
SET_GRAPH_OPTION(A,GridType,No)
SET_GRAPH_OPTION(A,MarkerType,[FilledSquare])
SET_GRAPH_OPTION(A,GridColor,Green)
SET_GRAPH_OPTION(A,BorderColor,Yellow)
SET_GRAPH_OPTION(A,LabelColor,Red)
SET_GRAPH_OPTION(A,LabelAlignment,Vertical)
SET_GRAPH_OPTION(A,ShowYValues,[Top])
SET_GRAPH_OPTION(A,MarkerSize,5)
SET_GRAPH_OPTION(A,IgnoreValues,|0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01|)
SET_GRAPH_OPTION(A,Legend,[S1,S2,S3,S4,S5,S6,S7,S8,S9,S10])
SET_GRAPH_OPTION(A,Label,[AA,BB,CC,DD,EE])  would set labels to each X value
SET_GRAPH_OPTION(A,Color,[LightGreen,Orange,Blue,Green,Yellow])
SET_GRAPH_OPTION(A,XAxisTitle,"X-AXIS_TITLE") 

Graph can be called by Graph.aspx?ID=A
ASK(Exam.Graph)   this would display graph:


Matrix functions Main

CREATE_MATRIX(Rows,Columns,InitialValue)

INVERSE_MATRIX(Matrix_Expression)

TRANSPOSE_MATRIX(Matrix_Expression)

READ_MATRIX(Data,[XML|TEXT],[Column Delimiters, Row Delimiters])

SAVE_MATRIX(Matrix,[XML|TEXT],[Column Delimiters, Row Delimiters])
REESIZE_MATRIX(Matrix,Row_Number,Column_Number)
COUNT(Matrix)

GET_MATRIX_COLUMNS(Matrix,FromCol,ToCol)
GET_MATRIX_COLUMNS(Matrix,[Column List]," ")
GET_MATRIX_COLUMN(Matrix,Column)

GET_MATRIX_ROWS(Matrix,FromRow,ToRow)
GET_MATRIX_ROWS(Matrix,[Row List]," ")
GET_MATRIX_ROW(Matrix,Row)

SET_MATRIX_COLUMN(Matrix,Column,Trend)
SET_MATRIX_ROW(Matrix,Column,Trend)

SET_AT(Matrix,[Row,Column],Expression)

GET_AT(Matrix,[Row,Column])

Most of the math functions like EXP, LOG etc. are available for MATRIX data type


CREATE_MATRIX creates an instance of matrix of size:rows x columns and sets all elements to initial value

TRANSPOSE_MATRIX Returns transpose of matrix.

READ_MATRIX and SAVE_MATRIX are used to read and write matrix data (based on type). Delimiters contain row and column delimiters. 

COUNT returns compund list in the format [Row,Col]

GET_MATRIX_COLUMNS returns the columns (in the form of matrix) specified in selected range (FromCol to ToCol). If second argument is list then column numbers to be retrieved from Matrix are listed.

GET_MATRIX_COLUMN returns specified column as TREND

GET_MATRIX_ROWS returns the rows (in the form of matrix) specified in selected range (FromRow to ToRow). If second argument is list then rows numbers to be retrieved from Matrix are listed.

GET_MATRIX_ROW returns specified row as TREND

SET_MATRIX_COLUMN sets column of matrix using values from TREND

SET_MATRIX_ROW sets row of matrix using values from TREND

SET_AT sets the value of expression to matrix element addressed by [Row,Column]

GET_AT returns the value stored at matrix element address by [Row,Column]
Mat Var := CREATE_MATRIX(5,10,0.01) would return create matrix of size 5 x 10 with values set to 0.01

Mat Var:= READ_MATRIX(Str_X,TEXT,[ ,:]) would create an instance of matrix that would read data in variable Str_X with row delimiter ':' and column delimiter ' '. Use | separator in case comma itself is separator. e.g. [ |,]

Mat Var:={1 3 4,5 6 7, 10 1 3}

SAVE_MATRIX(Mat Var,TEXT,[;|,]) would return 1,2,3;5,6,7;10,1,3
COUNT(Mat Var) would return [3,3]

GET_MATRIX_COLUMNS(Mat Var,1,2) would return {1 3, 5 6,10 1}
GET_MATRIX_COLUMNS(Mat Var,1,1 would return {1, 5,10}
GET_MATRIX_COLUMNS(Mat Var,[1,3]," ") would return {1 4,5 7,10 3}

GET_MATRIX_COLUMN(Mat Var,1) would return trend:|1 5 10|

GET_MATRIX_ROWS(Mat Var,1,2) would return {1 3 4, 5 6 7}
GET_MATRIX_ROWS(Mat Var,1,1) would return {1 3 4}
GET_MATRIX_ROWS(Mat Var,[1,3]," ") would return {1 3 4, 10 1 3}

GET_MATRIX_ROW(Mat Var,1) would return trend: |1 3 4|

SET_MATRIX_COLUMN(Mat Var,1,|10 13 15|) would set Mat Var first column values from trend:{10 3 4,13 6 7,15 1 3}

SET_MATRIX_ROW(Mat Var,1,|10 13 15|) would set Mat Var first column values from trend:{10 13 15,5 6 7, 10 1 3}

SET_AT(Mat Var,[1,1],10) would set value of first row and first col to 10

GET_AT(Mat Var,[2,1]) would return 5.
Date functions Main


GET_DATE(Date,DateFormatText)

GET_INTERVALS(DateCompound_Expression1,DateFormat,Day|Hour|Minute)

TO_DATE(StringDate,DateFormatText)

ADD_TO_DATE(DateExpression,UnitOption,Period)

DATE_DIFF(FromDate,[ToDate|"NOW"],UnitOption)

MAX(Date1,Date2)

MIN(Date1,Date2)

NOW(Date|DateFormatText)

Date FormatText:
DD-Day
MM-Month
MON- Three character month format
YYYY-Year and MON-for month three letter
HH: Hour
MN: Minute
SS:Seconds

UnitOption:

Year:  years between two dates
YearsMonth: return format is year.month
HalfYear:  number of half years
Quarter: no.of quarters
Month: no of months
MonthDays: returns month.day format
Day: no of days
DayTotal:  no.of days.left hours converted into day fraction
DayHour: returns day.hour format
Hour: no of hours
HourMinute: returns hour.minute format
HourTotal: no.of hours.left minutes converted into hour fraction
HourMinuteTotal: total no.of hours.left minutes converted into hour fraction
Minute: no.of minutes
MinuteTotal: no.of minutes.left seconds converted into minute fraction
Second: no. of seconds
SecondTotal: no.of minutes.left milliseconds converted into second fraction
MiliSecond: no of milliseconds

GET_INTERVALS Returns intervals (number of days, number of hours etc.) between consecutive dates. It returns trend of intervals. The second argument represents date format. It can be left blank or set to Default in case want to set to system default date format.

TO_DATE converts string date expression into date using dateFormat. The system takes defaults in case date format characters are missing. e.g. if HH is missing in dateFormat then current Hours would be taken from SystemDate.

GET_DATE formats the DateExpression and returns string.

NOW returns the specific date portions from current system date. If word Date is specified, then it returns current system date.

DATE_DIFF: finds out the difference between two dates based on UnitOption selected, the difference can be in milliseconds, seconds, minutes, hours, days etc. based on UnitOption selected. Second argument (date expression) can be "NOW" which takes the current date.

ADD_TO_DATE returns a date by adding either seconds, minutes, hours etc. based on UnitPeriod to first argument (DateExpression).

+,- Operators are allowed on date types. + would add number of days to the given date and return next date while - would show previous date. 
MAX and MIN return minimum and maximum of two dates.

NOW returns current date and time. It either returns date or formatted date string.

TO_DATE("03.07.2007:19:01:00","DD.MM.YYYY:HH:MN:SS") would return the date 3 July 2007 with time stamp 19:01:00
TO_DATE("03.07.2007","DD.MM.YYYY") would return the date 3 July 2007 with current system time stamp
TO_DATE("07.2007","MM.YYYY") would take current system day return the date System Day July 2007 with current system time stamp

GET_INTERVALS([12/01/2008,13/11/2008],"DD/MM/YYYY","Day") would return 306 days.

Suppose Date D1 is 03.07.2007:19:14:23 
GET_DATE(D1,"HH:MN") would return 19:14

Suppose system date is 03.07.2007:19:14:23 
NOW("DD-HH:MM") would return 03-19:14

ADD_TO_DATE(D1,Hour,10) would return 04.07.2007:05:08:23
ADD_TO_DATE(D1,Day,1) would return 04.07.2007:19:14:23

DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:10:56:00",Hour) would return 10
DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:10:56:00",HourTotal) would return 34.27
where fraction .27 represents 16 is .27 (fraction)  of 60.
DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:10:56:00",HourMinute)
would return 10.16 where 16 represents minutes

DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:10:56:00",Day) would return 1
DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:12:40:00",DayTotal) would return 1.5 where .5 represents 12 hours out of 24 hours
DATE_DIFF("_01/01/2006:00:40:00","_02/01/2006:12:40:00",DayHour) would return 1.12 where 12 represents 12 hours


NOW("DD-MM-YYYY") would return current formatted date

NOW(Date)  would return current date.

Conversion functions Main
C_NUMBER(Expression)

C_REAL(Expression)

C_TEXT(Expression)

C_LIST(Expression)

C_TREND(Expression)

C_MATRIX(Expression)

C_BOOLEAN(Expression)

EXECUTE_EXP(Expression)

GET_MAT(Matrix)

GET_LIST(Compound)

GET_TREND(Trend)

GET_DATE(Date,FormatText)

CONVERT(FromExpression, Type)

Convert the data type to respective data types.
C_NUMBER converts expression (text/double) into integer

C_REAL converts expression (text/integer) into double

C_TEXT converts expression into Text.

C_LIST converts expression (Text/Trend) into compound list

C_TREND converts expression (Text/List/Matrix) into compound list. If matrix expression then first column is converted into trend, if matrix contains only single row, then row is converted into trend.

EXECUTE_EXP executes the expression and always returns boolean true value.

C_BOOLEAN converts expression in true or false. if expression is text then TRUE or YES values would be converted into true otherwise false, etc. Similarly non zero is converted into true.

C_MATRIX converts expression (Text/Trend) into compound list

GET_MAT, GET_LIST, etc. convert correponding expressions into text.

CONVERT converts expression to other data type or into SET/Char Set

C_NUMBER(GET_AT([A,12,34],2)) would always return number.

C_NUMBER(122.34) would return 122

C_LIST (|1 2 3 4|) would return [1,2,3,4]

C_TREND ([1,2,3,4]) would return |1 2 3 4|

C_TREND ({1,2,3,4}) would return |1 2 3 4|

C_TREND ({1 5,2 4,3 9,4 7}) would return |1 2 3 4|

C_TREND ({1 2 3 4}) would return |1 2 3 4|

CONVERT([A,B,C,D],Text) would return text [A,B,C,D]

CONVERT([A,B,C,D],DB_CharSet) converts into ('A','B','C','D')

CONVERT([1,2,3,4],DB_Set) converts into (1,2,3,4)

C_BOOLEAN(Yes) would return true

Report Functions Main
SHOW_REPORT(ReportType,GoalVar,Options) Shows the report in popup window at run-time. The report types are: SQL, CaseMatching, Session and XML.  

Report Types

1. SQL
2. Session 
3. CaseMatching
4. XML
5. HTML
6. Document
Default is Normal

if GoalVariable Type is XML then report type is assigned as XML 
if GoalVariable Type is HTML or Text then report type is assigned as 
Report 

SQL
If report type is SQL and VariableType is report/goal then report ID (report) linked to goal/report variable is used as HTML to transform output. If  report_ID is not linked then default report template (is available in SystemFiles directory as report_trailor.htm) is used. If heading is set in report heading for variable then heading is displayed otherwise default heading is displayed.

CaseMatching
If  report type is CaseMatching and VariableType is Goal then CBR Report ID of Goal variable is used as HTML to transform output. If CBR Report ID is not linked) then default report template is used. CBR Heading can be set to display the report title.

Session
If report type is Session then if Variable is Report/Goal then Report ID of that variable is used to transform output otherwise default Session Report is used. 

XML

If report type is XML (used when data stored in database is in XML 
format itself e.g. session data) then displays the HTML results 

HTML
if report type is HTML (used when data stored in database is in HTML 
format itself) then displays the results

Document
In case of Document type, the document is retrieved from database and displayed. When defining a query to retrieve document, two fields can be specified first field contains data and second field contains content type. If contentType is not stored in database, DocType attribute in URL can be used.

To be used as Option=Value pair separated by &

Type=SQL| Session|CaseMatching|XML|HTML|Document

ReportTitle=
Your Report Title

ReportID=
ID of Report. Corresponding report file would be used to transform output

GoalVar=Name of the Goal/Report variable

SystemType
:CBR|ANN_TRAINING|ANN_TESTING. Can be used to view datasets (queries connected to different interfaces). For example, data connected to a query for CBR search can be shown.

QueryID|SystemID|CBRID=System ID/Query ID of queries linked to Goal/Report variable. System ID can be expert system ID, CBR ID or neural network ID. Default value is taken as ES

Filter=This filter would be applied to query linked to Goal/Report. Variable values are populated at run time from Session.

Template=Template file name to wrap report. It must have <-- INSERT HERE--> tag.

ShowOnlyOutput=Yes|No (default: No). This displays only output report skips template etc.

Layout=Vertical|Horizontal: Default is Horizontal (means each row is displayed on single line). Vertical format displays each row in label format.

VColumns
=No.Of.Columns.  Applicable when layout is Vertical. It shows the number of columns.

OKButton=Yes|No (Default: No): displays (OK) continue session button on the report

BackButton=Yes|No (Default: No): displays back button on the report

FileName= File name of the report.  It is advised use the report file name that is generated through Report Designer

Session=[List of Variables]. Populates the session data for each row.

ListVar=Variable Name|Asked. Name of the variable that contains list of columns to be displayed in report. It must be compound variable. The values (variable names) may contain variable group name or without group names. If ListVar=Asked is used then report will display all variables whose values have been entered by the user in sequence of entering inputs. 

UsePrompt=Yes. (Default: No) Displays prompts for input variables instead of variable titles in the report.

DocType=images/jpeg|application/msword etc. Document format type required browser to display document content. Applicable in case ReportType is Document

RuleFilterID=output of rule filter ID displayed using this option. Report type must be SQL when this option is used.

SHOW_REPORT(CaseMatching, Tour.Search," ")
SHOW_REPORT(CaseMatching,"CreditRating.Credit Status","")
Will run CBR Schema linked to Goal variable CreditRating.Credit Status 
and show results with case matching template linked to 
CreditRating.Credit Status

SHOW_REPORT(CaseMatching,"CreditRating.Case 
Status","SystemID=CreditRating.Case 1&FileName=Case1.htm")
Will run CBR Schema CreditRating.Case 1 and show results with case 
matching template: Case1.htm

SHOW_REPORT(Session," "," ")
Will show session report

SHOW_REPORT(Session,"","FileName=CreditRating.Report1")
Will show session report using template CreditRating.Report1


SHOW_REPORT(SQL,"CreditRating.AccountDetails","FileName=CreditRating.AcctDetails")
will show result returned by queries (default ES) connected to 
CreditRating.AccountDetails using template CreditRating.AcctDetails

SHOW_REPORT(SQL,"CreditRating.AccountDetails","QueryID=AccountDetails&FileName=CreditRating.AcctDetails")
will show result returned by queries (where query ID=AccountDetails) 
connected to CreditRating.AccountDetails using template 
CreditRating.AcctDetails


SHOW_REPORT(SQL,"CreditRating.AccountDetails","QueryID=AccountDetails&FileName=CreditRating.AcctDetails&Filter=AccountType='SB'")
will show result returned by queries (where query ID=AccountDetails 
using filter AccountType=SB) connected to CreditRating.AccountDetails 
using template CreditRating.AcctDetails

Invoking report through direct URL

reports can be shown by directly invoking URL 
ShowReport.aspx?Type=ReportType&GoalVar=VariableName&...

eg
ShowReport(CaseMatching,"CreditRating.Case 
Status","SystemID=CreditRating.Case 1&FileName=Case1.htm")
can be invoked using
<br>ShowReport.aspx?Type=CaseMatching&GoalVar=CreditRating.CaseStatus&SystemID=CreditRating.Case 
1&FileName=Case1.htm

ShowReport.aspx?Type=Document&GoalVar=Customer.Details&QueryID=Photo&Filter=CustomerID=10
will show photo ID of person whose CustomerID is 10. You can include this in ViewURL of variable say Customer.Photo so that photo
 would be displayed

ShowReport.aspx? Type=SQL& GoalVar=LaptopAdvisor.Final_Goal& SystemType=CBR& QueryID=LaptopAdvisor.Case
will show query result of query connected to Goal Variable:LaptopAdvisor.Final_Goal, for CBR and SystemID is LaptopAdvisor.Case

ShowReport.aspx?Type=SQL&GoalVar=LaptopAdvisor.Final_Goal&Session=[LaptopAdvisor.Price]
will send value of session variable LaptopAdvisor.Price and will appear for every row when result is displayed. This is applicable when for each row some calculations are to be done based on session variable. For example, you may offer price discount on laptop based on price user has entered.

<br>ShowReport.aspx?Type=XML&GoalVar=CreditRating.CaseStatus&SystemID=CreditRating.Case 
1&FileName=Case1.htm

LaptopAdvisor.ShowVars:=[ConfigurationID, RAM, Solution_Matching]

ShowReport.aspx?Type=SQL&GoalVar=LaptopAdvisor.Final_Goal&ListVar=LaptopAdvisor.ShowVars
will show only ConfigurationID, RAM, Solution_Matching columns in report.

CBR Functions Main
INIT_CBR(CBRID)

SET_CBR(CBROption,Feature/Option,Expresssion)

GET_CBR(CBROption,Feature)

GET_SIMILAR_VALUES(CBR_ID, Feature, Expression)

UNIQUE_SOLUTION(
Compound_Key1,
Key_Expression2,
Key_Expression3)

UNIFY_SOLUTION(Key_List,Prev_KeyList,PrevMatching)

CREATE_CLUSTERS(DynQuery_ID,CutOff)

SPLIT_SOLUTION(DBID_Text,
[Source_Table,Key_Field,Sim_Field,Match_Field],
[Dest_Table,Key_Field,Sim_Field,Match_Field])

INIT_CBR To initialise CBR session schema to application schema. If the CBR ID is same as that of CBR ID of session schema, session schema is not initialised.

SET_CBR sets various values like weight, cutoff, etc. for various feature session schema. 

MaxLevelCases: sets number of level cases to be retrieved at the level set of feature. The third argument is number of cases.

MaxIndexCases: sets number of index cases to be retrieved at the value of feature. The third argument is number of cases.

MaxDBCases: sets number of database cases to be retrieved from database at the level set of feature. The third argument is number of cases.

MaxCases: sets maximum cases to be retrieved. It is global number of cases.

MaxIndexes: sets maximum neighboring (similar values) indexes to be considered while hopping across same level in taxonomy.

Weight: sets the weight of a feature

CutOff: sets the cutoff of a feature

SimilarityMeasure: sets the similarity function for selected feature

SimilarityMeasure_MultiValued: sets the multi-valued similarity function for selected feature

GlobalCutoff: sets global cutoff to show cases above cutoff

GlobalCriteriaCutoff: sets criteria cutoff to show cases above cutoff

MaxUnifiedCases: sets maximum cases to be retrieved after executing UNIFY_SOLUTION function

All: sets five parameters weight, cutoff, IndexCases, LevelCases and DBCases for a feature

SessionWeightsToVars: Stores session weights of features into variables. The third parameter expression contains prefix

SessionCutoffsToVars: same as above except cutoffs are stored instead weights

VarWeightsToSession: it restores back variables values into session weights. The second parameter has list of variable names (without group) enclosed in [] bracket. The third parameter expression contains prefix. The key variables which are not listed in the variable list are set to 0.

VarCutoffsToSession: same as above except applied for cutoff instead of weight

RestoreSession: restore session with application default values. Second parameter contains which options of features to restore like Weight, Cutoff, MaxIndexCases etc. All sets all options to application default. Third argument is ignored.

ResetFeatureVars: resets all or selected features (problem case) of selected to null. Useful in case, problem case is brought from database using FETCH_CURSOR


GET_CBR returns values corresponding to option and feature selected.

GET_SIMILAR_VALUES returns values similar to the expression (of feature) from the similarity table. The order is most similar first to least similar last.

UNIQUE_SOLUTION: When CBR is run in batch mode (with YES option), sometimes cases are replicated with different % matching. Duplicate cases can be removed using UNIQUE_SOLUTION. Upto two key compound variables are allowed which would be checked for uniqueness.

UNIFY_SOLUTION: Previous results (may be retrieved from database) of CBR can be merged with new results. Compound_Keys: is the current key list in which case IDs are stored. Compound_PrevKeys and PrevMatching are the previous case IDs and matching percentages respectively. It modifies the Compoun_Keys and 

CREATE_CLUSTERS creates cluster of similar cases based on cutOff. Dynamic query must be connected to clustering type containing required fields in specific format. Number of clusters created is function of cutOff selected. Less cutoff means less clusters (worst case only one cluster), more cutoff would create more clusters (worst case equal to number of cases).

SPLIT_SOLUTION splits horizontal similarIDs and matching into vertical fashion. Source table contains data key, similar keys [C1,C2,...] and matching |C1%, C2%,...| and destination table has rows containing key and similar ID and % etc.

SET_CBR(MaxLevelCases,"MovieMart.L2",5)
Will set number of level cases to 5. The level will be taken from level of feature MovieMart.L2  

SET_CBR(MaxIndexCases,"MovieMart.L2",15)
Will set number of index cases to 15. The index will be value of feature MovieMart.L2  

SET_CBR(MaxDBCases,"MovieMart.L2",50)
Will set number of cases to be retrieved from DB at level to 15. The level will be value of level of feature MovieMart.L2  

SET_CBR(MaxCases,"",25)
Sets maximum cases to be retrieved to25

SET_CBR(Weight,"MovieMart.L2",12.0)
Will set weight of feature MovieMart.L2 to 12.0

SET_CBR(Cutoff,"MovieMart.L2",50.0)
Will set cutoff of feature MovieMart.L2 to 12.0

SET_CBR(MaxIndexes,"MovieMart.L3",2)
will add most top 2 matching similar values as indexes. e.g. if current value of MovieMart.L2 is Bollywood Action and similar values are [Hollywood Action(0.8), Bond 007 (0.7), Bollywood Classic(0.6), Bollywood Drama(0.5)..] only Hollywood Action and Bond 007 would be considered as indexes for searching cases.

SET_CBR(SimilarityMeasure,"MovieMart.L2",Symbolic)
Will set similarity function Symbolic to compare values of feature MovieMart.L2

SET_CBR(SimilarityMeasure_MultiValued,"MovieMart.Keywords",Any)
Will set multi-valued similarity function Any to compare values of feature MovieMart.Keywords

SET_CBR(GlobalCutoff,"",25)
Will retrieve only cases that match more than or equal to 25%

SET_CBR(GlobalCriteriaCutoff,"",25)
Will retrieve only cases that have criteria match more than or equal to 25%

SET_CBR(All,"MovieMart.L2",[12,5,10,25,100])     [Weight,Cutoff,MxIndexCases,MxLevelCases,MxDBCases]
Will set weight to 12, cutoff to 5, MaxIndexCases to 10, MaxLevelCases to 25 and MaxDBCases to 100
of feature MovieMart.L2

SET_CBR(SessionWeightsToVars,"ALL","Wt_")
Will move session weights of key variables into variables with same names as key variables prefixed with "Wt_".
e.g. if  key variables are Group.Price, Group.Company and Group.OperatingSystem. Their weights would be moved into variables Group.Cutoff_Price,Group.Cutoff_Company and Group.Cutoff_OperatingSystem" respectively where Group is group of
variable.

SET_CBR(SessionCutoffsToVars,"ALL","Cutoff_")

SET_CBR(VarWeightsToSession,[Price,Company,OperatingSystem],"Wt_")
Will set session weights of key variables Group.Price, Group.Company and Group.OperatingSystem to values of 
variables Group.Wt_Price, Group.Wt_Company and Group.Wt_OperatingSystem where Group is group of
variable. All key parameters other than Group.Price, Group.Company and Group.OperatingSystem will be set to 0

SET_CBR(RestoreSession,[Weight,Cutoff]," ")

SET_CBR(ResetFeatureVars,[MovieMart.L1,MovieMart.L2]," ") resets variables MovieMart.L1 and MovieMart.L2 to null

SET_CBR(ResetFeatureVars,All," ") resets all variables  to null

GET_SIMILAR_VALUES(MovieMart.Case,"MovieMart.L3",Bollywood Action)  would return values similar to Bollywood Action

UNIQUE_SOLUTION(MovieMart.NextPushID,MovieMart.NextPushHID," ") would combine batch CBR solutions using MovieMart.NextPushID and MovieMart.NextPushHID compound variables (these must be unique and defined as solution features in CBR)

Key_List := [A,B,C,D,E,F]
PreKey_List := [A,P,K,R,C,D]
SystemInterface.Solution_Matching := |95.3 90 80 50 40 50|
CBR_Matching := |96 45 34 56 30 20|

UNIFY_SOLUTION(Key_List, PrevKey_List, CBR_Matching): The previous result [A,P,K,R,C,D] would be merged with current result [A,B,C,D,E,F] taking only higher values based on % matching. Result will affect both Key_List and SystemInterface.Solution_Matching. The output of this would be

Key_List: [A,B,C,R,F,D,P,E,K] and SystemInterface.Solution_Matching: |96 90 80 56 50 50 45 40 34|
The number of cases to be retrieved from unification is subject to MaxUnifiedCases parameter


CREATE_CLUSTERS(LaptopAdvisor.SimilarLaptops, 95.5) would create the clusters using dataset connected to DynamicQuery: Laptop Advisor.SimilarLaptops and using cutOff 95.5. Cluster no. are created in field Cluster_No.

SPLIT_SOLUTION(MobileSearch,[Mobile,ModelID,SimilarMobiles,Matching], [SimilarMobile,MobileID,SimilarModelID,Match]
will split fields SimilarMobiles (of compound type [ID1,ID2,...]) and Matching (of trend type |ID1_matching ID2_Matching...] of  table Mobile into rows of table SimilarMobile with fields split into SimilarMobileID and Matching.

Table 
Mobile:

MobileID: key field

ModelID SimilarMobiles Matching
1 [10,20,15,30,19] |99.9 90 87 85 80|

after split: DataTypes of ModelID,MobileID and SimilarModelID must be same.

Table
Similar Mobile
MobileID: Key field

MobileID SimilarModelID Match
1 10 99.9
2 20 90
3 15 87
4 30 85
5 19 80
Session Functions Main
ADD_SESSION(Text)

LOAD_SESSION(GoalVar)

SAVE_SESSION(GoalVar)

GET_SESSION(" ")

RESTORE_SESSION(Expression)

CLEAR_SESSION(" ")

GET_VARS(Asked)

ADD_SESSION: adds session details in Session Table of core database. The Session table must have UserID, Name and Value fields. The constant parameter TrackSessionDetails must be on otherwise session is not added.

SAVE_SESSION saves session to table LastUserSession of Core DB.

LOAD_SESSION loads session from LastUserSession table of Core DB

GET_SESSION returns the current session

RESTORE_SESSION restores session values from text

CLEAR_SESSION clears the current session

GET_VARS(Asked) returns names of input variables asked and entered by the user in order of asking

 
Lookup table functions Main
GET_CATEGORY|GET_LOOKUP(CategoryID,
"VariableID/s[All]",
KeyValue/s)

POPULATE_CATEGORY|
POPULATE_LOOKUP(CategoryID,KeyValue)


See also Lookup Table
Lookup table maintains list of values which can be retrieved by a key.

GET_CATEGORY returns value/set of values from lookup table of specified column/s (VariableName/s) matching with value (KeyValue/s). If All is specified in second argument then it returns result in the last [ColValue1,ColValue2,...ColValuen] where ColValue1 is value corresponding to Column1, etc. If keyvalues are specified as list then it returns multiple lists in the format: [CV11,CV12,..|CV21,CV22,...]
where CVij is value of columnj corresponding to ith key value.

POPULATE_CATEGORY populates values into session instead of returning.
GET_CATEGORY(Customer.EducationDetails,"Customer.LevelOfEducation","M.B.A.") would return [Post Gradudate] corresponding to degree "M.B.A."

GET_CATEGORY(Customer.EducationDetails,"Customer.LevelOfEducation",[M.B.A.,B.Tech.]) would return [Post Graduate, Graduate] corresponding to degrees M.B.A. and B.Tech.

GET_CATEGORY(Customer.EducationDetails,All,"M.B.A.") would return [Post Graduate,Management]  corresponding to degree "M.B.A."

GET_CATEGORY(Customer.EducationDetails,All,[M.B.A.,B.Tech.]) would return [Post Graduate,Management|Graudate, Technology]  corresponding to degrees M.B.A. and B.Tech

Other Functions: GOTO, Conditional etc. Main
CHANGE_RULE(ExpressionNo,PostFixTokenNo,Expression)

START_SEGMENT Segment Name

GOTO_SEGMENT(BooleanExpression,SegmentName)

GET_EXPRESSION_NO(SegmentName)

IF_THEN_ELSE(BooleanExpression, Expression1,Expression2)

COMMENT: Text_Comment

HASH(Expression,YES/NO)

CALL_UDF(FunctionName,[ArgumentList])

EXIT_WHEN(ConditionExpression)

 

 

START_WHILE(ConditionalExpression,WhileLabelID)
...
END_WHILE WhileLabelID
 


START_SWITCH(Expression,SwitchLabelID)
         CASE Value_1
         ....
         BREAK SwitchLabelID

         CASE Value_2
         ....
         BREAK SwitchLabelID
         ...

         CASE Default
         ...
END_SWITCH SwitchLabelID
 

 


 

 


CHANGE_RULE is advised for advanced users only. It modifies rules at run-time. It changes token at position specified in PostFixTokenNo by Expression

START_SEGMENT used for logical grouping of code. It is some sort of label to segment of expert system code.

GOTO_SEGMENT expert system jumps to the expression where Segment Name is appearing and starts executing subsequent expressions if BooleanExpression is true otherwise it continues with next expression.

GET_EXPRESSION_NO returns expression no of segment

IF_THEN_ELSE returns either expression1 or expression2 depending upon value of BooleanExpression. If BooleanExpression is true then it returns expression1 otherwise expression2.

COMMENT: Comments are used for commenting out in rules.

HASH creates a message digest (hash) for given text_expression. If NO option is selected, challenge is not added.

CALL_UDF calls user defined function with arguments in list

EXIT_WHEN|EXIT_RULE exits the if part of rule if condition is true otherwise continues with next expression.

START_WHILE is similar to typical programming construct used to execute group of code (statements) till specified condition is true. All statements between START_WHILE and END_WHILE are executed till condition is true. In order to safe-gaurd system from falling in infinite-loop, the number of iterations are restricted to parameter set in ConstantParameters: default is 10000 iterations.

START_SWITCH is similar to a case statement in programming language. Based on value of expression (only text, boolean, real and number data types are allowed), corresponding statements between CASE...BREAK are executed. Multiple CASE values can be used to execute common common set of statements

Int_X:=1
START_SEGMENT Loop_Next
GOTO_SEGMENT(Int_X>10,Loop_Exit)
...

Int_X:=Int_X+1
GOTO_SEGMENT(true, Loop_Next)
 START_SEGMENT Loop_Exit
...
the above code between Loop_Next till Int_X:=Int_X+1 would be executed 10 times. Whenever Int_X>10 system would exit loop

Exam.NextQuestion="Exam.Q2"
CHANGE_RULE(GET_EXPRESSION_NO(Change_Rules)+1,1,Exam.NextQuestion)
START_SEGMENT Change_Rules
ASK(Exam.Q1)
...
the above code would replace Exam.Q1 in ASK(Exam.Q1) with value of Exam.NextQuestion (that is Exam.Q2)

Simulation of Case Statement using combinations of GOTO_SEGMENT and START_SEGMENT

GOTO_SEGMENT(Var=Value1,Case1)
GOTO_SEGMENT(Var=Value2,Case1)
...
GOTO_SEGMENT(Var=Value4,CaseN)
GOTO_SEGMEN(true, Case_Exit)

START_SEGMENT Case1
...
GOTO_SEGMEN(true, Case_Exit)
START_SEGMENT Case2
...
GOTO_SEGMEN(true, Case_Exit)
...
START_SEGMENT CaseN
...
START_SEGMENT Case_Exit


CALL_UDF(Sqr,[10]) would call function like Sqr(10) where Sqr us user defined function

CALL_UDF(Sqr,[Int_X]) would call function  Max(Int_X).

CALL_UDF(Max,[30,40]) would call function like Max(30,40)

Int_X:=10
AND Counter:=1
AND Sum := 0
AND START_WHILE(Counter<=Int_X,AddNumbers)
AND     Sum := Sum + Counter
AND     Counter := Counter + 1
AND END_WHILE AddNumbers


AND START_SWITCH(Int_X,ConvertWord)
AND       CASE 1
AND                 RETURN ONE
AND       BREAK ConvertWord
AND       CASE 2
AND       CASE 2.1
AND                 RETURN TWO
AND       BREAK ConvertWord
...
AND  END_SWITCH ConvertWord
 

if then else using SWITCH

AND START_SWITCH(Int_X<0,Sign)
AND       CASE True
AND                 RETURN NEGATIVE
AND       BREAK Sign
AND       CASE False
AND                 RETURN POSITIVE
AND       BREAK Sign
AND  END_SWITCH Sign

 

 

Main