|
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 |
| 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 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
UNIQUE returns list of unique values from list |
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|
RELATIVE_WEIGHTS_MULTIVALUED([A,B|C,D|E|B,F],|10 5 1 15|,|0.5 1 1 0.5|) | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 <> Expression2 Expression1 > Expression2 Expression1>=Expression2 Bool_Expression1 AND Bool_Expression2:Boolean IF_THEN_ELSE(Condition, Expression1, Expression2) |
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 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
Option:
|
City Menu
Suppose Customer.City is set to Mumbai. GET_CODE
(Customer.City) would return the code of the city
Mumbai. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| SQL functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
SQL_FILTER(Expression)
|
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. 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. 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. |
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. | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Range List Conversion Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PROFILE_OF(Expression,RangeID) |
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.
|
Age Status Range List
PROFILE_OF(20,Age Status) would return Very Young . Households Range List
SCORE_OF(Car, Households) would return 5.
SCORE_OF([Car,AC], Households) would return
8. Income Range List
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| Variable functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ASK(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. 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. |
ASK Customer.Age
RESET("Customer.Age") SET_VAR_VALUE("Customer.Age", 30) Str_X:="Exam.Marks"
GET_VAR_VALUE(Str_X) would return 12.34 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Text/String functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
SUBSTRING( REPLACE( SPACE(Number_Expression2) |
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. REPLACE: Returns the text by replacing the TextToBeReplaced by
ReplacementText 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. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Trend functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
AMD(Trend) R_SQUARE(Trend) CORRELATION(Trend) GROWTH(Trend) GET_AT(Trend,Pos) |
These functions
work on trend. Count, Lowest, Min, Highest, Max, Sum, Average, Mean, Avg, StdDev,
AbsMeanDev, IncreaseIn, Co_Coefficient, AvgGrowth, All |
Trend Var:=|10 20 15 50 24|; AMD(Trend Var) would return 1.2. HIGHEST(Trend Var) would return 50 STAT(Trend Var) returns |5 10 50 119 23.8 15.56 0.54 0.59| | |||||||||||||||||||||||||||||||||||||||||||||||||||
| Math functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MAX(Value1,Value2) ABS(doubleExpression) SQRT(doubleExpression) LOG10(doubleExpression) LOG(doubleExpression,base) FLOOR(doubleExpression) CEILING(doubleExpression) |
Common math operations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Graph functions Main | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
SET_GRAPH_OPTION( |
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) SAVE_MATRIX(Matrix,[XML|TEXT],[Column
Delimiters, Row Delimiters]) |
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_INTERVALS(DateCompound_Expression1,DateFormat,Day|Hour|Minute) TO_DATE(StringDate,DateFormatText) 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 +,- Operators
are allowed on date types. + would add number of days to the given date
and return next date while - would show previous date. |
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 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 ADD_TO_DATE(D1,Hour,10) would return 04.07.2007:05:08:23 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) |
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] | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
GoalVar=Name of the Goal/Report
variable 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 Layout=Vertical|Horizontal: Default is Horizontal (means each
row is displayed on single line). Vertical format displays each row in
label format. FileName= File name of the report. It is advised use the
report file name that is generated through Report
Designer
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. DocType=images/jpeg|application/msword etc. Document format type
required browser to display document content. Applicable in case
ReportType is Document |
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 ShowReport.aspx?Type=SQL&GoalVar=LaptopAdvisor.Final_Goal&Session=[LaptopAdvisor.Price] <br>ShowReport.aspx?Type=XML&GoalVar=CreditRating.CaseStatus&SystemID=CreditRating.Case LaptopAdvisor.ShowVars:=[ConfigurationID, RAM, Solution_Matching] | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
|
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) SET_CBR(Weight,"MovieMart.L2",12.0) SET_CBR(Cutoff,"MovieMart.L2",50.0) SET_CBR(GlobalCriteriaCutoff,"",25) SET_CBR(All,"MovieMart.L2",[12,5,10,25,100])
[Weight,Cutoff,MxIndexCases,MxLevelCases,MxDBCases] SET_CBR(RestoreSession,[Weight,Cutoff],"
") Key_List := [A,B,C,D,E,F]
after split: DataTypes of ModelID,MobileID and SimilarModelID
must be same.
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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)
CASE Value_2 CASE Default
|
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. |
Int_X:=1 Int_X:=Int_X+1 GOTO_SEGMENT(Var=Value1,Case1) CALL_UDF(Max,[30,40])
would call function like Max(30,40) Int_X:=10 if then else using SWITCH AND START_SWITCH(Int_X<0,Sign)
| |||||||||||||||||||||||||||||||||||||||||||||||||||