XpoLog help - Add New Computation Function.
 

XpoLog's computation aggregation report enables you to activate functions like min, max, sum etc. on log's columns.
There is a number of predefined computation functions to use. XpoLog also allows you to add new functions manually.


Predefined Computation Functions:


  Predefined Functions:

name

description function signature

format

formats decimal number. Default format is #.##. 

format (n) - returns the decimal number n in the format '#.##'.
format (n,f) - returns the decimal number n in format f.
number

parses string to number (double).

number (s) - parses the string v as a double.

timeformat

formats a number as date/time string. Default time format is
"MM/dd/yyyy HH:mm:ss.SSS". 

timeformat (n,f) - formats the double value n to the date/string f
mapput

puts a key/value pain in a map. if the given map was not declared prior to this function, then this function creates it.
Note: the function returns the result map.

mapput (m,k,v) - returns the new map m after putting the value v using the key k.
mapput(m,m2) - returns the new map m after putting the map m2 in it.

mapget returns a value from a map using a key. mapget (m,k) - returns the value in m to which the key k is mapped.
mapKeys returns all the map's keys. mapkeys (m) - returns all the keys of map m.
MapValues returns all the map's values. mapvalues (m) - returns all the values of map m.
MapRemove

removes a mapping from a map using a key

mapremove (m,k) - removes from the map m the mapping for key k, if present.
ListGet returns the element in a list at a specified position listget (l,i) - returns the element at position i in list l.
ListSize returns the number of elements in a list listsize (l) - returns the number of elements in list l.
IndexOf  returns the index within a string of the first occurrence of a specified substring

indexof (s,s1) - returns the index within string s of the first occurrence of the substring s1.
indexof (s,s1,caseSensitive) - returns the index within string s of the first occurrence of the substring s1. if caseSensitive is false, then the matching of the first occurrence is done regardless of the case of the specified substring

Regexp   returns the matched substring of a string according to a given regular expression

regexp (s,re) - returns the first occurrence of a substring within string s that matches the regular expression re. If no substring is found, then a NULL is returned.
regexp (s,re,defValue) - returns the first occurrence of a substring within string s that matches the regular expression re. If no substring is found, then the value defValue is returned.
regexp (s,re,defValue,g) -
returns the first occurrence of a substring within string s that matches the regular expression re and captured by the the group g. If no substring is found, then the value defValue is returned.
regexp (s,re,defValue,g,doFind) -
returns the first occurrence of a substring within string s that matches the regular expression re and captured by the the group g. If doFind is false then the whole string s if inspected for matching of the regular expression re .If no substring is found, then the value defValue is returned. 

 

 

   Predefined Aggregation Functions:

name

description function signature

aggAvg

returns the aggregated average value of a parameter.

aggAvg (p) - returns the aggregated average value of given parameter p.
aggAvg (p,s) - returns the aggregated average value of given parameter
p while c is a given counter
for dividing p.

aggSum

returns the aggregated sum value of a parameter. aggSum (p) - returns the aggregated sum value of given parameter p.

aggMax

