KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Easily find all methods that are available via SQL
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: February 22, 2018

The following code_snippet can be used to quickly and easily find all methods in a database that are set as "Published via SQL":

C_TEXT($crlf;$file)
ARRAY TEXT(atNames;0)
$crlf:=Char(Carriage return)+Char(Line feed)
$msg:="The following methods are available via SQL:"+$crlf
METHOD GET NAMES(atNames)
For ($a;1;Size of array(atNames))
    If (METHOD Get attribute(atNames{$a};Attribute published SQL))
    $msg:=$msg+atNames{$a}+$crlf
    APPEND TO ARRAY(atSqlNames;atNames{$a})
    End if
End for
If (Size of array(atSqlNames)=0)
    $msg:=$msg+"**none found**"+$crlf
End if
CONFIRM($msg;"write to disk";"cancel")
If (OK=1)
    $file:=Get 4D folder(Database folder)+"SQL_Methods.txt"
    TEXT TO DOCUMENT($file;$msg)
    SHOW ON DISK($file;*)
End if


Running this method will first prompt you with the list of methods found, while also giving the option to write the list to disk.

If the "write to disk" option is chosen, the directory containing the file is opened after it is written to disk.