Syntax of Complex Method Calls

Previous Next

See Also

Complex method calls contain embedded method calls as parameters or as objects. They may also embed SQL expressions or statements, which could in turn contain embedded method calls.

Method Calls Embedded as Parameters

Embedded method calls frequently take the place of method call parameters. These embedded method calls return a text-like string to the embedding method call. Embedding can be any level deep. An example is:

MessageInformation(FORMULA(':1 || SUBSTR(:2,INSTR(:2,:3)+1)',

   'Domain = ', query.email.value(), '@')

In this example,

FORMULA(...)

is an embedded method call that in turn embeds the method call

query.email.value()

This embedding structure can be summarized as

<method call>::=[<object name>].<method name>([<parameter> [,<parameter>...]])

 

<parameter>::={<text-like-string> | <method call returning text-like-string>}

Method Calls Embedded as Objects

Less frequently, embedded method calls take the place of object names. These embedded method calls return objects, which are substituted in the object name part of the embedding method call. An example is:

WordProcessorObj.Documents.Item(2).Selection(...).Delete()

In this example,

WordProcessorObj.Documents.Item(2)

is an embedded method call. The value 2 is a parameter. The embedded method call returns the second currently open document in the word processor. This return value is itself an object, and is substituted in the embedding method call.

This embedding structure can be summarized as

<method call>::=<object name>.<method name>([<parameter> [,<parameter>...]])

 

<object name>::={<object> | <method call returning object>}

Method Calls and SQL

You can embed SQL statements in method call scripts by calling ActionDecision() and retrieving the data in Decision SQL (recommended for SELECT statements), or by calling the SqlScript() method. You can embed SQL expressions in method calls by using the FORMULA() method.

SQL statements can in turn contain method calls. SQL statements occur as parameters of SqlScript(), but also in other contexts, such as Decision SQL, main query statements, or Extra Query statements. An example of a Decision SQL statement with an embedded method call is:

SELECT  sum(sal)

FROM    emp

WHERE   deptno = :"query.deptno.value"

In this example the method call simply returns an on-screen value currently held by a column control, but it could return anything from a currently active tab page in a Tab control to a cell value in a Word table within an embedded Word document.