Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel2
typeflat

...

How does it work in the search window?

Select Create field in the search window toolbar, then select the Substring operation. This operation needs at least two arguments:

Argument

Data type

More information

Original string mandatory

string

-

Starting from character mandatory

integer

Position of the starting character of the substrings.

Length of substring

integer

The number of characters you want your substrings to have. If not indicated, you will get all the characters from the starting point indicated.

The data type of the values in the new field is string.

Example

In the demosiem.logtrust.ecommerceweb.dataactivity table, we want to get only the part indicating the month in our timestamp columneventdate field. First, we must convert this field to string using the to string operation. We will create a new column field using the Substring operation to do . Let's call the new column field substrings

The arguments needed to create the new column field are:

  • Original string - timestamp column eventdate_string field

  • Starting from character - 3

  • Length of substring - 3

...

Click Create columnfield and you will see the following result:

...

Use the operator select... as...  and add the operation syntax to create the new columnfield. These are the valid formats of the Substring operation:

  • substring(string, starting_position_integer)

  • substring(string, starting_position_integer, length_integer)

Example

You can copy the following LINQ script and try the above example on the demosiem.logtrust.ecommerceweb.dataactivity table. 

Code Block
from demosiem.logtrust.ecommerceweb.dataactivity
  select str(eventdate) as eventdate_string,
    substring(timestampeventdate_string, 3, 3) as substringssubstring