Developer Function: Server Script: view.SearchTypes
## Overview
"SearchTypes" of the "view object" is used in "[Server Script](/en/manual/table-management-server-script)" to specify search methods for column, such as partial match or exact match.
## Usage
The values that can be specified for SearchTypes are as follows. Depending on the format of the class column, different SearchTypes should be specified. Please refer to "Specifying by Format of Class Column" below for details.
|No|SearchTypes|Description|
|:----|:----|:----|
|1|PartialMatch|Filter by partial match. |
|2|ExactMatch|Filter by exact match. |
|3|ForwardMatch|Filter by forward match. |
|4|PartialMatchMultiple|Filter by partial match when an array is specified. |
|5|ExactMatchMultiple|Filter by exact match when an array is specified. |
|6|ForwardMatchMultiple|Filters by forward match when an array is specified. |
### Specifying by Format of Class Column
The table below shows the SearchTypes that should be specified for each class column format.
Free Text refers to cases where the class column is used as a free input column.
Option list refers to cases where options are set by entering them into an option list.
Link Settings refer to cases where data is read from a linked table and used as options.
*Those that can be searched as intended are marked with "Yes".
|SearchTypes|Free Text|Option list|Link Settings|
|:----|:----:|:----:|:----:|
|PartialMatch|Yes|No|No|
|ExactMatch|Yes|No|No|
|ForwardMatch|Yes|No|No|
|PartialMatchMultiple|Yes|Yes|No|
|ExactMatchMultiple|Yes|Yes|Yes|
|ForwardMatchMultiple|Yes|Yes|No|
If the class column is free text, the MatchMultiple filter will be displayed correctly only if an array is specified.
## Sample Data
The following usage example is based on the following table and record information.
Click ▼ to open the table.
<details>
<summary>Employee Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Department|Contact|
|:--:|:--:|:--:|:--:|:--:|
|10|Abe Kazuma|Shinnakano|General Affairs|123-123-123|
|11|Ando Sakura|Kitasenju|General Affairs|111-111-111|
|12|Kato Mio|Machida|General Affairs|456-456-45 6|
|13|Saito Kazumasa|Meguro|Accounting|789-789-789|
|14|Sato Masaki|Shinjuku|Sales|999-999-999|
|15|Miura Yuko|Kasai|Accounting|333-333-333|
|16|Yamazaki Shiro|Takadanobaba|Sales|555-555-555|
|17|Yamada Taro|Nakano|Sales|258-258-258|
</details>
## Usage Example 1
In the following example, the format of ClassA is free text, and it displays records where the value contains "Nakano".
##### JavaScript
```
view.Filters.ClassA = 'Nakano';
view.SearchTypes.ClassA = 'PartialMatch';
```
##### Filter Results
<details>
<summary>Employee Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Department|Contact|
|:--:|:--:|:--:|:--:|:--:|
|10|Abe Kazuma|Shin Nakano|General Affairs|123-123-123|
|17|Yamada Taro|Nakano|Sales|258-258-258|
</details>
## Usage Example 2
In the following example, the format of ClassA is free text, and it displays records where the value contains "Nakano" or "Meguro".
##### JavaScript
```
view.Filters.ClassA = '["Nakano","Meguro"]';
view.SearchTypes.ClassA = 'PartialMatchMultiple';
```
##### Filter Results
<details>
<summary>Employee Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Department|Contact|
|:--:|:--:|:--:|:--:|:--:|
|10|Abe Kazuma|Shin Nakano|General Affairs|123-123-123|
|13|Saito Kazumasa|Meguro|Accounting|789-789-789|
|17|Yamada Taro|Nakano|Sales|258-258-258|
</details>
## Usage Example 3
In the following example, the format of ClassA is set in a ["Option List"](https://pleasanter.org/manual/table-management-choices-text), and it displays records with options containing the string "Nakano".
##### JavaScript
```
view.Filters.ClassA = '["Nakano"]';
view.SearchTypes.ClassA = 'PartialMatchMultiple';
```
##### Filter Results
<details>
<summary>Employee Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Department|Contact|
|:--:|:--:|:--:|:--:|:--:|
|10|Abe Kazuma|Shin Nakano|General Affairs|123-123-123|
|17|Yamada Taro|Nakano|Sales|258-258-258|
</details>
## Usage Example 4
In the following example, ClassA has a [link](https://pleasanter.org/manual/table-management-choices-text-link) to the Employee Table, and it displays records for "Nakano" or "Meguro".
・Parent table: Employee Table
・Child table: Nearest Station Table
##### Child Table
<details>
<summary>Station Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Transport cost|Commute by train|
|:--:|:--:|:--:|:--:|:--:|
|20|Abe Kazuma|Shin-Nakano|¥680|Yes|
|21|Ando Sakura|Kita-Senju|¥890|Yes|
|22|Kato Mio|Machida|¥720|Yes|
|23|Saito Kazumasa|Meguro|¥680|Yes|
|24|Sato Masaki|Shinjuku|¥580|Yes|
|25|Miura Yuko|Kasai|¥0|No|
|26|Yamazaki Shiro|Takadanobaba|¥0|No|
|27|Yamada Taro|Nakano|¥0|No|
</details>
The following sample code is set in the "Nearest Station Table (Child)".
The filter settings specify the IDs (array format) of the corresponding records in the "Employee Table (Parent)".
Here, 13 (Meguro) and 17 (Nakano) are specified.
Also, the filter will display only records that match exactly with the linked record ID.
##### JavaScript
```
let list = ["13","17"]
view.SearchTypes.ClassA = 'ExactMatchMultiple';
view.Filters.ClassA = JSON.stringify(list);
```
##### Filter Results
<details>
<summary>Station Table (Click to view details)</summary>
|Record ID|Employee name (Title)|Nearest station (ClassA)|Transport cost|Commute by train|
|:--:|:--:|:--:|:--:|:--:|
|20|Abe Kazuma|Shin-Nakano|¥680|Yes|
|23|Saito Kazumasa|Meguro|¥680|Yes|
|27|Yamada Taro|Nakano|¥0|No|
</details>
## Related Information
<div id="ManualList"><ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />