Back to Nocobase

China region

docs/docs/en/data-sources/data-modeling/collection-fields/advanced/china-region.md

2.1.275.6 KB
Original Source

China region

<PluginInfo name="field-china-region"></PluginInfo>

Introduction

In NocoBase, China region stores Chinese administrative-division information such as provinces, cities, and districts.

The China region field uses the built-in chinaRegions administrative-division collection and a cascading selector for data entry. Users select province, city, and district in order; values display as a complete hierarchical path.

For street and building-number information, use Input or Textarea.

Use cases

China region is suitable for these business scenarios:

  • Locations of customers, contacts, stores, and projects
  • Address basics such as registered residence, birthplace, and shipping region
  • Service areas, sales territories, and project implementation areas
  • Data that needs filtering or aggregation by province, city, and district

Create and configure

On the collection's Configure fields page, click Add field and select China region.

SettingDescription
Field interfaceChina region uses chinaRegion, which determines how the field is entered and displayed.
Field display nameUse a business-friendly name such as Region, Service area, or Shipping region.
Field nameThe internal identifier used by APIs, relation fields, permissions, and workflows. It supports only letters, numbers, and underscores, and must begin with a letter.
Field typeChina region is normally stored as a related record or structured value, depending on field configuration.
Selection levelControls the deepest selectable level. Province, City, and District are supported; the default is District.
Require the last levelWhen enabled, users must select the configured deepest level before submitting. Otherwise, they can complete selection at an intermediate level.
Validation rulesConfigure required validation and selection level as needed.
DescriptionRecord the field meaning, entry requirements, data source, or maintainer.

:::warning Note

Field names are referenced by page blocks, permissions, workflows, and APIs after creation. Confirm the name before creating the field to avoid later configuration changes.

:::

Field behavior

BehaviorDescription
Default Field interfacechinaRegion.
Data sourceThe built-in chinaRegions administrative-division collection.
Page componentUses a cascading selector in edit mode.
Selection levelsSupports Province, City, and District.
DisplayDisplays a Province / City / District path in read mode.
FilteringSupports filtering by saved region values; capabilities depend on field configuration and blocks.
Multiple selectionNot supported.

Edit configuration

Click Edit beside the field to change its display name, description, validation rules, selection level, and whether the last level is required.

For a field from a synchronized main-database table, editing usually maps the database field to a NocoBase Field type and Field interface.

SettingCan be editedDescription
Field display nameYesChanges the name displayed in the interface without changing the field identifier.
Field nameNoThe identifier normally cannot be changed after creation.
Field interfaceConditionalMain-database and synchronized fields can be adjusted during mapping.
Field typeConditionalConfirm that existing values are compatible before changing it.
Selection levelYesChanges the selectable deepest level to Province, City, or District.
Require the last levelYesControls whether the configured deepest level must be selected before submission.
Validation rulesYesAdjusts required and other validation.
DescriptionYesAdds maintenance information for the field.

:::warning Note

China region depends on the plugin-provided chinaRegions collection. Enable the China region field plugin before using it.

:::

Delete field

Click Delete beside a China region field to delete it. You can also select multiple fields and delete them in the main data source.

Deleting a China region field created in the main database usually also deletes the actual database column and its values. For a synchronized or external-data-source field, the impact depends on the data source and field origin.

:::danger Warning

Deleting a field can affect page blocks, forms, filters, permissions, workflows, APIs, imports and exports, and existing data. Confirm that the field is no longer referenced before deleting it.

:::

Use in pages

China region fields are suitable for addresses, regions, and statistical scenarios.

ScenarioUse
Form blockSelect province, city, and district with a cascading selector.
Details blockDisplay an administrative-division path.
Table blockDisplay the region of a record.
Filter blockFilter records by region.
Chart blockAggregate business data by province, city, or district.

Edit mode

China region uses a cascading selector in edit mode.

Read mode

China region displays as a text path in read mode, for example:

text
Beijing / Municipal district / Dongcheng District
  • Fields - Learn about field categories and mapping.
  • Input - Store detailed street addresses.
  • Textarea - Store longer address descriptions.