Altair® Monarch®

 

Function: Space

Description

Returns a string consisting of a specified number of spaces.

Syntax

Space(number)

Arguments

number is the number to convert.

Return value

This function returns a character string.

Calculated field example

If the Product field contains the following classical music recordings, you could use the Space function to create a new field with the composer and the symphony separated into distinct columns.

Initial field values
"Dvorak, Concerto for Cello"
"Gershwin, An American in Paris"
"Mozart, Symphony in D, K.202"

The following calculated field expression would create a new field with the composer in one column and the symphony in a second column:

LSplit(Product,2,",",1)
+Space(18-Instr(",",Product))
+LSplit(Product,2,",",2)

The first part of this expression LSplit(Product,2,",",1) splits off the composer from the Product field. The second part +Space(18-Instr(",",Product)) concatenates a variable number of spaces, based upon the length of the composer name, to create space between the first and second columns of data. The third part of the expression +LSplit(Product,2,",",2) concatenates the symphony as the second column of data. The result is shown below:

Resulting field values
"Dvorak      Concerto for Cello"
"Gershwin     An American in Paris"
"Mozart      Symphony in D, K.202"