Object client calculations

There are basically 2 types of Calculations - Client and Server Calculations. Both types can be defined on Object and Sub-Grid levels.

Calculation editing

In Administration interface a Calculation is usually represented as a textarea. There is a possibiity to expand the calculation space by clicking on the three dots, the modal window is displayed. In the modal window you can add an ID of object line simply by doubleclick on them. When the idXXX in the calculation is selected the Name of an ObjectLine is displayed. From editing perspective, there are 2 special types (Server-String and Server-Math) which can contain SQL code and get MSSQL syntax highlighting support as well as simple SQL autocomplete feature (can be triggered by Ctrl+Space).

Object client calculation

Client calculations are executed directly on request form in user browser. In case there is client calculation it is immediately triggered when values that are part of client calculation change their values (action key down / up or value change in case of non-text controls). These calculations are executed in relational deterministic order based on definition so if calculation A is using field B that is used on field C then first it is calculation value B and after that the value A.

Client Delay & Calculation Confirmation

Client Delay provides a new feature that allows to set delay for calculation (in milliseconds). It is necessary to set delay to Object Line which has been calculated.
Example: Calculation Math id1234 + 100 = id656. If the delay for line1 is set, the delay will execute calculation after period of time.
Note:Default delay for calculation is 250ms.

Client Confirmation provides a new feature that is represented by green button next to the calculated Object Line. Client Confirmation must be set on the first line of calculation (same like Client Delay). If the button is clicked, the calculation is calculated.

The calculation is NOT executed automatically! User has to click on the button.

String Calculation

Calculations are allowed for object types: combo-box, combo-box with search, text-box and multi line text-box.

Syntax

  • Calculation type: Client-String
  • idXXX - link to object line
  • “text” - string text
  • idXXXr - used in combobox of any type will return the Name of a value

Operators

  • Concatenate of the strings:
    • idXXX + idYYY + “text”
    • idXXX and idYYY are ids of the object line
    • if you want to add some text then close the text into double quotes
  • Substring function
    • substring(idXXX, Y, Z)
    • idXXX is id of the object line
    • Y - starting position (starting from 1)
    • Z - length (starting from 1)
    • Example string calculations: id123 + id456 + “_text” + substring(id789,1,10)

Conditions

  • if (X) then (Y) else (Z)
    • X - Condition phrase
    • Y - Return Value 1
    • Z - Return Value 2
  • Example if (id55 like 'please') then (Yes) else (No)
  • Checkbox example if (id6123 ischecked) then (Yes) else (No)
  • Contains example if (id123 contains id456) then (Yes) else (No)

Math Calculation

Similar as client string calculation Xeelo has also client string calculation used to work with arimethic operations.

Syntax

  • idXXX - link to object line value

Operators

  • + - / * ( )
  • Example math calculations: (id123 + id456) * id76 + 2.34

Conditions

  • if (X) then (Y) else (Z)
  • X - Condition phrase
  • Y - Return Value 1
  • Z - Return Value 2
  • Example if (id55 > 10) then (100) else (200)

Client-DateAdd

Function returns new date value with added specified number of days, months or years.

Syntax

  • interval, idXXX,idYYY - example: day,idXXX,n
  • interval - date interval as text: day, month, year
  • idXXX - object line with the date
  • n - number of intervals to be add (supports negative values)
  • idYYY - object line with value to be added to the date

Examples:

  • day,id1557,1 - add one day
  • day,id1557,id1558 - add day according to value (number) in id1558
  • day,id1557,-3 - subtract three days
  • week,id1557,2 - add two weeks
  • year,id1557,-4 - subtract four years

Client-DateDiff

Function returns value - difference between two Dates in Xeelo format.

Syntax

  • interval,idXXX,idYYY - example: day,idXXX,idYYY
  • interval - date interval as text: day, month, year
  • idXXX - object line with first date
  • idYYY - object line with second date

Client Service calculation

This calculation can be used to calculate data with a web service (like ARES (CZ) ). Service needs to be integrated and properly set up in Xeelo.

Example of setting up ARES service that returns name

  1. Go to Admin/Object service
  2. Define name of object service
  3. Define URL link to the service - https://xeelo-service-001.azurewebsites.net/api/parse?query={@1}&field=Name
  • {@1} - parameter that represents object line which will be taken for service calculation
  • &field=Name - parameter of the service that returns specific value (in this case NAME)

Go to this page to see which values can be set: https://xeelo-service-001.azurewebsites.net/api/parse?query=

For every value (Name, Street, ZIP code etc.) a separate service needs to be set in Xeelo

Syntax and supported functions:

  • Calculation type: Client-Service
  • Calculation: idXXX - link to object line which will initiate the service calculation (in ARES - Identification number of a person/organization)
  • Service: Service - service that is currently set in Xeelo
  • It is essential to set “calculation delay” or “calculation confirm” for this calculation so the service would work smoothly.

User writes the identification number of a person/organization but client calculations work immediately when a value is populated. Nevertheless there can be time delays between the characters that are being written. Either calculation confirm or delay should solve this. As long as data are being loaded, recalculating overlay is displayed.

Example:

  1. Set the calculation delay or calculation confirm on an object line where the calculation will be calculated (in our case - ICO (ID of a person/organization) )

  1. On other lines set the calculation “client-service” like it is described above (don’t forget to choose the right object service). For example to calculate Name of a person/organization through this service.

  1. When a new request is being created, detail of this calculation should look like this:

Try limit the number of client calculations at minimum. In case of high number and complex calculations it can slow down the response of the client browser as all is executed on client hardware.


1 Like

Does anybody have experience with Client-DateAdd calculation? Is it possible to use object line in number of intervals? It’s not clear from the syntax description, anyway it doesn’t work for me.
Thanks

Hey Mirek,

it is not possible. Only integer values can be added. You can find the original description and solution of a feature here link.
If you need to have a possibility of assigning the interval in an object line, make a new feature - enhancement of this calculation.

Cheers