If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.

Search Bar

Last modified: August 20, 2024

Introduction

The search bar contains search fields that allow the end-user to quickly find the information they need in a data grid or template grid.

To add a search field to the search bar, right-click within the search bar in your data grid and choose Add search field > Type of the search field.

Search Field Types

There are three different types of search fields that can be used for different kinds of information:

  • Comparison – Search results are filtered by comparing them to the given search term. If the search value matches the attribute value, this object will be a part of the search result. Possible attribute types: AutoNumber, Date and Time, Integer, Long, String, Decimal.
  • Drop-down – Search results are filtered by comparing them to the given search term. If the search value matches the attribute value, this object will be a part of the search result. Possible attribute types: Boolean, Enumerations, Associations.
  • Range – This will apply a filter based on whether the search term falls between the values of two selected attributes. Possible attribute types: AutoNumber, Date and Time, Integer, Long, Decimal.

Search Field Properties

Search field properties depend on the type of the search field.

An example of drop-down search field properties properties is represented in the image below:

Search Field Properties

Search field properties consist of the following sections:

Common Section

Properties as Name, Caption, and Type are common for most of the widgets.

For more information on properties in this section, see the Common Section section in Properties Common in the Page Editor.

However, there are additional properties that are described in the sections below.

Custom Date Format

Custom date format is only available when you select an attribute of Date and Time type in the Attribute (path) property. This property determines how the attribute value is formatted. The custom date format is a string that allows for any combination of symbols found in the table below. Any punctuation will be rendered literally. The Format example will show you a date example.

All examples are for 30th December 2014, at 00:27:16.789

SymbolExampleDescription
GADThe era
y, yyy, yyyy, etc.2014Year
yy14Year
Y, YYY, YYYY, etc.2015Week year, use in combination with w for week number formatting
YY15Week year, use in combination with w for week number formatting
M, MM*12Month number
MMMDecMonth abbreviation
MMMMDecemberMonth name
w, ww*1Week of year, use for week number formatting
d, dd*30Day of month
D, DD, DDD364Day of year
aAMAM or PM
h, hh*12Hour (1-12)
H, HH*00Hour (0-23)
k, kk*24Hour (1-24)
K, KK*00Hour (0-11)
m, mm*27Minute
s, ss*16Second
S, SS, SSS789Milliseconds
E, EE05Day of week number
EEETueDay of week abbreviation
EEEETuesdayDay of week name
X08:00Time zone parsed
Z, ZZ, ZZZ-04:00Time zone offset
ZZZZGMT-04:00Time zone offset and standard

*Two characters pads with zero

These are some examples:

FormatExample Output
EEEE d MMMM yyy G, h:mm a ss's'Tuesday 30 December 2014 AD, 12:27 AM 16s
h:mm a12:27 AM
yyy D KK:mm2014 364 00:27
EEEE MMMM d yyyTuesday December 30 2014
EEE, MMM dd, ''yyTue, Dec 30, '14
EEEE, 'week' ww YYYYTuesday, week 01 2015

Placeholder Text

Placeholder text is only available when you select an attribute of Date and Time type in the Attribute (path) property.

The placeholder text is shown if the date attribute is empty. It can be used to give the end-user a hint as to the expected format.

General Section

Attribute (Path)

Many input widgets (like text boxes and drop-down widgets) can be connected to the following:

  • An attribute of the entity of the data view that contains the widget; in this case, the widget is connected to an attribute
  • An attribute of an entity associated with the data view entity by following one or more associations of the reference type through the domain model; in this case, the widget is connected to an attribute path

In the first case, we say the widget is connected to an attribute, and in the second case it is connected to an attribute path.

Comparison

The value entered by the end user (or the default value in the case of hidden and read-only search fields) is compared to the value of the attribute of each of the objects in the grid. If the match succeeds, the object will be part of the search result. There are different ways in which the attribute value and the entered value can be compared. In the third column below you see the type of search field for which the comparison operator is allowed.

ValueDescriptionSearch Field TypesDate Input Query
ContainsDoes the attribute value contain the entered value?Text (attribute must be of type String)
Starts withDoes the attribute value start with the entered value?Text (attribute must be of type String)
GreaterIs the attribute value greater than the entered value?Text, Date> date + 1 day
Greater or equalIs the attribute value greater than or equal to the entered value?Text, Date> date
Equal (default)Is the attribute value the same as the entered value?Text, Date, Drop-down>= date and < date + 1 day
Not equalIs the attribute value not the same as the entered value?Text, Date, Drop-down!= date
Smaller or equalIs the attribute value smaller than or equal to the entered value?Text, Date< date + 1 day
SmallerIs the attribute value smaller than the entered value?Text, Date< date

Date comparisons and the influence of the default value

It is possible to search on date attributes using equality. What happens with the time component belonging to the date is dependent on the default value of the comparison search field.

Default valueSearch queryResult example (input: August 4, 2100)
NoneSearch field is empty. Represents a 24 hour date range starting at midnight of the specified date.Search between August 4, 0:00 - August 5, 0:00
[%CurrentDateTime%]Search field shows the current date. Represents a 24 hour date range starting at the current time.Search between August 4, and August 5,
[%BeginOfCurrentDay%]Search field shows the current date. Represents a 24 hour date range starting at midnight of the specified date.Search between August 4, 0:00 - August 5, 0:00

Allow Multi-Select

If this property is set to 'Yes', the resulting drop-down allows you to select multiple values instead of just one. When searching all records match for which the corresponding attribute is equal to one of the selected values. For example, you can search for all orders with status 'Submitted' or 'In progress'.

XPath Constraint

If the 'drop-down' search field is connected to an attribute of an associated entity (as opposed to the grid entity itself) the XPath constraint can be used to limit objects shown in the drop-down.

Sort Order

The sort order specifies the order in which the items in the drop-down search field are shown. You can sort on multiple attributes in both directions (ascending and descending). If no sort order is specified, the drop-down search field sorts on the displayed attribute.

Default: No sort order

Lower Bound

This attribute (path) determines the lower bound of the range.

Lower Bound Operator

The lower bound operator determines whether the comparison with the lower bound is inclusive (>=) or not (>). It can be either 'Greater' or 'Greater or equal'.

Default: Greater

Upper Bound

This attribute (path) determines the upper bound of the range.

Upper Bound Operator

The upper bound operator determines whether the comparison with the upper bound is inclusive (<=) or not (<). It can be either 'Smaller' or 'Smaller or equal'.

Default: Smaller

Read More