AttributeSetBinary Function

Action

Assigns binary data to a specified attribute of the user. The function automatically creates the attribute if it does not exist.

User attributes are useful when working with Silk Performer frameworks, in fact, when the user behavior is defined in two separate script. In that case, user attributes enable the exchange of data between scripts, for example, between a Silk Performer and a Java script.

Include file

Kernel.bdh

Syntax

AttributeSetBinary( in sName   : string,
                    in sBuffer : string,
                    in nSize   : number optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sName Name of the attribute whose value is set. The function automatically creates the attribute if it does not exist.
sBuffer Binary data that is assigned to the specified attribute.
nSize Amount of binary data that is assigned to the attribute (in bytes; optional).

Example

dcltrans
  transaction TMain
  var
    sString, sBuffer : string;
  begin
    AttributeSetString("name", "Jim");
    AttributeSetInt("age", 23);
    AttributeSetDouble("cash", 4503.60);
    AttributeSetBinary("code", "\h9EF30533");

    // do anything, for example, call an external function

    AttributeGetString("name", sString);
    writeln(sString);
    writeln(AttributeGetInt("age"));
    writeln(AttributeGetDouble("cash"));
    AttributeGetBinary("code", sBuffer);
    WriteData(sBuffer, STRING_COMPLETE);
  end TMain;