Context keyword service

Use the context keyword service to access environment information for the current context. In the default environment, this service returns host workstation environment variables. When running within EAServer, you can use the keyword service to get a specific component property value (on all EAServer platforms except AIX, you must use Keyword as the string parameter in the GetContextService function).

For information about using the context keyword service in EAServer, see “Accessing component properties”.

Accessing environment variables

When running in the PowerBuilder execution environment (the default context), you use this service to return environment variables.

StepsTo access environment variables:

  1. Declare an instance or global variable of type ContextKeyword. Also declare an unbounded array of type String to contain returned values:

    ContextKeyword  icxk_base
    
    String   is_values[]
    
  2. Create the context information service by calling the GetContextService function:

    this.GetContextService("Keyword", icxk_base)
    
  3. Call the GetContextKeywords function to access the environment variable you want. This example calls the GetContextKeywords function to determine the current application Path:

    icxk_base.GetContextKeywords("Path", is_values)
    
  4. Extract values from the returned array as necessary. When accessing environment variables, the array should always have a single element:

    MessageBox("Path", "Path is: " + is_values[1])