CA SDM::.SPEL::. Send wait

Document created by TMACUL Champion on Jan 25, 2017Last modified by TMACUL Champion on Mar 6, 2017
Version 2Show Document
  • View in full screen mode

Send wait

Overview

This is the most tricky function and it is the main reason of difficulty of reading SPELL code. It is used for calling methods on objects. On every SD object (ie. cr, chg, alg...) are defined methods and using send_wait function you can call them. Definitions of some of them are in *.maj files in $NX_ROOT/bopcfg/majic folder.

Usage

void send_wait (int timeout, object top_object, string method, [ var parameters… ])

  • timeout - how long (in seconds) should the method wait for finishing the method (0 means infinite). A timeout mean time after which the function is considering as failure, returning to caller with error and no result. Nearly every time the 0 is used.
  • top_object - root object for the method (on which the method is called)
  • method - name of the called method
  • parameters - variable number of parameters based on the called method

Results

Function doesn't return value, but methods usually fill global msg array with return values. What values are on what positions depends on the called method.

 

Available methods

Defined on current (TOP) object
These methods are defined on all objects (maybe)
  • attrs_by_index
  • call_attr
  • get_attr_vals
  • get_co_group

Send wait - SDU 

 

 

send_wait - get_dob

 

Overview

This method loads from database an object connected over SREL relation to an another object and return it as full DOB object.

This action can be called in spell code in method send_wait for call_attr.

Usage

void send_wait (int timeout, object top_object, "call_attr", string attr_name, "get_dob")
  • timeout - how long (?in seconds?) should the method wait for finishing the method (0 means infinite)
  • top_object - object where the attribute is placed
  • attr_name - name of SREL attribute

Results

On success attribute DOB object is in the first position of global array msg.

object retval; retval = msg[0];

Examples

 

// Part of code to read request Affected End User

send_wait(0, this, "call_attr", "customer", "get_dob");

if (msg_error())

{

logf(ERROR, "%s: error in get_dob(customer): %s", method, msg[0]);

return;

}

object aff_eu;

aff_eu = msg[0];

 

 

To update multiple attributes in one call you can use the following construction:

 

uuid who;
send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
who=msg[0];

send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "is_asset", "0", "is_ci", "1");

 

In this case all you need to know is the persistent_id of the object you want to modify. And then you can define multiple name-value pairs to update this object

 

Example built by Gutis

 

 

2 people found this helpful

Attachments

    Outcomes