Table of Contents

setglobal

FreeSince 4.0.7

Description

Stores a value in the current PDMShell session. If the name already exists, setglobal replaces its value. Reference the stored value as ${global.Name} in evaluated command parameters.

This is a script/session variable, not a PDM data card variable. It is not saved to the vault, shared across sessions, or retained after the session ends. Use setvar to change a PDM data card variable instead.

Syntax

setglobal -name variableName -value "value"

Parameters

Parameter Alias Required Description
-name Yes Variable name. Start with a letter or underscore, followed by letters, numbers, or underscores. Names are case-insensitive.
-value -val Yes Value to store. Supports session placeholders, existing global references, and string evaluation. Quote values containing spaces.

Examples

Set and read a value

setglobal -name Project -value "ABC-100"
getglobal -name Project

The first command reports Global variable Project = ABC-100. The second prints Project = ABC-100.

Reuse a value in another command

setglobal -name Delay -value "10"
wait -timeout "${global.Delay}"

Calculate a value and replace it later

setglobal -name Project -value "ABC-100"
setglobal -name ReportName -value "Report-${global.Project}"
setglobal -name Project -val "ABC-200"
getglobal

ReportName remains Report-ABC-100: values are evaluated when set, not linked to later changes in other variables.

Remarks

  • Project and project address the same variable.
  • Leading and trailing whitespace in the supplied name and value is trimmed before evaluation.
  • Names cannot contain spaces, hyphens, or dots. Invalid names produce a command error.
  • File-specific placeholders require a file context; setting a global does not select or search for a file.
  • The command prints the stored value in its output. Do not use it to store passwords or API keys.