KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Calling 4D methods inside SQL code
PRODUCT: 4D | VERSION: 12.4 | PLATFORM: Mac & Win
Published On: September 12, 2012

It is possible to execute a 4D method on each selected row while executing SQL code. This feature is very useful especially when the values need to be manipulated.

A 4D method can be made available for SQL execution by opening the method properties and check the "Available through SQL" checkbox.


The calling syntax is as following:

   {FN MethodName AS returnType}

Here is an example SQL code that calls method ApplyFormat to apply currency format to a price value:

ARRAY TEXT(Price_at;0)
Begin SQL
  SELECT {FN ApplyFormat(Price) AS varchar}
  FROM Sales
  INTO :Price_at;
End SQL