Skip to content

Understanding This and this in Lowgile

This and this have different meanings in Lowgile. Their capitalization is significant, and they cannot be used interchangeably.

This document explains when to use each derivative in the different Lowgile contexts, including modules, the Console, entity methods, and screen actions.

Capitalized This is a Lowgile alias. It references the current application module and can be used wherever a module name would normally be required.

The following sections describe how to use This when referencing module objects, configuring screen variables, and writing Console code.

Use This as shorthand when referencing an object defined in the current module.

For example, when the current module is Purchasing, the following reference:

This.PurchaseRequest

is equivalent to:

Purchasing.PurchaseRequest

Use This when a screen variable references an object type defined in the current module.

For example, to configure a screen input variable that holds a PurchaseRequest object, set its Type in the Variables tab to:

This.PurchaseRequest

To create new PurchaseRequest object as the variable’s initial value, set its Default expression to:

new This.PurchaseRequest({}, true)

This creates a new PurchaseRequest instance and assigns it as the variable’s initial value.

In the Lowgile Console, This refers to the module currently selected in the module context selector.

For example, when the Purchasing module is selected, This.Materials refers to Purchasing.Materials

Attention

Do not use lowercase this as a replacement for the selected module. Use capitalized This in the selcted module context.

For more information about selecting a module context and executing code, see Use the Lowgile Console.

Lowercase this is the standard TypeScript keyword. Lowgile does not assign it a separate platform-specific meaning; its value depends on the context in which a function or method is called.

Unlike capitalized This, lowercase this does not represent a Lowgile module.

In this example, getName() is called as a method of item, so this refers to item and this.name accesses its name property.

const item = {
name: "UP GM 203",
getName() {
return this.name
}
}
return item.getName()
ExpressionMeaningTypical use
This.PurchaseRequestReferences PurchaseRequest in the current Lowgile module.Referencing object types, static entities, services, workflows, and other module-level objects.
Purchasing.PurchaseRequestReferences PurchaseRequest by using an explicit module name.Cross-module references and Console code executed with the wildcard module context.
this.nameAccesses the name property of the object represented by this.Standard TypeScript and JavaScript methods and functions.

The simplest way to remember the distinction is:

  • This answers: Which Lowgile module?
  • this answers: Which runtime object instance?

Tip

For help diagnosing errors caused by using the wrong form, see Troubleshooting This and this.