AttributeSetBoolean Function

Action

Assigns a boolean value 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

AttributeSetBoolean( in sName  : string,
                     in bValue : boolean ): 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.
bValue Boolean value that is assigned to the specified attribute.

Example

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

    // do anything, for example, call an external function
    AttributeGetString("name", sString);
    writeln(sString);
    writeln(AttributeGetInt("age"));
    if AttributeGetBoolean("member") then
      writeln("true");
    else
      writeln("false");
    end;
    writeln(AttributeGetDouble("cash"));
    AttributeGetBinary("code", sBuffer);
    WriteData(sBuffer, STRING_COMPLETE);
  end TMain;