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
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 consist of the following sections:
Common Section
Properties as Name, Caption, and Type are common for most of the widgets.
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
Symbol | Example | Description |
---|---|---|
G |
AD | The era |
y , yyy , yyyy , etc. |
2014 | Year |
yy |
14 | Year |
Y , YYY , YYYY , etc. |
2015 | Week year, use in combination with w for week number formatting |
YY |
15 | Week year, use in combination with w for week number formatting |
M , MM * |
12 | Month number |
MMM |
Dec | Month abbreviation |
MMMM |
December | Month name |
w , ww * |
1 | Week of year, use for week number formatting |
d , dd * |
30 | Day of month |
D , DD , DDD |
364 | Day of year |
a |
AM | AM or PM |
h , hh * |
12 | Hour (1-12) |
H , HH * |
00 | Hour (0-23) |
k , kk * |
24 | Hour (1-24) |
K , KK * |
00 | Hour (0-11) |
m , mm * |
27 | Minute |
s , ss * |
16 | Second |
S , SS , SSS |
789 | Milliseconds |
E , EE |
05 | Day of week number |
EEE |
Tue | Day of week abbreviation |
EEEE |
Tuesday | Day of week name |
X |
08:00 | Time zone parsed |
Z , ZZ , ZZZ |
-04:00 | Time zone offset |
ZZZZ |
GMT-04:00 | Time zone offset and standard |
*Two characters pads with zero
These are some examples:
Format | Example Output |
---|---|
EEEE d MMMM yyy G, h:mm a ss's' |
Tuesday 30 December 2014 AD, 12:27 AM 16s |
h:mm a |
12:27 AM |
yyy D KK:mm |
2014 364 00:27 |
EEEE MMMM d yyy |
Tuesday December 30 2014 |
EEE, MMM dd, ''yy |
Tue, Dec 30, ‘14 |
EEEE, 'week' ww YYYY |
Tuesday, 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.
In Mendix 8.0, an input widget connected to an attribute path must be read-only. Studio Pro will check this for you.
In Mendix 8.1 and above, you can edit attributes presented in input widgets over a 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.
Value | Description | Search Field Types | Date Input Query |
---|---|---|---|
Contains | Does the attribute value contain the entered value? | Text (attribute must be of type String) | |
Starts with | Does the attribute value start with the entered value? | Text (attribute must be of type String) | |
Greater | Is the attribute value greater than the entered value? | Text, Date | > date + 1 day |
Greater or equal | Is 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 equal | Is the attribute value not the same as the entered value? | Text, Date, Drop-down | != date |
Smaller or equal | Is the attribute value smaller than or equal to the entered value? | Text, Date | < date + 1 day |
Smaller | Is 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 value | Search query | Result example (input: August 4, 2100) | |
---|---|---|---|
None | Search 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, |
|
[%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.
[MyWebshop.Bicycle_Shop/MyWebshop.Shop/Country='Netherlands']
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