Rename a Single Field - Example 2

Rename a single field using the rename() function with assignment syntax to define the new name of the field

Query

flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0{Conditional} result{{Result Set}} repo --> 0 0 --> result
logscale
goodName := rename(badName)

Introduction

The rename() function is used to rename one or more fields. In this example, only one field is renamed using the assignment operator (:=).

Step-by-Step

  1. Starting with the source repository events.

  2. flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0{Conditional} result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;
    logscale
    goodName := rename(badName)

    Renames the badName field to goodName by assigning the new value (variable name) to the field. The value on the right side of the assignment operator is set equal to the value on the left side of it.

  3. Event Result set.

Summary and Results

The query is used to quickly rename single fields.