Intrinsic Functions exist for each generic class of data available in LANSA. Thus, there are Intrinsic Functions for strings, numbers, dates, times, date times and so on as shown in 10. Intrinsic Functions. All Intrinsic Functions return a single result, and there is no need to specify the result parameter on the command line. As such, it is assumed that the result of an Intrinsic Function is the value to be used in the command.
Consider the following example
#com_owner.caption := 'Employee salary is ' + #salary.asstring
In the above example the + operator is being used to concatenate a string and a numeric field. Without Intrinsic Functions, you would need to move the value from #salary in to an alphanumeric field, and then use this to build the caption.
The asstring intrinsic takes the value from #salary, converts it to a string and returns it in a result, such that it can be used in the same way as any other string in LANSA.
Intrinsic functions are not just available when referring to specific fields. By definition, they belong to the class of data. Consider the following example code
#com_owner.caption := 'Employee salary is ' + #Com_owner.Get_Salary(#Empno).AsString
Define_Map For(*Input) Class(#Empno) Name(#iEmployee)
Define_Map For(*Result) Class(#Salary) Name(#oSalary)
Fetch Fields(#Salary) from_file(Pslmst) with_key(#iEmployee)
#oSalary := #Salary
In this example, the Set_Caption method does much the same as the initial example. The major difference is that rather than the salary field being used in to construct a caption, the result of the Get_Salary method is used. As the Define_Map #oSalary is of class #salary, by definition it is a numeric value. This means that all numeric Intrinsic Functions can be used to manipulate the value.
Similarly, if we were to refer to a numeric property of a component, e.g. the width of a form, we could the use numeric Intrinsic Functions.
When an intrinsic function is called on an SQL NULL value, it will produce SQL NULL, unless the intrinsic function specifically deals with SQL NULL.