STRING_ENUMERATION

To configure a string enumeration field, set the field type to STRING_ENUMERATION:

Retrieval

Include the string enumeration field in the select clause:

select GENRE from ZBKS_BOOK

The retrieval field should be defined as follows:

<CustomRetrievalField>
<FieldRef levelType="ZBKS.Book" category="PDF">
<FieldName>Genre</FieldName>
</FieldRef>
<Type>STRING_ENUMERATION</Type>
<EnumerationType>ZBKS.Genre</EnumerationType>
<SimpleMapping sqlName="GENRE"/>
</CustomRetrievalField>

Filter

For the filter field, you can specify either a single-select or multi-select field. Here are examples of each:

Single-select

Provide the following in the WHERE clause of the SQL:

${filterIfNotNull:GENRE,genre = $GENRE$}

The filter field definition is as follows:

<CustomFilterField>
<FieldRef category="PDF" levelType="ZBKS.Book">
<FieldName>Genre</FieldName>
</FieldRef>
<Type>STRING_ENUMERATION</Type>
<EnumerationType>ZBKS.Genre</EnumerationType>
<SimpleMapping sqlName="GENRE"/>
</CustomFilterField>

Multi-select

Provide the following in the WHERE clause of the SQL. Note the difference from the clause used for the single-select variation:

${filterIfNotNull:GENRE,genre IN $GENRE$}

The filter field definition is the same as single-select, except there's an extra attribute uiFieldRenderMode which tells the UI to display it as a checkbox group:

<CustomFilterField uiFieldRenderMode="ColumnarCheckboxesNoButtons">
<FieldRef category="PDF" levelType="ZBKS.Book">
<FieldName>Genre</FieldName>
</FieldRef>
<Type>STRING_ENUMERATION</Type>
<EnumerationType>ZBKS.Genre</EnumerationType>
<SimpleMapping sqlName="GENRE"/>
</CustomFilterField>

To display a different column name for the string enumeration, provide the level type as "Undefined", with the desired column name in the field name:

<CustomFilterField>
<FieldRef category="PDF" levelType="Undefined">
<FieldName>TypeOfBook</FieldName>
</FieldRef>
<Type>STRING_ENUMERATION</Type>
<EnumerationType>ZBKS.Genre</EnumerationType>
<SimpleMapping sqlName="GENRE"/>
</CustomFilterField>

Following are the key points to note:

  • levelType in the FieldRef is pointed to the ZBKS.Book model, which is where the Genre field is defined.

  • category is set to PDF (Pre-defined field)

  • Type is set as STRING_ENUMERATION (Note the capital letters)

  • SimpleMapping is used to map the field with the SQL parameter

  • EnumerationType is used to define where the enumeration is mapped to

  • To display a different label for this field, set the level type as Undefined and populate the field name with the required label.

Following uiFieldRenderMode are supported for String Enumeration filter field:

  • ColumnarCheckboxes: Display the fiter field with checkboxes in 3-column layout (multi-select).

    images/download/attachments/144835581/ColumnarCheckboxes-version-1-modificationdate-1645046667000-api-v2.png

  • RadioGroup: Display the filter field with radio-buttons in 3-column layout (single-select).

    images/download/attachments/144835581/RadioGroup-version-1-modificationdate-1645046673000-api-v2.png

  • EnumAutocompleteField: Display the filter field with auto-complete option (multi-select).

    images/download/attachments/144835581/EnumAutoComplete-version-1-modificationdate-1645046681000-api-v2.png