Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDL for 7.1 docs #17

Merged
68 changes: 68 additions & 0 deletions discover/portal/articles/130-forms/99-ddl/00-intro.markdown
@@ -0,0 +1,68 @@
# Dynamic Data Lists [](id=dynamic-data-lists)

Dynamic data lists display custom forms created from custom field sets called
*data definitions*. Data definitions consist of a form's field types (e.g.,
text, boolean, date, radio buttons, selector menus, etc.) and those fields'
labels and settings. Data definitions effectively serve as data models for a
dynamic data list. For example, you could create a data definition with 2 text
fields: 1 for a user's name, and 1 for their comments. You could then display a
form that gathers user feedback via a dynamic data list that uses that data
definition.

To summarize:

- **Data Definitions:** Define a form's fields.
- **Dynamic Data Lists:** Display a form based on a data definition.

Create one or multiple dynamic data lists from a single data definition. The
user data entered for each dynamic data list is kept separate, even if the data
definition is shared. For instance, you could use the example data definition
above to create several dynamic data lists, and then place them anywhere you
need to get feedback from users. Because each dynamic data list's form data is
separate, you don't need to worry about trying to figure out which dynamic data
list the user comment came from.

Dynamic data lists are flexible. Creating data definitions and lists doesn't
require any coding. Create data definitions and dynamic data lists in from the
Site Menu's Content → Dynamic Data Lists application. However, additional
formatting can be added with
[FreeMarker](https://freemarker.apache.org/)
templates. And you don't have to restrict dynamic data lists to simple input.
You could create something as complex as an entire data entry system for real
estate listings, or any other simple list-based application you can think of.

This section of articles shows you how to create and use data definitions and
dynamic data lists. You'll cover these topics:

- Creating data definitions.
- Creating dynamic data lists.
- Creating form and display templates.

## System Configuration

There are two Dynamic Data Lists entries in System Settings:

The Dynamic Data Lists Service entry contains one setting:

**Add Default Structures:**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated colon in every section of the System Configuration.

: This is enabled by default, and pre-loads several embedded data definitions to
base data lists on. Once loaded on portal startup, these definitions must be
manually deleted from the site menu. Dynamic Data Lists application. This
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary dot before Dynamic Data Lists.

setting applies to the first start of a virtual instance.

The Dynamic Data Lists entry contains three settings:

**Changeable Default Language:**
: If enabled, the default language of a data definition becomes changeable.

**CSV Export:**
: Choose whether DDL records can be exported in CSV format with or without a
warning, or disable this option. The warning displayed when the records are being
exported says

Warning: This CSV file contains user supplied inputs. Opening a CSV file
in a spreadsheet program may be dangerous.

**Default Display View:**
: Choose whether to use a table based default view or a list based default view.
<!-- I couldn't see this working. Might be non-functional-->
@@ -0,0 +1,134 @@
# Creating Data Definitions [](id=creating-data-definitions)

Follow these steps to create a data definition:

1. Open the Menu
(![Menu](../../../images/icon-menu.png))
and expand your site's menu (the Site Administration menu). Then select
*Content* &rarr; *Dynamic Data Lists*. This opens the Dynamic Data Lists
screen. A table lists any existing dynamic data lists.

2. Click the *Options* button at the top-right
(![Options](../../../images/icon-options.png))
and select *Manage Data Definitions*. The Data Definitions screen appears. A
table lists any existing data definitions. Several definitions are embedded
for common use cases like contacts, events, inventory, and more.

![Figure 1: The Data Definitions screen.](../../../images/ddl-definitions.png)

3. Click the *Add* button
(![Add](../../../images/icon-add.png))
to begin creating a new data definition. This opens the
*New Data Definition* form.

4. Give your data definition a name. Note that the definition's name will
appear to any users filling out a dynamic data list that uses the
definition. Then expand the *Details* section of the form and give it a
description.

5. The Details section of the form also contains the field *Parent Data
Definition*. This optional field lets you select an existing data definition
(the parent) to form the basis of the new one (the child). The child
definition inherits the parent's fields and settings, which you can then add
to. When you create a dynamic data list from a child definition, it includes
the fields of the parent and child definitions. This lets you use a common
definition (the parent) as the basis of a specialized definition (the
child). For example, if you were planning a rock climbing trip, you could
use the default Events definition as the parent of a Rock Climbing Trip
definition that contains fields unique to rock climbing (e.g., climbing
equipment availability, altitude, etc.).

To choose a parent definition, click the *Select* button below the *Parent
Data Definition* field and then select an existing definition in the dialog
that appears.

![Figure 2: After naming your data definition, expand the Details section of the form and give your definition a description and parent definition, if desired.](../../../images/ddl-definition-form-01.png)

6. Add the data definition's fields in the data definition designer, which is
below the form's Details section. The designer's *View* tab, which is
selected by default, lets you create the definition in a WYSIWYG editor. You
can click the *Source* tab to work with the definition's underlying XML, but
it's much easier to stick with the WYSIWYG editor.

In the *View* tab select the *Fields* tab. Icons representing the field
types are listed on one side and the data definition's canvas is on the
other side. To add a field type to the definition, select its icon, drag,
and drop it onto the canvas. By dragging a field onto a field that's already
on the canvas, you can nest the new field in the existing field. When you
mouse over a field on the canvas, the field action icons
(![Icons](../../../images/icon-ddl-actions.png))
appear. Clicking the *+* icon creates a duplicate of the current field and
adds it below the current field. Clicking the trash can deletes the field.

The following fields are available:

- **Boolean:** A check box.
- **Color:** Specifies a color.
- **Date:** Enter a date. A valid date format is required for the date
field, but you don't have to enter a date manually. When you select the
date field a mini-calendar pops up which you can use to select a date.
- **Decimal:** Enter a decimal number. The value is persisted as a
`double`.
- **Documents and Media:** Select a file from a Documents and Media
library.
- **Geolocation:** Specify a location to associate with the document.
- **HTML:** An area that uses a WYSIWYG editor to enhance the content.
- **Integer:** Enter an integer. The value is persisted as an `int`.
- **Link to Page:** Link to another page in the same site.
- **Number:** Enter a decimal number or an integer. The value is
persisted either as a `double` or an `int`, depending on the input's
type.
- **Radio:** Displays several clickable options. The default number of
options is three but this is customizable. Only one option can be
selected at a time.
- **Select:** This is just like the radio field except that the options
are hidden and must be accessed from a drop-down menu.
- **Text:** Enter a single line of text.
- **Text Box:** This is just like the text field except you can enter
multiple lines of text or separate paragraphs.
- **Web Content:** Select web content.

![Figure 3: Use the data definition designer to add fields to the data definition.](../../../images/ddl-data-definition-designer.png)

7. Edit field labels to reflect their intended data. A text field's default
label is *Text*. To use the text field as a title, then you should change
the field's label to *Title*. First select the field on the canvas. This
automatically selects the *Settings* tab on the left. Alternatively, you
can access the Settings tab by clicking the field's wrench icon. To edit a
setting value, double-click it in the Settings table and enter the new
value. The available settings are listed below.

You can translate each of a data definition's field values to any supported
locales. To specify a field value for a translation, select the flag that
represents the locale and enter the field value for the locale.

The following field settings are available. Note that some of these settings
are only available for specific field types:

- **Type:** The field's type (e.g., text, radio, etc.). This setting can't
be edited, but a display template can reference it.
- **Field Label:** The field's display name.
- **Show Label:** Whether the field label is shown.
- **Required:** Whether users must fill out the field (not available for
Boolean fields).
- **Name:** The field's internal identifier. You can use this value in a
display template to read the field's data. This value is automatically
generated, but you can change it if you wish.
- **Predefined Value:** The field's default value.
- **Tip:** Text to display in a tooltip.
- **Indexable:** Whether the field is indexed for search.
- **Localizable:** Whether the field can be translated.
- **Repeatable:** Whether users can make copies of the field.
- **Width:** The field's width on the page. Possible width values are
*Small*, *Medium* and *Large* (not available for these field types:
Boolean, Documents and Media, Geolocation, Radio, and Select).
- **Multiple:** Whether the user can select more than one option. This is
only available for Select fields.
- **Options:** The options available for selection in Radio and Select
fields. You can add and remove options, and edit each option's display
name and value.

![Figure 4: Configure the settings for each field in your data definition.](../../../images/ddl-data-definition-settings.png)

8. Click *Save* when you're done. Your new data definition then appears in the
table with the pre-defined ones and any you've already added.
@@ -0,0 +1,57 @@
# Managing Data Definitions [](id=managing-data-definitions)

There are several things you can do to manage your data definitions. Of course,
you can edit a data definition, but you can also configure its permissions,
manage its templates, copy it, or delete it.

Follow these steps to access your portal's data definitions:

1. Open the Menu
(![Menu](../../../images/icon-menu.png))
and expand your site's menu (the Site Administration menu). Then select
*Content* &rarr; *Dynamic Data Lists*. This opens the Dynamic Data Lists
screen. A table lists any existing dynamic data lists.

2. Click the *Options* button at the top-right
(![Options](../../../images/icon-options.png))
and select *Manage Data Definitions*. The Data Definitions screen appears. A
table lists the data definitions.

![Figure 1: You can copy an existing data definition, manage its templates, and more.](../../../images/ddl-definitions-actions.png)

You can manage your data definitions via the *Actions* menu
(![Actions](../../../images/icon-actions.png))
for each definition. The following options are available:

- **Edit:** Edit the data definition. The edit screen uses the same form
that's used to
[create data definitions](/discover/portal/-/knowledge_base/7-1/creating-data-definitions).
Note that if you edit a data definition that is referenced elsewhere (e.g.,
by a dynamic data list or display template), then you'll need to update that
reference.

- **Manage Templates:** Opens the *Manage Templates* screen, which lets you
create and manage templates for the data definition. For details, see the
[documentation on templates](/discover/portal/-/knowledge_base/7-1/using-templates-to-display-forms-and-lists).

- **Permissions:** Configure the data definition's permissions. Note that
these permissions are for an individual definition accessed through the
Dynamic Data Lists application in *Site Administration* &rarr; *Content*
&rarr; *Dynamic Data Lists*. For example, if site members have View
permission for a data definition, any site member who also has a role that
can access the Dynamic Data Lists app and its data definitions can see this
definition listed in the Manage Data Definitions screen. If you don't want
this, deselect the View permission for Site Member, and site members won't
see your data definition listed with the others.

- **Copy:** Opens the *Copy Data Definition* form, which lets you copy the
definition and its templates. In the form, give the copied definition a new
name and description, and select whether to also copy the original
definition's templates. Click *Copy* when you're done. The copied definition
then appears in the Data Definitions table alongside any other existing
definitions. This lets you create new definitions based on existing ones,
and then modify the copied one to suit your needs. You can, of course, edit
any definition in the portal, but if you copy a definition instead, you can
still access the original.

- **Delete:** Delete the definition.
@@ -0,0 +1,116 @@
# Creating Data Lists [](id=creating-data-lists)

There are two places where dynamic data lists are created:

1. **Site Administration:** Open the Menu
(![Menu](../../../images/icon-menu.png))
and expand your site's menu (the Site Administration menu). Then select
*Content* &rarr; *Dynamic Data Lists*. This opens the Dynamic Data Lists
screen. A table contains any existing lists. Click the *Add* button
(![Add](../../../images/icon-add.png))
to open *New List* form.

To add Dynamic Data Lists, you must have permission to access the Dynamic
Data Lists app in Site Administration.

2. **Dynamic Data Lists Display widget:** Navigate to the site page you want to
place this widget on, and add it to the page from *Add*
(![Add](../../../images/icon-add-app.png))
&rarr; *Widgets* &rarr; *Collaboration* &rarr; *Dynamic Data Lists Display*.
Then click the widget's *Add List* button. This opens the *New List* form.

To do this, you must have permission to create a new list in the widget.

Regardless of which option you use, the steps to create a new list in the New
List form are the same:

1. Give the list a name and a description.

2. Select the list's data definition: click *Select* under the *Data
Definition* field, then click the definition you want to use.

3. To use a workflow with this list, select it from the *Workflow* menu.

4. To change the list's default permissions, expand the form's *Permissions*
section and make your selections.

5. Click *Save* to finish creating the list. Your new list appears in the table
with any others.

![Figure 1: The New List form.](../../../images/ddl-add-list.png)

## Creating List Records [](id=creating-list-records)

By default, only administrators have permission to create list records. Follow
these steps to give other users this permission as well:

1. Navigate to *Content* &rarr; *Dynamic Data Lists* in Site Administration.

2. Click *Actions*
(![Actions](../../../images/icon-actions.png))
&rarr; *Permissions* for the list you want to add the permission to.

3. Select *Add Record* for the roles you want to have that permission, then
click *Save*. Allow unauthenticated Users to add records by giving Guest the
Add Record permission.

Create new records in a list from the same places you can create the lists
themselves:

1. **Site Administration:** In Site Administration, navigate to *Content*
&rarr; *Dynamic Data Lists*. Click a list in the table to view any existing
records, then click the *Add* button
(![Add](../../../images/icon-add.png)).
This opens a form based on the list's data definition, which you can then
fill out and submit to create a new record. To do this, you must have
permission to access the Dynamic Data Lists app in Site Administration.

2. **Dynamic Data Lists Display widget:** See above for instructions on adding
this widget to a page. You must then configure the widget to display a
list's records.

To configure the widget to display a list's records:

- Click the widget's *Select List* button.
- In the dialog that appears, select a list, click *Save*, then close the
dialog. The widget then displays the list's existing records.

To add a record:

- Click the widget's *Add* button
(![Add](../../../images/icon-add.png)).
- Fill out the form that appears and click *Publish*.

See the section below for more information on configuring the widget.

![Figure 2: Dynamic Data Lists Display widget.](../../../images/ddl-widget.png)

## Configuring the Dynamic Data Lists Display Widget [](id=configuring-the-dynamic-data-lists-display-widget)

The widget's default display template isn't exciting, but it lets users see the
list's contents, and if they have permission, to add and/or edit list items. To
configure the widget, click its *Options* menu
(![Options](../../../images/icon-app-options.png))
and select *Configuration*. This opens the Configuration dialog, with the
*Setup* tab selected by default. The Setup tab contains 2 other tabs:

- **Lists:** Lets you select the list that the widget displays. The currently
displayed list appears at the top of the tab, while the available lists
appear in a table. To change the widget's list, select the list from the
table and click *Save*.

- **Optional Configuration:**

- **Display Template:** The widget's display template.
- **Form Template:** The widget's form template.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the Display and Form templates are associated with the list being displayed in the Widget. 😉

- **Editable:** Whether users can add records to the widget's list.
- **Form View:** Whether to display the Add Record form bey default,
instead of the List View. Note that even without this selected,
users can still add records via the widget's *Add* button
(![Add](../../../images/icon-add.png)).
- **Spreadsheet View:** Whether the List View displays each record in a
row, with columns for the record attributes.

When finished, click *Save* and close the Configuration dialog.

![Figure 3: The Dynamic Data Lists Display widget's optional configuration.](../../../images/ddl-widget-options.png)