Announcement

Collapse
No announcement yet.

Using values returned by CallFunction

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using values returned by CallFunction

    Functions can return more than one value at a time.
    How can we select each one of them?

    For example:
    FileX.efs has a function that returns 5 values.
    I call that function from File2.efs and want to use each returned value for further processing.


    Thank you.
    Mihai Buta

  • #2
    Hi Mihai

    The order of the returned variable values will be the same as the order of variables in the "return" statement in the called efs.

    e.g. the "return" statement in test.efs which returns values of 5 variables a,b,c,d,e

    return new Array(a,b,c,d,e);

    then in the calling efs you define a 5-element array, say "catch" such as:

    var catch = new Array(5);

    catch = call("test.efs");

    //catch[0] stores value of a
    //catch[1] stores value of b
    ...
    ...
    //catch[4] stores value of e

    that's how I ussually do. Good luck.
    Cheers

    Dzung Nguyen
    Last edited by dungn6au47; 09-08-2003, 11:37 AM.

    Comment


    • #3
      Thank you Dzung.
      It makes sense. I will try it.
      Mihai Buta

      Comment


      • #4
        Hi,

        Yes that would work for most functions, but for callFunction it appears it will not. After playing around with trying to get multiple returns from a called function (using methods similar to those described by Dzung below) and being unsucessful, I contacted the engineer at eSignal who coded the call and callFunction routines.

        According to him, it can only handle single paramter returns at this time, but he thought he could change that to support multiple parameters in the future.

        He suggested the work around of using universal globals to pass the array (setGlobalValue and getGlobalValue), and this does work just fine.

        Hope this helps,

        Garth
        Garth

        Comment


        • #5
          Re: Reply to post 'Using values returned by CallFunction'

          Thank you Garth,
          The problem with global variables is that they work only in real time, due
          to the way efs runs the studies one at a time for all bars.
          Mihai

          ----- Original Message -----
          From: <[email protected]>
          To: <[email protected]>
          Sent: Sunday, September 07, 2003 12:32 PM
          Subject: Reply to post 'Using values returned by CallFunction'


          > Hello mbuta,
          >
          > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          >
          Mihai Buta

          Comment

          Working...
          X