# Functions in Sage Enterprise Intelligence

By | September 23, 2022

Sage Enterprise Intelligence is a business intelligence solution which is integrated with a Sage business management system. SEI (Sage Enterprise Intelligence) helps business users to reduce time spent on the analysis as well as in reporting which makes them to take faster and better decisions.

SEI provides simple solution for all users to access and analyze the data sufficiently by eliminating the need for the different tools and skills.

One of the benefits of Sage Enterprise Intelligence is using of different ‘Functions’. For that navigate to ‘Data Models and Views’. Select a particular module and right click on any data model from it to view options. Now select option ‘Design Data Model’. Please refer below screenshots.

Now select any necessary column from the data model and go to the Calculation row of it, where user needs to click on a button as shown below to open the SQL Script Builder.

User can select any function and appropriate parameter for the function to calculate the value of the field. After using the function in script click on ‘Validate’ and then ‘Ok’ button to validate the same.

Below are few of the functions that we can use in SEI Data Models.

1. ABS: This function provides the absolute value of the argument.

e.g. Abs(SORDERP.NETPRI_0)

1. ASCII: This function provides the ASCII code value of the leftmost character of the argument as an integer.

e.g. Ascii(SORDER.BPCNAM_0)

1. CEILING: It gives the smallest integer greater than or equal to the argument.

e.g. Ceiling(SORDERQ.QTY_0)

1. CHAR: Converts an integer ASCII code to a character.

e.g. Char(SORDERQ.QTY_0)

5.CHARINDEX: Provides the starting position of the specified expression in a character string.

e.g. Charindex(SORDER.BPCNAM_1, ‘a’, 1)

6.DATEADD: Gives a new datetime value based on an adding an interval to the specified date.

7.DATEDIFF: This function provides the number of date and time boundaries crossed between two specified dates.

e.g. Datediff(month, SORDER.ORDDAT_0, SORDER.SHIDAT_0)

8.DATENAME: Gives a character string representing the specified datepart of the specified date.

e.g. Datename(month, SORDER.ORDDAT_0)

9.DATEPART: Returns an integer representing the specified datepart of the specified date.

e.g. Datepart(year,SORDER.ORDDAT_0)

10.FLOOR: Gives the largest integer less than or equal to the argument.

e.g. Floor(SORDERQ.QTY_0)

11.LEFT: Gives a string consisting of the leftmost argument2 bytes in argument1.

e.g. Left(SORDER.BPCNAM_0, 3)

12.LEN: Provides the number of characters in a string.

e.g. Len(SORDER.BPCNAM_0)

13. LOWER: Returns a character expression from uppercase characters to lowercase.

e.g. Lower(SORDERP.ITMDES1_0)

14. LTRIM: Gives the characters of the argument with leading blanks removed.

e.g. Ltrim(SORDERP.ITMDES1_0)

15.MONTH: Returns an integer that represents the month part of a specified date.

e.g. Month(SORDER.ORDDAT_0)

16. PATINDEX: Returns the starting position of the first occurrence of a pattern in a specified expression

e.g. Patindex(‘%BMS%’, ITMMASTER.ITMREF_0)

17. RAND: Returns a random float value from 0 through 1.

e.g. Rand()

18. REPLACE: Replaces all occurrences of the second expression in the first expression with a third expression.

e.g. Replace(ITMMASTER.ITMDES1_0, ‘A’, ‘a’)

19.REPLICATE: Repeats a character expression a specified number of times.

e.g. Replicate(ITMMASTER.ITMREF_0, 2)

20. REVERSE: Returns the reverse of a character expression.

e.g. Reverse(ITMMASTER.ITMDES1_0)

21.RIGHT: Returns the specified numbers of the character from the right part of a character expression.

e.g. Right(ITMMASTER.ITMDES1_0, 2)

22.ROUND: Returns the numeric expression, rounded to the specified length or precision.

e.g. Round(SORDERP.NETPRI_0, 2)

23. RTRIM: Returns a character expression after truncating all trailing blanks.

e.g. Rtrim(ITMMASTER.ITMDES1_0)

24. SIGN: Returns the positive (+), zero (0) or the negative (-) sign of the given expression.

e.g. Sign(SORDERQ.QTY_0)

25. SPACE: Returns a string of repeated space characters.

e.g. Space(3)

26. SQRT: Returns the square root of the argument.

e.g. Sqrt(SORDERP.NETPRI_0)

27. SQUARE: Returns the square of the argument.

e.g. Square(SORDERP.NETPRI_0)

28. STR: Returns a character expression converted from a numerical expression.

e.g. Str(SORDERP.NETPRI_0)

29. SUBSTRING: Returns part of character, binary, text or image expression.

e.g. Substring(SORDER.BPCNAM_1,1, 3)

30. UPPER: Returns a string in which all the characters have been converted to upper case characters.

e.g. Upper(SORDER.BPCNAM_1)

31. YEAR: Returns the year part of a value.

e.g. Year(SORDER.ORDDAT_0)

This blog helps us to use the functions in Sage Enterprise Intelligence.