Hi I thought i would share the following with the NUG as somebody somewhere will get the same error(in fact a search reveals someone was getting it from the SVG component a while back).
I am currently working on V14 but i am sure the same applies at least to earlier versions. Ok so we all know that we can pass back a value from a method in $0 AND we all know that you can call the method without somewhere to receive $0 and thats ok …MyMethod and $Return:=MyMethod are both valid So i have an existing method which launches some data in its own process. Normally this is asynchronous-i.e the launched process is not a dependant on or depended by the launching process. In this particular case it is a generic method displaying a selection of records in any table The method is currently called from menu bars as well as some calls from other places in the system, and as such uses a menu parameter to know which table to display data for So at the top of the method we have(something like!) if(count parameters>1) $_L_TableNumber:=$1 $_l_CalledfromProcess:=$2 //etc else $_Txt_parameter:=Get selected menu item parameter $_l_CalledfromProcess:=Current Processs $_L_TableNumber:=Num($_Txt_parameter) end if //then we have if($_l_CalledfromProcess=Current Process) $_l_NewProcess:=New Process($_t_ThismethodName;256000;”Record Browser”;$_L_TableNumber;current process) else //do stuff end if Ok so far so good..hope that is all clear Last week I made and edit to this method so that after launching the process we return $_l_NewProcess in $0(i have a need to for the launched process to be watched for it to end in a specific usage). As soon as this is deployed in compiled mode it gets an error Now what is interesting about the error is this:- The error is(-20002) “Error when loading the method “(method name)” with the name of the method there. So my first instinct was to check if I was suddenly having a problem with ‘Get selected menu item parameter’ and put an alert before and after to test..and the error still comes but the alert does not..so the code is not running through and encountering an error, the error is before anything executes. So what we find here is the 4D is hoisting the variables.-and thats good to note. Now in normal circumstances $0 not received anywhere is no problem, but when the call is from a menu item 4D does not like you trying to return $0. I don’t know if there are other circumstances where trying to return $0 causes a problem but would be interested know if anyone else knows of such a place. Note the baecause of the apparent hoisting even if you ‘wrap’ the call to $0 if(Count paramaters>=1) $0:=$_l_NewProcess end if This will still generate an error. (30 mins to track this down..30 seconds to create a fix!) Nigel Greenlee ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

