DEV Community

zuUwn21
zuUwn21

Posted on

# ๐Ÿท๏ธ Uniface 10.4: Qualifiers and Parameters of the activate Statement

๐Ÿšฆ What are Qualifiers in activate?

Qualifiers are optional switches that let you control the behavior of the activate statement. They determine how and in which mode an operation is executed on a component instance.

Overview of the Most Important Qualifiers

Qualifier Meaning
/list Passes input and output parameters as typed Uniface lists.
/stateless Invokes the operation statelessly (creates a temporary instance that is deleted after execution).
/async Executes the operation asynchronously (no OUT/INOUT parameters, no return value).
/sync Executes the operation synchronously (default behavior).

Code Example:

activate /async "MyCpt".do_it(vArg1, vArg2)
Enter fullscreen mode Exit fullscreen mode

The operation do_it is called asynchronously.


๐Ÿงฉ The Parameters of the activate Statement in Detail

Every activate statement consists of several components that you can use as needed:

Parameter Type Description
InstanceName String Name of the component instance (max. 16 characters). If not found, the instance is created.
OperationName Literal Name of the operation to execute (e.g., exec, accept, quit, or a named operation).
ArgumentList String Comma-separated list of arguments matching the operation's parameters.

InstanceName

  • Specifies on which component instance the operation is executed.
  • If the instance does not exist, it is created automatically.

Code Example:

activate "myCpt"
Enter fullscreen mode Exit fullscreen mode

OperationName

  • Name of the operation to execute.
  • Can be specified as a literal or a variable.
  • If no name is given, .exec() is used by default.

Code Example (Literal):

activate "myCptInstance".do_it()
Enter fullscreen mode Exit fullscreen mode

Code Example (Variable):

$vOperation$ = "do_it"
activate "myCptInstance".$vOperation$()
Enter fullscreen mode Exit fullscreen mode

activate "myCptInstance".do_it()

Code Example (Variable):

$vOperation$ = "do_it"
activate "myCptInstance".$vOperation$()
Enter fullscreen mode Exit fullscreen mode

ArgumentList

  • Comma-separated list of values passed to the operation.
  • The number and type of arguments must match the operation's declared parameters.
  • Uniface automatically converts data types when possible.

Code Example:

activate "myCptInstance".do_it(42, "Test")
Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ Tips for Using Qualifiers and Parameters

  • /list: Use this qualifier when you want to pass multiple input and output values as lists.
  • /stateless: Ideal for one-time, stateless callsโ€”e.g., for services.
  • /async: Use asynchronous calls when you donโ€™t need return values and the operation should run independently.
  • Parameter passing: Make sure the arguments match the number and type of the operationโ€™s declared parameters.

๐Ÿ’ก Practical Examples

1๏ธโƒฃ Passing Typed Lists with /list

Code:

putitem vInParms, -1, $date(20250101)
putitem vInParms, -1, $number(5)
activate/list "SERV2".ADD_WEEK(vInParms, vOutParms)
Enter fullscreen mode Exit fullscreen mode

Note: This post was created with AI support and based on the official Uniface 10.4 documentation. For further details, please refer to the original documentation.

Do you have questions or your own tips about qualifiers and parameters? Share them in the comments! ๐Ÿ‘‡

2๏ธโƒฃ Stateless Call with /stateless

Code:

activate /stateless "MyService".calculate(100, 200)
Enter fullscreen mode Exit fullscreen mode

3๏ธโƒฃ Asynchronous Call

Code:

activate /async "MyCpt".start_long_task()
Enter fullscreen mode Exit fullscreen mode

Top comments (0)