cdtj

Execute SDM method using SPEL

Blog Post created by cdtj Champion on Nov 8, 2016

Here is an example how to run SDM method from SPEL, I can't figure what class name is required, but passing object as 3rd argument gives possibility to access object as this from called method.

 

#define P_ERROR for(msg_i=0;msg_i<msg_length();msg_i++) { printf("\tERROR[%d]: %s\n", msg_i, (string)msg[msg_i]); }
#define P_SIGN for(msg_i=0;msg_i<msg_length();msg_i++) { printf("\tSGNFCNT[%d]: %s\n", msg_i, (string)msg[msg_i]); }
#define P_BOTH if (msg_error()) { P_ERROR } else { P_SIGN }

void splobj(...) {
     int msg_i;
     object iss;

     send_wait(0, top_object(), "call_attr", "iss", "dob_by_persid", 0, "iss:1305603");
     iss = msg[0];

     send_wait(0, spell_object(),     // @|bop_cmd-#8184|doit|0|0
                    "echo",           // method name
                    (string)NULL,     // class name (same as class() ?)
                    (string)NULL,     // event or macro name (same as event() ?)
                    (object)iss,      // "this" pointer of type object
                    1,                // input argumetns
                    2,
                    "three"
               );
     P_BOTH
}

void echo(...) {
     int i;
    
     for (i=0;i<argc;i++)
          set_return_data(i, argv[i]);

     set_return_data(i++, category);
     set_return_data(i++, assignee.userid);
}

 

Output:

d:\Scripts\bop>bop_cmd -u sd -f splobj.frg splobj()
        SGNFCNT[0]: 1
        SGNFCNT[1]: 2
        SGNFCNT[2]: three
        SGNFCNT[3]: iss001
        SGNFCNT[4]: DOMAIN\USERNAME

Outcomes