setwaitinglocal
TASKID

The setwaitinglocal statement assigns a value to a local variable in the parent procedure of an asynchronous task, allowing the asynchronouse code to pass a value back to the code that spawned it.


Parameters

This statement has one parameter:

taskid – the ID of the task to wait for (either a timer or a urltask().


Description

This statement assigns a value to a local variable in the parent procedure of an asynchronous task, allowing the asynchronouse code to pass a value back to the code that spawned it (and creating the variable if necessary). This variable can be accessed after the waitfortask statement. Normally this would be used immediately before a resumeaftertask statement, to convey status information about the results of the asynchronous task back to the caller that invoked the asynchronous process.

waitfortask urltask(someurl,"code",{... setwaitinglocal «taskid»,"_urlResult","OK" resumeaftertask «taskid»}
if _urlResult<>"OK"
    ... uh-oh, something went wrong in the async code
    return
endif
... everything ok

See the waitfortask documentation to learn more about coordinating synchronous and asynchronous code.


See Also


History

VersionStatusNotes
10.2NewNew in this version.