4th Dimension Learning Basics
Why Data Fields Are the Foundation of a 4D Application
In 4D, the Structure is the blueprint of your entire application. Before you build a single form or write a line of 4D code, you define the tables that hold your data and the fields that live inside those tables. Everything downstream — forms, value lists, queries, relationships, reports — is built on top of this structure. Get the fields right and the rest of the application falls into place. Get them wrong and you will spend years working around decisions you cannot easily undo.
That last point is the single most important thing to understand about 4D’s data field model: once a data field is created, it cannot be deleted. This is not a bug or an oversight. It reflects a deliberate design philosophy in 4D (originally developed by Laurent Ribardière and marketed for decades by 4D Inc., formerly ACI) that prioritizes structural stability and data integrity over casual schema churn. The field occupies a permanent slot in the table’s internal structure, and 4D reserves that slot for the life of the database.
This has real consequences for how you work, and it shapes the practical advice in this article.
Key Takeaways
- A 4D data field, once created, cannot be deleted — only renamed, repurposed, or hidden.
- Clicking the data field area (the squares beneath a table name) opens Field Properties; clicking the table name opens Table Properties instead.
- Text fields hold up to 32,000 characters; Alpha fields are length-limited (default 20, maximum 80) and are the only type usable as relationship keys.
- Fields you create beyond the visible rows still exist — you just need to stretch the table or use the up/down arrows to see them.
- Calculated fields such as Age are not defined in the Structure; the calculation is attached when you build or edit a form.
- Leaving the Structure window open (rather than closing it) avoids being pushed into User mode before you are ready.
Creating Your First Data Field
We now come to the interesting part: creating data fields. Interesting, but with that annoying characteristic noted above — a field, once created, cannot be deleted. So what do you do if you make a mistake? You have three practical options:
- Rename it. If you created “Frist Name” by accident, rename it to “First Name” and move on.
- Repurpose it later. A field you do not need today may serve a purpose tomorrow. Many experienced 4D developers keep a small reserve of spare fields for exactly this reason.
- Hide it. With no data in the field, it will not significantly affect the size or operation of the program. An empty field costs you almost nothing at runtime.
To create the first data field, double-click on the Customers table in the data field area, as indicated by the arrow in Figure 8. Where you click is important. If you click in the table name area, you will get the Table Properties window again. Clicking in the squares (the data field area) under the table name brings up the Field Properties window instead.
This click-target distinction trips up nearly every newcomer. The table name is a control for table-level settings; the grid of squares below it is the field list. Learn to aim for the squares.
Choosing the Right Data Type
With the Field Properties window open (Figure 9), enter “First Name” for the Field Name and select Text for the data Type. Text fields can hold up to 32,000 characters — generous enough for names, notes, descriptions, and most free-form content.
When done, click Apply, and the table will show the first data field (Figure 10).
Now select the next data field area in the Structure for Sample Database window and repeat:
- Create a Text field called “Last Name.”
- Create a field called “Address,” but make Address a type Alpha field.
The distinction between Text and Alpha matters more than it first appears.
Alpha fields can hold the maximum number of characters specified as the field length. The default is 20 and the maximum is 80 characters. If you set 20 as the maximum length, the program will simply not let you type more — the field enforces its own limit at entry time. This makes Alpha ideal for short, fixed-purpose values: codes, abbreviations, status flags, and — critically — relationship keys.
Alpha fields are the only fields that can be used for relationship keys. If you plan to link two tables together (say, Customers to Orders), the linking field on at least one side must be Alpha. This is a structural constraint, not a preference, and it is one of the reasons to think carefully before assigning types.
A quick way to decide:
| Use case | Recommended type | Why |
|---|---|---|
| Names, notes, descriptions | Text | Up to 32,000 characters, no fixed limit |
| Short codes, status flags, IDs used as keys | Alpha | Length-enforced, usable as relationship key |
| Dates, amounts, quantities | Numeric/Date types | Enable calculations and sorting |
| Values computed from other fields (e.g., Age) | Defined on the form, not the Structure | Keeps the Structure clean |
Seeing All Your Fields in the Structure Window
Note in Figure 11 at the left that only three data fields are shown in the Customers table. You are about to create a fourth called “City,” but to see it you must either drag the table longer or use the up and down arrows at the top of the table to reveal additional fields.
Two practical notes here:
- If you just continue creating fields, they will be added to the table — but not seen. The data is there; the display simply is not tall enough.
- If you stop and then go back to creating data fields, you must stretch the table to the point where there is an empty data field row and click on it to continue. You cannot append to a list you cannot see.
- The arrows only appear when there are more fields than shown, so their presence is itself a useful signal that you have hidden rows.
When stretching the table longer, sometimes it is hard — you must grab the edge just right. With a little practice it becomes easy (Figure 12).
A Note on Calculated Fields Like Age
The data field “Age” will later be calculated based on the Date and Date of Birth data fields. For now, it is just a data entry field. Making it a calculation must be done when creating or editing a form.
This is a subtle but important architectural point. In 4D, the Structure defines what data exists; the form defines how it is presented and computed. A field like Age is a derived value — it changes every day, so storing it as static data would be wrong. By attaching the calculation at the form level, you ensure Age is always current whenever the record is displayed.
If you are coming from a background in tools like Microsoft Access or FileMaker, this separation may feel unusual. In 4D, the discipline of keeping derived values out of the Structure pays off in cleaner data and fewer stale fields. For broader context on how database schemas separate stored and derived data, see the Wikipedia article on database normalization, which explains why storing redundant computed values is generally discouraged.
Finishing Up and Avoiding the Default-Forms Trap
When finished creating the data fields, close the Field Properties window by clicking the Done button.
Now a caution: with no forms created, if you close the Structure for Sample Database window you will be asked whether you want to create default forms (Figure 14). If you select “No,” the window will close and you will be taken to User mode. Since we are not ready to be in User mode yet, just leave the Structure for Sample Database window open for now.
This is a common early stumbling block. New developers close the Structure window, decline default forms, and suddenly find themselves in a runtime environment with nothing to run. The fix is simple — reopen the Structure — but the lesson is worth internalizing: in 4D, the Structure (design time) and User (run time) modes are distinct environments, and you move between them deliberately.
If you are curious how 4D fits into the broader landscape of rapid application development platforms, the Wikipedia overview of low-code development platforms is a useful reference for understanding the category 4D helped pioneer.
Best Practices for Structuring Fields Early
Because fields are permanent, a little planning up front saves a great deal of pain later. Consider these habits:
- Name fields consistently. Decide on a convention (e.g., “First Name,” “Last Name,” “Date of Birth”) and apply it everywhere. Consistency makes forms and code far easier to build.
- Reserve Alpha fields for keys. If a field will ever participate in a relationship, make it Alpha from the start. Converting later is not possible.
- Keep derived values out of the Structure. Age, totals, and similar computed values belong on forms or in methods, not as stored fields.
- Leave a few spare fields. Since you cannot delete, having unused slots available gives you room to adapt without cluttering your visible schema.
- Document as you go. A short note about each field’s purpose will save your future self — and any teammate — considerable guesswork.
For authoritative guidance on relational database design principles that underpin these decisions, the PostgreSQL documentation offers an excellent, vendor-neutral reference on data types and schema design, even though 4D’s implementation differs in its specifics.
Frequently Asked Questions
Can I delete a data field in 4D after creating it?
No. Once a data field is created in the 4D Structure, it cannot be deleted. Your options are to rename it, repurpose it for a different use later, or simply hide it. An empty field with no data does not significantly affect the size or operation of the program, so leaving an unused field in place is usually harmless.
What is the difference between a Text field and an Alpha field?
Text fields can hold up to 32,000 characters and have no fixed length limit. Alpha fields are length-limited — the default is 20 characters and the maximum is 80 — and the program enforces that limit at data entry. Critically, Alpha fields are the only field type that can be used as relationship keys.
Why can’t I see the new data field I just created?
If you continue creating fields past the visible rows of the table, they are added but not displayed. To see them, either drag the table longer or use the up and down arrows at the top of the table. The arrows only appear when there are more fields than the table can show.
How do I make a field like Age calculate automatically?
Calculated fields such as Age are not defined in the Structure. Instead, the calculation is attached when you create or edit a form. The Age field is first created as an ordinary data entry field, and the calculation based on Date and Date of Birth is added later at the form level.
What happens if I close the Structure window before creating forms?
If you close the Structure for Sample Database window with no forms created, 4D asks whether you want to create default forms. If you answer “No,” the window closes and you are taken to User mode. Since you are not ready to run the application yet, it is best to leave the Structure window open until your forms are built.
Why does clicking on the table sometimes open the wrong window?
Where you click determines which window appears. Clicking the table name area opens the Table Properties window, while clicking the squares in the data field area beneath the table name opens the Field Properties window. Aim for the grid of squares when you want to add or edit fields.
More on 4D (4th Dimension) database & low code app development tutorials
Browse our latest guides and reviews.
Read more →