Substitution formulas
  • 13 Jun 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light

Substitution formulas

  • Dark
    Light

Article summary

Substitution formulas are functions which are calculated at runtime and return a text string.

Substitution formulas can be used in specific Object properties throughout the Capsule environment or in specific Procedure steps. For example, they can be used in the Caption field of a Label Object or in definition of a the Data model security profile or when customizing the printing layout of a Screen.

Substitution Formulas Library

All Substitution formulas are case insensitive, except @[entityname].

Formula syntax

Result

Output e.g. (with culture EN-US)

@user

Returns the user name of the currently logged user.

Susan Mayer

@username

Synonym of @user

Susan Mayer

@capsule

Returns the current Capsule name

Budget 2010

@screen

Returns the current Screen name

Forecast

@database

Returns the name of the current Data model

Delta

@DTB

Synonym of @database

Delta

@selection

Returns the current Selection in the form of the name of the Entities on which a selection was made, followed by a comma separated list of selected members. @Selection in data block headers will show block references too. Please refer to section below for more details

Year: 2004, 2005

@[entityname]

Returns the list of selected (in the Select or Pager Object) members of the specified Entity. Note that the entity name is case sensitive.
For example, @month returns the list of selected members of the Month entity.

24 / 60

@time

The string returned by the @time function is culture-sensitive and shows the current time when a Screen is opened.
For example, if the en-US culture is selected, the output will be "h:mm:ss tt"; for the de-DE culture, it is "HH:mm:ss"; for the ja-JP culture, it is "H:mm:ss".

7:55:30 AM

@time12

Returns the current time in format "HH:mm". The function is culture-sensitive.

07:55

@time24

Returns the current time in format "HH:mm tt". The function is culture-sensitive.

07:55 AM

@timelong

Returns the current time in format ""HH:mm:ss". The function is not culture-sensitive.

7:55:30 AM

@date

The string returned by the @date is culture-sensitive and shows the current date when a Screen is opened.
For example, if the en-US culture is selected, the output will be "M/d/yyyy"; for the de-DE culture, it is "dd.MM.yyyy"; for the ja-JP culture, it is "yyyy/M/d".

7/19/2010

@datelong

Returns the current date in format ""dddd, dd MMMM yyyy". The function is culture-sensitive.

Monday, July 19, 2010

@dateextendend

Returns the current date in format "ddd, MMMM dd, yyyy". The function is culture-sensitive.

Mon, July 19, 2010

@dateday

Returns the current date in format "MM/dd/yyyy". The function is culture-sensitive.

7/19/2010

@datemonth

Returns the current date in format "MMMM dd". The function is culture-sensitive.

July 19

@dateyear

Returns the current date in format "yyyy MMMM". The function is culture-sensitive.

July, 2010

@datetime

Returns the current date in format "MM/dd/yyyy HH:mm:ss". The function is culture-sensitive.

7/19/2010 7:55:30 AM

@selection

The @selection is definitely the most popular substitution formula and can be used in conjunction with several parameters to customize the final output. It can be used in any Label or Button Caption, Title, or Block Heading field.

Formula syntax

Result

Output e.g. (with culture EN-US)

@Selection_Ex

Returns the current Selection in the form of the name of the Entities on which a selection was made, followed by a comma separated list of selected members narrowed to 10 items (default is unlimited).

Month: Jan.22, Feb.22, Mar.22

@Selection_Ex(Layout="Layout_Title")

Returns the Layout Select.
It doesn’t combine the Screen Selection with the Layout Selection.

Layout="" is the default value.

Country: Japan, Spain

@Selection_Ex(Layout="Layout_Title", Block="Block_Heading")

Returns the Block Select.
It doesn’t combine the Screen Selection and/or the Layout Selection with the Block Selection.

Block="" is the default value.

Sales person: Jim Smith

@Selection_Ex(Display="Code")

Returns the Code of Selected Items.
All available parameters are:

  • Code. Returns the Code of Selected Items.

  • Desc. Returns the Description of Selected Items.

  • CodeDesc, Returns the Code and Description of Selected Items.

  • Default

Display=”Default” is the default value.

Continent: 03 South America

@Selection_Ex(Interval="Range_Item")

Returns which elements of the Selected Item-Set are showed.

Available Values are:

  • First

  • Last

  • Range

  • All

Interval="All" is the default value

Month: Apr.22

@Selection_Ex(Limit="n")

If the number (m) of the Selected Items is greater than n (m>n) it doesn’t show the item codes and/or description but m/M where M is the number of available items for such Entity. If m<=n it works as usual.

Limit="MaxValue" is the default value (no limitation)

Month: 4 / 72

@Selection_Ex(Entity="Entity_Name"

Hides the Entity Name that precedes the Selected Item List.

Entity="" is the default value


Oct.22, Nov.22, Dec.22 


@Selection_ex(Entity="Entity_Name",ShowActive="True") 

@Selection_ex(Entity="Entity_Name",ShowActive="False")

The "ShowActive" parameter can be used with the "Entity" parameter to:

  • always show the active members (i.e. members included in the selection) of the configured Entity when set to "True" (if all members of the Entity are selected, the output of the formula is "All")

  • or to show the formula if a selection is made on other aggregation levels of the same relationship tree when set to "False"

The default is False

All

@Selection_ex(Entity="Month",ShowActive="False")

When the @Selection_Ex formula is used in a Layout title or Block Heading the Layout and Block parameter must be omitted.
Two or more @Selection_Ex formulas can’t be combined nor concatenated in the same script.
The @Selection_Ex formula can’t have another @Selection_Ex formula as a parameter: i.e. the formula @Selection_Ex(Layout="Layout_Title") won't return any value if a @Selection_Ex formula has been used in the Layout title.


Was this article helpful?