returns the aggregated max value of a parameter. aggMax (p) - returns the aggregated max value of of given parameter p.
aggMin returns the aggregated min value of a parameter. aggMin (p) - returns the aggregated min value of given parameter p.
mapAggAvg returns aggregated avg map mapAggAvg  (k,v) - returns map that each value v is aggregated avg result
for given key k.
mapAggSum  returns aggregated sum map mapAggSum  (k,v) - returns map that each value v is aggregated sum result for given key k.
mapAggMax return aggregated max map mapAggMax  (k,v) - returns map that each value v is aggregated max result
for given key k.
mapAggMin return aggregated min map mapAggMin  (k,v) - returns map that each value v is aggregated min result
for given key k.

 

   Predefined Basic Functions:

  •    random - A random value from 0 to 1.
  •    strlen - Compute the length of a string.
  •    sqrt - Square root .
  •    avg - The average of the arguments.
  •    cos - Cosine with a radian argument.
  •    acos - Arc cosine with a radian argument.
  •    asin - Arc sine with a radian argument.
  •    atan - Arc tan with a radian argument.
  •    exp - Compute the euler's number e raised to the power of the argument.
  •    floor - the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical   integer.
  •    int - Convert the double argument to integer.
  •    logn - Natural logarithm in n base : logn( BASE, VAL).
  •    log 10 - Natural logarithm in 10 base.
  •    log - Natural logarithm in e base.
  •    pow - The first argument power the second one.
  •    prod - The product of the arguments.
  •    round - The closest long to the argument.
  •    sin - Sine with a radian argument.
  •    tan - tan with a radian argument.
  •    degTorad - Convert angle from degrees to radians.
  •    radTodeg - Convert angle from radians to degrees.

 

 

    Add New (or edit) Computation Functions: 

     In order to add a new (or edit an existing) Computation function: 

     1) Select 'Add new function' from 'Log Computation Aggregation's page or select the 'edit' link to edit an existing function.

     2) Enter the function's name in the 'Name' text box.

     3) In case you want to view the result as a graph over time leave the 'Show result over time' checkbox selected. In case you just want to view
         a summery of the results, uncheck it. 

     4) In the 'Function' text area enter your function. The following table summarizes XpoLog's function language:

        Note : In order to use a column name as part of your function's language use the column's key name - the key inside the brackets
                  (This key name is only for the function usage).

 

Type

Operator

Example

Numerical Operator

+-*/:basic operators
% : Modulo operator
^ : Power operator

(-1 + 50*2 ) / ( 2^4 )
Boolean operators ~, xor : operators
&&, and : And operators
||, or : Or operators
!, not : Not operators
< : less operator
> : great operator
<= : less or equal operator
>= : great or equal operator
==, equals : equal operators
!=, <> : not equal operators
!(A && (B < 10))  |  NOT ( A XOR ( B equals C ) )
A != 2 || B > 2
"string1" == "string2"
A or B
A or ( B <> C )
String operators == : 2 strings equals
!= : 2 strings not equals
<> : 2 strings not equals
< : The first string less lexically than
the second one
> : The first string great lexically than
the second one
<= :The first string less or equals lexically than
the second one
>= : The first string great or equals lexically than
the second one
+ : Concat string
"string1" == "string2"  : false
"string1" + "a" : "string1a"
"abc" > "aaa" : true
"zyx" < "bcd" : false
List operators
+ : Concat two lists
- : Substract a list to another one
in : Test if an element is inside a list
(1,2)+(3,4) = (1,2,3,4)
(1,2) + 3 = (1,2,3)
3+(1,2)=(1,2,3)
(1,2,3,4)-(3,4)=(1,2)
(1,2,3,4)-3=(1,2,4)
2 in (1,2,3)=true
4 in (1,2,3)=false
Other operators
= : set a variable operator
[] : absolute value
² : power 2 operator
% : Percent operators
A = [ 2 - A ] * 2

10%=0.1
Conditional operators if then
if then else
if ( A > 2 ) then ("Ok")
if ( A <=2 ) THEN (B=3) else (B=4)

Predefined functions As described above  

          

       5) In the 'result type' list box select the type of your function's result. It can be list, map, time or other (string or number).

       6) In case 'Show result over time' is checked, you can enter the graph axis (Y) name. Enter your axis value in 'Graph
            Axis Name' text box. Results with the same graph axis value will be displayed in the same graph. Otherwise different graphs will be shown for each result.

       7) The 'Result Properties' text box allows you change view default properties:
            'headerNames' - in case the result type is a list or map you can set new 'key/value' properties.
            'sortby' - sort the result by your comparator .
            'sortascend' - a boolean value that determines whether sorting is done in ascending or descending order.
             Example : headerNames=Column1;Column2;Column3 , sortBy=Column1 , sortAscend=true.

 


Additional links
     Reports help