CA Service Management

  • 1.  Operators in SPL

    Posted Feb 14, 2017 08:27 AM

    Hi Community,

     

    what are all the available operators that we can use in spl programming? Specifically, the operator 'OR'  is available to use?

     

    Thank you,

     

    Regards,

    Venkat



  • 2.  Re: Operators in SPL

    Posted Feb 14, 2017 08:43 AM

    Hi, 

     

    The old servicedeskusers site should get you started. It was never fully migrated to the new forum, but can still be found at Gregg smith's personal site. 

     

    Spel Reference Guide - SDU 



  • 3.  Re: Operators in SPL

    Posted Feb 14, 2017 08:47 AM

    Hi Venkat,

     

    See also: Where can I find Spel functions documentation?

     

    Kind Regards,

    Brian



  • 4.  Re: Operators in SPL

    Posted Feb 14, 2017 10:15 AM

    Hi,

     

    This is how I'm constructing the where clause to use send_wait() service, however, I could see the parse error related to this.

    The logic behind this where clause is I would like to retrieve the records in the table att_evt which status_flag is equal to 2 and 12 for a particular request.

    wc = format("obj_id = '%s' AND (status_flag = 2 OR status_flag = 12)",persistent_id);

     

    Below is the error message.

    Parse error at : "obj_id = 'cr:2114306' AND (status_flag = 2 OR Status_flag = 12)" (Attr not found or not atomic)

     

    any suggestions on the better way in constructing the where clause for this use case.

     

    Thank you,

     

    Regards,

    Venkat



  • 5.  Re: Operators in SPL
    Best Answer

    Posted Feb 15, 2017 07:06 AM

    Hi,

    Can you put your full send_wait command here to have a look 

     

    string wc;

    mywc=" (status_flag =2 OR status_flag=12) AND obj_id='%s' ";

    send_wait(0, top_object(), "call_attr", "atev","sync_fetch", "STATIC", format(mywc, persistent_id), -1, 0);

     

    /J



  • 6.  Re: Operators in SPL

    Posted Feb 15, 2017 11:14 AM

    Thank you 



  • 7.  Re: Operators in SPL

    Posted Feb 15, 2017 11:16 AM

    so do the code above did work for you?

    /J 



  • 8.  Re: Operators in SPL

    Posted Feb 15, 2017 11:18 AM

    u welcome sharing is the key of success



  • 9.  Re: Operators in SPL

    Posted Feb 15, 2017 11:20 AM

    jmayer here is my code, thanks

     

    // status_flag = 1 is complete
    // status_flag = 12 is delayed
    // status_flag = 0 is cancelled
    // Status_flag = 2 is pending
    #define MSG_ERROR for(msg_i=0;msg_i<msg_length();msg_i++) { logf(ERROR, "method: %s msg[%d]: %s",method,msg_i, msg[msg_i]); }
    cr::zSla_ViolationDate(...)
    {
    string wc,perSID,method;
    int zcount, msg_i, i, fetch_val;
    object zobj, zfound, fetch_obj,cr_domset,cr_dob,gl;
    perSID = argv[3];
    fetch_val = 0;
    method = "zSla_ViolationDate";
    wc= "(status_flag =2 OR status_flag=12) AND obj_id='%s' ";
    //wc = format("obj_id = '%s' AND status_flag = 2",perSID);
    send_wait(0, top_object(), "call_attr", "atev", "sync_fetch", "STATIC",format(wc,perSID), -1, 0);
    if(msg_error())
    {
    MSG_ERROR
    }

    else{
    zcount = msg[1];
    if (zcount > 0){
    zfound = msg[0];
    for (i=0;i<zcount;i++){
    send_wait(0, zfound, "dob_by_index", "DEFAULT", i, i);
    if (msg_error()) {
    MSG_ERROR
    }
    else {
    zobj = msg[0];
    send_wait(0, zobj, "call_attr","fire_time", "get_val");
    if (msg_error()) {
    MSG_ERROR
    }

    else {
    if ( (fetch_val == 0) || (fetch_val < (int)msg[0])){
    fetch_obj = zobj;
    fetch_val = msg[0];
    }
    }
    }
    }
    wc = format("persistent_id = '%s'",perSID);
    send_wait(0, top_object(), "call_attr", "cr", "sync_fetch", "RLIST_STATIC",wc, -1, 0);
    if (msg_error())
    {
    MSG_ERROR
    }
    cr_domset=msg[0];
    send_wait(0,cr_domset, "dob_by_index", "DEFAULT", 0,0);

    if (msg_error())
    {
    MSG_ERROR
    }
    cr_dob = msg[0];
    send_wait(0, top_object(), "get_co_group");
    if (msg_error())
    {
    MSG_ERROR
    }
    gl = msg[0];
    send_wait(0,gl,"checkout",cr_dob);
    if (msg_error())
    {
    MSG_ERROR
    }
    cr_dob.zSlaViolatedDate= fetch_val;

    if (msg_error())
    {
    MSG_ERROR
    }
    send_wait(0,gl,"checkin");
    if (msg_error())
    {
    MSG_ERROR
    }
    }

    }
    }


  • 10.  Re: Operators in SPL

    Posted Feb 15, 2017 11:24 AM

    thanks for sharing back CodeGeek

    Sharing is power