JoltGetDouble Function

Action

Retrieves the value of an eight-byte floating-point item (“double” in Java) of a Jolt object attribute. This function is provided to retrieve values from both JoltSessionAttributes and JoltRemoteService object attributes.

Include file

Jolt.bdh

Syntax

JoltGetDouble( in hJolt       : number,
               in sAttribute  : string,
               in fDefault    : float,
               in nOccurrence : number optional): float;

Return value

Value of the specified eight-byte floating-point item of the Jolt object attribute.

Parameter Description
hJolt Handle to a JoltSessionAttributes or JoltRemoteService object that was created with JoltSessionAttributesNew or JoltRemoteServiceNew, respectively
sAttribute Name of the attribute that is to be accessed
fDefault Floating-point value that the function returns if the specified attribute or item does not exist
nOccurrence

Index of the item that is to be retrieved (optional). The index of an attribute’s first item is 1 (not 0).

If this parameter is omitted, the attribute’s first item is retrieved.

注: This parameter is ignored if hJolt represents a JoltSessionAttributes object.

Example

var
  hSession, hSessionAttr, hRemoteService: number;
dcltrans
  transaction TInit
  begin
    JavaSetOption(JAVA_VERSION, JAVA_V11);
    JavaSetOption(JAVA_HOME, "c:/jdk1.1.7");
    JavaSetOption(JAVA_CLASSPATH, "c:/jdk1.1.7");
    JoltInit();     hSessionAttr := JoltSessionAttributesNew();
    JoltSetString(hSessionAttr, APPADDRESS, "//lab:8000");
    hSession := JoltSessionNew(hSessionAttr, "", "ATM", "", "");
    hRemoteService := JoltRemoteServiceNew("SUM", hSession);
  end TInit;

  transaction TMain
  var
    fSum: float;

  begin
    JoltSetDouble(hRemoteService, "DVALUE", 23.7, ADD_VALUE);
    JoltSetDouble(hRemoteService, "DVALUE", 11.91, ADD_VALUE);
    JoltCall(hRemoteService);
    fSum := JoltGetDouble(hRemoteService, "RESULT", 0.0);
    writeln(fSum);
  end TMain; 

  transaction TShutdown
  begin
    JoltEndSession(hSession);
    JoltFreeObject(hRemoteService);
    JoltFreeObject(hSession);
    JoltFreeObject(hSessionAttr);
  end TShutdown;

See also

Java: bea.jolt.JoltSessionAttributes class, bea.jolt.JoltRemoteService class