Parsware
All articles

How-tos

How to add a field to a table

Add a decimal field to a table, then place it on the form and in the view, because a new field shows nowhere until you do. How-to video H016, step by step.

A bright cover reading "How-to · H016: Add a field to a table", with "On the form and in the view" under it, the steps Fields → New → Form → View, and two screens from the video.

How-to H016 · 1 min 35 s. A complete tutorial: every click and value the video uses, the three places a field has to go, and the document the platform saves. Every picture is a frame of the video.

A field is one piece of information on every record of a table. In this tutorial you add Estimated value, an amount of money, to every opportunity, and then put it where people will see it: on the form and in the view. That second part is the step that is easy to forget.

Where What adding it there does
The table Creates the column. Every record has the field.
The form People can see and type it on a record.
The view It is a column in the list of records.

Before you start

The Opportunity table in Sales Tracker, from How to create a table.

Part 1: Add the field to the table

  1. Open Solutions, then Sales Tracker, and select Tables.
  2. Open Opportunity. It opens on its fields. So far there is one: Name.
  3. Select New. The New field panel opens on the side.
  4. Fill it in:
Box Value Why
Display name Estimated value The label people see.
Logical name (fills itself in) tsp_estimatedvalue The name of the field's column. It can't be changed once you save.
Data type Decimal A number with a fractional part, for money.
Precision 18 How many digits it holds in all.
Scale 2 How many of them come after the point. 18 and 2 suits money.
Required Off An opportunity may not have a value yet.
Default control Leave as it is The data type's own control.

The New field panel: display name Estimated value, logical name tsp_estimatedvalue, with Data type, Required and Default control below.

  1. Select Save. The field is in the list, and its column already exists.

Part 2: Put it on the form

A new field isn't placed anywhere by itself.

  1. Select Forms and open the Information form.
  2. Estimated value is under Available fields on the left. Drag it into the General section, below Name.
  3. Select Save.

Part 3: Put it in the view

  1. Select Views and open All Opportunities.
  2. Drag Estimated value into the view's columns, beside Name. The preview grid gains the column straight away.
  3. Select Save.

The view designer for All Opportunities, with Estimated value added to the view's columns beside Name.

The field as text

The table's document now has a second field:

{
  "logicalName": "tsp_opportunity",
  "displayName": "Opportunity",
  "primaryField": "tsp_name",
  "fields": [
    { "logicalName": "tsp_name", "displayName": "Name", "dataType": "Text", "isRequired": true, "isPrimary": true },
    { "logicalName": "tsp_estimatedvalue", "displayName": "Estimated value", "dataType": "Decimal", "precision": 18, "scale": 2 }
  ]
}

And a script or a process reads it by its logical name. For example, in BS Lang:

var opp = getRecord("tsp_opportunity", getRecordRef("record"));
var value = opp.tsp_estimatedvalue;

Choosing a data type

The data type can't be changed after you save (only a field's size can: its precision and scale, or a text field's length), so it is worth choosing well:

You want to store… Data type
A short line of text Text
A paragraph Multiline text
A whole number: a count, a percentage Integer
Money, or any number with decimals Decimal
Yes or no Boolean
A date, or a date and time Date/time
One choice from a fixed list Option set
A link to a record in another table Lookup
A document, or a picture File, or Image

How to add every kind of field adds one of each.

If something goes wrong

  • The field isn't on the record. It isn't on the form. Do Part 2.
  • The field isn't in the list. It isn't in the view. Do Part 3.
  • The logical name or the data type is wrong. Neither can change after saving. Delete the field (tick it, then Delete) and add it again with a new name. Deleting a field removes it from the app but leaves its stored column, so don't reuse the old logical name.
  • "Decimal precision/scale is out of range." Precision counts every digit, not only the decimals. Precision 2 and scale 2 holds nothing above 0.99. Widen it with Edit.

What you built

A new field, on the table, on the form and in the view. Next, add one of every kind.

Read more

Is there a task you would like to see done step by step? Tell us. parsware.com/contact