Announcement

Collapse
No announcement yet.

How to get a Array with Call();

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

  • How to get a Array with Call();

    When using call(); to retrieve data from another efs i am finding the only way i can retrieve more than one piece of data is to use GlobalValue, is this a sound practice or is there a better way to send a Array and retrieve it see below code the top one is the efs that is being called,

    the return new Array(aa3,axp3,ba3,c3,cat3,dd3); data is being received by the calling efs in the correct order but it does not read it as a Array, where as if the data is sent by GlobalValues it is received as it should be,

    if using GlobalValue to transmit the data is a sound practice what is the limitation on it , could i call 30 sets of data through 5 efs studies.


    PHP Code:
    if(cat1 >= cat2){
    cat3 1;
    }else{
    cat3 2;
    }
    if(
    dd1 >= dd2){
    dd3 1;
    }else{
    dd3 2;
    }

    setGlobalValue("aa_aa",aa3);
    setGlobalValue("axp_axp",axp3);
    setGlobalValue("ba_ba",ba3);
    setGlobalValue("c_c",c3);
    setGlobalValue("cat_cat",cat3);
    setGlobalValue("dd_dd",dd3);

    //debugPrintln(test," test = ");
    //debugPrintln(aa3,"  ",axp3,"  ",ba3,"  ",c3,"  ",cat3,"  ",dd3);


    return new Array(aa3,axp3,ba3,c3,cat3,dd3);


    PHP Code:
    var aaa null;
    var 
    aaxp null;
    var 
    aba null;
    var 
    ac null;
    var 
    acat null;
    var 
    add null;
    var 
    test1 = new Array();
    var 
    up null;
    var 
    down null;

    function 
    main(){

    var 
    test = new Array();
    up 0;
    down 0;

    aaa getGlobalValue("aa_aa");
    test.push(aaa);
    aaxp getGlobalValue("axp_axp");
    test.push(aaxp);
    aba getGlobalValue("ba_ba");
    test.push(aba);
    ac getGlobalValue("c_c");
    test.push(ac);
    acat getGlobalValue("cat_cat");
    test.push(acat);
    add getGlobalValue("dd_dd");
    test.push(add);

    //debugPrintln(aaa," aaa ",aaxp," aaxp ",aba," aba ",ac," ac ",acat," acat ",add," add ");

    test1 call("EFS2 Test Symbols.efs");
    debugPrintln(test[0]);
    //debugPrintln(test1[0]);
    result(test);
    debugPrintln(up," up = ",down," down = ");

    return;
    }

    function 
    result(ntest){

    for(
    i=0;i<6;i++){
      if(
    ntest[i]==1){
      
    up ++;
      }else{
      
    down ++;
      }
     }
    return;


  • #2
    Hello Shogun,

    The key to using call() is to perform a null check immediately after and exit the formula when the return from call is null. The setGlobalValue/getGobalValue routine will make it difficult for you to synch up the historical values. Try something along these lines, which is EFS1 logic.

    PHP Code:
    var up null;
    var 
    down null;

    function 
    main(){

        var 
    test = new Array();
        
    up 0;
        
    down 0;    
        
        var 
    test1 call("EFS2 Test Symbols.efs");
        if (
    test1 == null) return;
        
        
    result(test1);
        
    debugPrintln(up," up = ",down," down = ");
        
        return;
    }

    function 
    result(ntest){    
        for(
    i=0;i<6;i++){
            if(
    ntest[i]==1){
                
    up++;
            }else{
                
    down++;
            }
        }
        return;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      I would like to add, that you should be able to get rid of using call() and callFunction() with EFS2.

      I'm not sure of your exact implementation, but IMO it might be easier to look into using efs() or efsInternal() or perhaps the EFS FunctionLibrary to do what you need to do ?

      Comment

      Working...
      X