Modeler:15/DataTypeWizard

From CaseTalk Wiki
Jump to: navigation, search

The Data Types wizard settles two questions that belong together: what a label type holds, and how the values under it are written. A value cannot be standardized before it is known what it is, so the wizard asks them in that order.

Open it from Run → Wizards → Data Types... It replaces the separate Derive Data Types and Extend Data Types commands.

Why

A data type is not decoration. Until a label type has one, nothing can check a value, offer a fitting editor, or store it in a form that means the same thing in another country. Anything may be entered at any time — the wizard is where a model catches up with what has been entered.

The four steps

1. Label types

Every label type in the model, grouped by the data type it carries today, with a count beside each group. The ones nothing is known about yet stand together under Not set yet, at the top. A label type whose data type is not a name CaseTalk recognises appears under Data type not recognised — worth a look, because such a type reads as untyped everywhere: in generated SQL, in exports, and in the editors.

Check the label types you want to work on, or leave everything unchecked to work on the whole model. Check all and Check none are there for the large models.

2. Data types

Option What it does Which label types
Determine the data types that are not set yet Reads the values and decides the type that fits them Only the ones still undecided
Also re-determine the checked label types Forgets what is declared and reads the values again Only the ones checked in step 1
Extend the data types a value has outgrown Keeps what is declared and only widens it — a longer text, another decimal The checked ones, or all

Re-determining is offered only for a checked selection, so a whole model is never re-typed by accident.

3. Values

Standardizing stores every value in one form that carries no language: dates as 2024-02-01, numbers with a dot for the decimals. The same value entered in two countries is then stored the same way, and a model exchanged between them keeps its meaning. What you see on screen stays in your own notation — only what is stored changes. From then on a value is read in the notation of the locale it is typed in and stored in the standard form, and how it reads back is decided per label type with Shown as in the label type editor.

Choose whether to standardize the label types the previous step just changed, or the ones you checked.

Values that cannot be read are listed and left exactly as they were. Nothing is ever dropped or guessed at.

4. Review

Everything the first three steps would change, grouped under Data types and Values, with what each value says now and what it will say. Finish keeps it; Back and Cancel undo it. Nothing is stored until you finish.

What is standardized

Data type Stored as Example
date YYYY-MM-DD 2024-02-01
time hh:mm:ss 13:05:09
datetime YYYY-MM-DDThh:mm:ss, without a timezone 2024-02-01T13:05:09
numeric, currency a dot for the decimals, no grouping, no currency symbol 1234.50
integer digits, no grouping 1234
boolean true or false true
guid one bracing and one casing {A1B2C3D4-...}
char, memo, blob, xml, json nothing to standardize — kept exactly as entered

A birthdate is deliberately not converted to UTC. A date has no timezone, and UTC would turn 1 January 1990 into 31 December 1989. Timezones belong to moments in time, not to dates people state.

Where the values come from

The wizard reaches every place a value of a label type is stored:

  • the population of the fact types the label type plays a role in;
  • the default value on a role;
  • the values listed in a value constraint. A range keeps its brackets and only its bounds are rewritten; a state transition is left alone, because it names states rather than values.

Notes

  • A subtype takes its data type from its domain, so the wizard never rewrites the type of a subtype. Its values are its own, and those are standardized.
  • Older values are never swept up silently. A model only changes when you run this wizard and finish it.
  • The wizard works on the repository in one go: finishing keeps the whole run, and anything else leaves the model exactly as it was.

See Also