使用字段组Use field groups

字段组提供了一种对实体的一个或多个字段进行分组的方法。Field groups provide a way to group one or more fields of an entity. 这个功能还可以帮助你提高创建和维护应用的速度,同时降低难度。Field groups can help speed up and simplify the creation and maintenance of apps. 一个字段组可以包含一个或多个字段,而一个字段可以出现在任意多个的字段组中。A field group contains one or more fields, and a field can appear in any number of field groups. 但一个字段在同一个字段组中不能出现多次。A field can't appear more than once in a field group.

字段组存储在实体中,并且可供使用同一实体的所有应用共享。Field groups are stored on an entity and shared across all apps that use the same entity. 在特定时间,可能有许多不同的应用使用同一个实体和实体中的字段组。At any given time, many different apps may use the same entity and field groups of that entity. 字段组的这种集中式管理和共享机制有助于实现一致性,因为不管在何处使用,字段组总是会显示相同的字段。This centralization and sharing of field groups helps enforce consistency, because a field group will always display the same fields wherever it's used. 同时,这也可以简化维护工作,因为对一个字段组进行更改后,所有使用该字段组的位置都会自动更新。This makes maintenance easy because a change to a field group is automatically reflected in all the places using that field group. 利用字段组可以提高应用编程和自定义流程效率,因为应用程序作者可以直接使用一组字段,而不需要逐一处理。Field groups help speed up the app authoring and customization process because an application author works with groups of fields, rather than individual fields.

默认字段组Default field groups

Common Data Service 的实体中包括几个默认字段组。Common Data Service includes several default field groups on entities. 这些字段组位于多个位置,可用于提高创建和自定义应用的速度,同时降低难度。These field groups are used in various places to help speed up and ease app creation and customization.

默认字段组名称Default field group name 说明Description
DefaultListDefaultList 用于以表形式显示记录列表。Used to display a list of records in a tabular format.
DefaultCardDefaultCard 用于以卡片形式显示记录列表。Used to display a list of records in a card format.
DefaultDetailsDefaultDetails 用于在视图和编辑窗格中显示单条记录的详细信息。Used to display the details of a single record in view and edit.
DefaultLookupDefaultLookup 用于显示查找控件以选择记录。Used to display a lookup to select a record.

查看字段组View a field group

  1. 登录到 powerapps.comSign in to powerapps.com.
  2. 如果你可以访问多个环境,请确保使用上栏中的环境选择器选择正确的环境。If you have access to more than one environment, ensure that you have the right environment selected using the environment picker in the top bar.
  3. 展开“Common Data Service”分区,并单击或点击左侧导航窗格中的“实体”。Expand the Common Data Service section, and click or tap Entities in the left navigation pane.
  4. 在实体列表中,单击或点击要查看其中的字段组的实体。In the list of entities, click or tap the entity that you want to view the field group for.
  5. 在字段列表上方的标题位置,单击或点击“字段组”。In the header above the list of fields, click or tap Field groups. 现在即可查看实体中当前存在的所有字段组。You now see all the field groups that currently exist for the entity.
  6. 在字段组列表中,单击或点击要查看其详细信息的字段组。In the list of field groups, click or tap the field group that you want to view the details for.
  7. 在字段组详细信息位置,可以看到并列的两个列表。In the field group details, there are two lists side-by-side. 一个列表的标题是“实体字段”,其中列出了实体中的所有字段。One is titled Entity fields and lists all the fields for the entity. 另一个列表的标题是“字段组字段”,其中列出了字段组中包含的字段。The other is titled Field group fields and lists the fields included in the field group.

修改字段组Modify a field group

  1. 查看要修改的字段组。View the field group that you want to modify.
  2. 要添加字段,请在“实体字段”列表中双击字段名称。To add a field, double-click a field name in the Entity fields list. 你也可以将字段从“实体字段”列表中拖放到“字段组字段”列表中。You can also drag and drop fields from the Entity fields list to the Field group fields list.
  3. 要删除字段组,请在“字段组字段”列表中单击字段名称旁的“X”。To remove a field group, click the X next to the field name in the Field group fields list.
  4. 单击或点击“保存”按钮。Click or tap the Save button.

备注

暂不支持修改标准实体的字段组,但可以修改自定义实体的字段组。*Modifying field groups for standard entities isn't currently supported, but you can modify field groups for your custom entities.*

创建字段组Creating a field group

创建实体时,PowerApps 会自动创建默认字段组。Default field groups are automatically created when you create an entity. 目前不支持创建其他字段组。Creating additional field groups isn't currently supported.

删除字段组Delete a field group

目前不支持删除字段组。Deleting a field group isn't currently supported.

在 Microsoft Excel 中查看和编辑字段组数据View and edit field group data in Microsoft Excel

  1. 查看要检查其数据的实体的字段组。View the field groups for the entity that you want to examine the data for.
  2. 每个字段组旁有一个 Excel 图标。There is an Excel icon next to each field group. 只有当字段组包含字段时,才会启用 Excel 图标。The Excel icon is enabled only if the field group has fields.
  3. 单击要在 Excel 中打开的字段组的 Excel 图标。Click the Excel icon for the field group that you want to open in Excel. 随即会生成一个工作簿,其中包含实体字段列表、Excel 加载项和一个指示环境的指针。A workbook is generated containing the entity field list, the Excel Add-in, and a pointer to your environment.
  4. 打开浏览器中生成的工作簿。Open the generated workbook that's provided by the browser.
  5. 打开后,启用编辑。After the workbook is open, enable editing. Excel 加载项随即会将数据读取到工作簿中。The Excel Add-in will then read the data into the workbook. 有关详细信息,请参阅在 Excel 中打开实体数据For more information, see Open entity data in Excel.

字段组使用方法Field group usage

使用默认字段组可以提高应用程序编程和自定义的速度。The default field groups help speed up application authoring and customization. 目前可以查看活动字段组的位置包括:Some places where you can currently see field groups in action are:

  • 实体表单控件 - 实体表单控件使用默认字段组显示动态表单,可以帮助提高应用编程效率,改善一致性,同时简化维护工作。Entity form control - Entity form control uses the default field groups to display dynamic forms that help speed up the app authoring process, help enforce consistency, and also ease maintenance. 有关详细信息,请参阅使用实体表单控件For more details, see Use the Entity Form control.
  • 查找控件 - 如果屏幕上有一个添加的字段引用了另一个关联的实体,则该字段会显示为查找控件(选择列表)。Lookup control - If one of the fields that you add on your screen is a reference to another linked entity, the field is rendered as a lookup control (picklist). 当用户单击查找控件以从关联的实体中选择记录时,显示的字段由关联实体上的 DefaultLookup 字段组决定。When a user clicks the lookup control to select a record from the linked entity, the fields displayed are determined by the DefaultLookup field group on the linked entity. 只会使用 DefaultLookup 字段组的前两个字段。Only the first two fields of the DefaultLookup field group are used.
  • 创建应用 - 通过从数据中选择创建应用的选项来生成应用时,会自动创建所选实体的屏幕。Creating an app - When you generate an app by choosing the option to create an app from data, the screens for the entity that you select are automatically created. “显示”屏幕上的“显示表单”控件和“编辑”屏幕上的“编辑表单”控件使用 DefaultDetails 字段组来确定默认添加到这些屏幕上的字段。The Display form control on the Display screen and the Edit form control on the Edit screen use the DefaultDetails field group to determine which fields will be added by default to those screens.