Skip to main content

Renaming fields

In the previous topic, we showed you how to rename fields in the data preview window. In the heading of the data preview window, you renamed Invoice Date to Bill Date. When you inserted the load script, you could see that the field would be renamed using the keyword AS.

Load script window renaming Invoice Date as Bill Date
Load script window renaming Invoice Date as Bill Date.

We can also perform this action directly in the script.

  1. Open the Data load editor in the Scripting Tutorial app.
  2. Click the Sales tab.
  3. In the load script, make the following changes. Note that you have to include parentheses around fields that contain a space.
    1. Change GrossSales, to:
    2. GrossSales AS "Gross Sales",

    3. Change "Item Desc", to:
    4. "Item Desc" AS "Item Description",
      

  4. Your script should look like this:

    Load script window with script to rename fields
    Load script window with script to rename fields.

  5. Click Load data. The data is loaded.
  6. Open the Data model viewer. Confirm that the fields have been renamed.
  7. You can also view all your fields in an app. Click the Analysis/Sheet tab in the top toolbar. The app opens in sheet view.
  8. Click Edit sheet, and then click Fields in the assets panel. You can see the field names that you changed. You can use any of these fields in the visualizations that you create in your app.
  9. Renamed fields in analysis view
    Renamed fields in analysis view.