AP Create Method will allow you to programatically create a 4D Project method in an interpreted database. The syntax is as follows:
error_code:=AP Create Method(method_name;array_of_attributes;code_blob;folder_name)
You can try the following code sample:
C_LONGINT($err)
C_TEXT($methodName;$folderName)
ARRAY LONGINT($attributes;4)
C_BLOB($code)
$methodName:="My New Method"
TEXT TO BLOB("ALERT(\"Hello\")";$code;Text without length ;*)
$attributes{1}:=1 ` 4D action?
$attributes{2}:=1 ` invisible?
$attributes{3}:=1 ` soap?
$attributes{4}:=1 ` published in wsdl?
$folderName:="Default Folder"
$err:=AP Create method ($methodName;$attributes;$code;$folderName)
A new method named My New Method will then be created and placed in the Default Folder. The returned $err will equal 0 if succeeded and -1 if the call fails. Also keep in mind that this will only work on an interpreted database.