You are working on a report that contains the Store and Address columns.
In the Address column, you want to display only the street names for each of the eFashion stores. The Address object from the universe returns both the building number and the street name. The number of spaces before the street name begins is inconsistent. Therefore, you must create a substring to return only the portion of the address that is needed.
Notice that in each address, there is a space after the building number. If you can, create a formula that recognizes the position of the space for each entry. Use that position as a starting point for the SubStr() function.
Create a variable Space that contains the syntax:
=Pos([Address];" ")
Create a variable Address that contains the syntax:
=SubStr([Address];[Space]+1;Length([Address]))
Syntax
Example Syntax
The example syntax can be broken down into the following parts:
Syntax | Description |
---|
[Address] | The string to be tested for the text pattern. |
" " | The text pattern. |
Using the Pos() Function
The Space variable locates the first space within each address string. If you add a Space column to the report, the result displays the number of characters before the street name for each address, as shown in the figure, Using the Pos Function to Divide the Address Object.
The integer that the Space variable returns corresponds to the number of characters before the street address begins. You can now create a variable called Address that removes the building number from the address string.
To finish the report, delete the Space column and replace the Address column with the Address variable that you created.