cdtj

OOTB SPEL methods, functions and operators

Blog Post created by cdtj Champion on Jan 25, 2016

Frequently I'm finding something useful, something that should be a part of SPEL coding foundation,

but I can't derive a correct place to share it with community, so I'm starting this post where I'll post my code snippets that looks interesting for me.

 

get_arg_list

Could be used only with WebEngine SPEL.

send_wait(0, obj, "get_arg_list");
// Receiving arguments from object, passed via WebEngine OP
// [0] : :KEEP.POPUP_NAME:OP:SID:PERSID:KEEP.use_role:ENV_REMOTE_HOST:ANALYST:ENV_REMOTE_USER:FID:ENV_HTTP_USER_AGENT:POPUP_NAME:ENV_SCRIPT_NAME:ENV_REQUEST_METHOD:FACTORY:

 

split

Regular split function.

string addrs[5];
int i;
split(addrs, (string)top_object(), "|");
for (i=0;i<5;i++) {
    printf("%d: %s\n", i, addrs[i]);
}

// 0: @
// 1: domsrvr:sa
// 2: TOP
// 3: 0
// 4: 0

 

switch

Regular switch function.

void test_sw(int op) {
    switch (op) {
        case 1:
            printf("==");
            break;
        case 2:
            printf("!=");
            break;
        case 3:
            printf("like");
            break;
        case 4:
            printf("not like");
            break;
        default:
            printf("==");
            break;
    }
}

Outcomes