User Manual

08.14.2024

MANUAL

Developer Function: Server Script: view.Filters

## Overview "Filter" of the "view object". By "[Filter](/en/manual/table-management-filter)" the "records" displayed in the "[List Screen](/en/manual/table-grid)" or "[Editor](/en/manual/table-management-editor)" with "[Server Script](/en/manual/table-management-server-script)", you can limit the records that users can view. Unlike "[Record Access Control](/en/manual/table-record-access-control)", there is no need to set access rights for each "Record". "「JSON Data Layout: View」" can be used. ## Supported Versions #### "[Filter](/en/manual/table-management-filter)" with OR Conditions 1. Pleasanter 1.1.14.0 or later 1. Pleasanter .NET Framework version 0.50.220 or later #### "[Filter](/en/manual/table-management-filter)" with AND Conditions 1. .NET Core version 1.1.28 or later 1. .NET Framework version 0.50.252 or later #### "[Filter](/en/manual/table-management-filter)" with Match/Non-Match Conditions 1. .NET Core version 1.3.18.0 or later 1. .NET Framework version 0.51.18.0 or later ## Limitations 1. Only the "When Processing View" condition can be used. 1. "[Attachment Item](/en/manual/table-management-attachments)" and "[Comment Item](/en/manual/table-management-comments)" cannot be used. 1. The "[Filter](/en/manual/table-management-filter)" operation on the "[List Screen](/en/manual/table-grid)" does not work for items for which filters have been set using "[Server Script](/en/manual/table-management-server-script)". They will be overwritten by "[Server Script](/en/manual/table-management-server-script)". 1. Search results may differ when using SQL Server and PostgreSQL. SQL Server uses the LIKE clause or full text search, while PostgreSQL uses the ILIKE clause or full text search using pg_trgm. ## Notes 1. Even if you use the view.Filters function to filter records so that they are not extracted on the list screen, they will still be displayed in the search results list in "[Cross Search](/en/manual/crosssearch)". To prevent this, you must disable cross-search in the table management settings "[Disable Cross Search](/en/manual/table-management-disable-cross-search)". ## Properties |No|Property name|Change|Description| |:--|:--|:--|:--| |1|[Column Name]|○|Specify the "[Column Name](/en/manual/dev-column-name)" to apply the "[Filter](/en/manual/table-management-filter)" to and set the filter string. | ## Method There are no methods. ## Usage Example ① In the example below, records with a "[Status Item](/en/manual/table-management-status)" of 900 (Completed) or 910 (Pending) are extracted and displayed. ##### JavaScript ``` view.Filters.Status = '["900","910"]'; ``` In the example below, records with "[User](/en/manual/table-management-choices-text-users)" IDs 215 and 319 set in the "[Person In Charge Item](/en/manual/table-management-owner)" will be extracted and displayed. ##### JavaScript ``` view.Filters.Owner = '["215","319"]'; ``` In the example below, records with values ​​set in the "[Numerical Item](/en/manual/table-management-num)" between 600000 and 700000 will be extracted and displayed. If you omit the part before the comma, records with values ​​below 700000 will be extracted and displayed, and if you omit the part after the comma, records with values ​​above 600000 will be extracted and displayed. To search for multiple ranges, specify '["100000,200000","600000,700000"]'. ##### JavaScript ``` view.Filters.NumA = '["600000,700000"]' ``` In the example below, records, where the date set in the "[Date Item](/en/manual/table-management-date)" is today, will be extracted and displayed. '["Today"]' will extract today, '["ThisMonth"]' will extract this month, and '["ThisYear"]' will extract this year. ##### JavaScript ``` view.Filters.DateA = '["Today"]'; ``` In the example below, records with dates set in the "[Date Item](/en/manual/table-management-date)" between 2021/5/1 00:00:00 and 2021/5/31 23:59:59.997 will be extracted and displayed. If you omit the part before the comma, records with dates before 2021/5/31 23:59:59.997 will be extracted and displayed, and if you omit the part after the comma, records with dates after 2021/5/1 00:00:00 will be extracted and displayed. To search multiple ranges, specify '["2021/1/1,2021/1/31 23:59:59.997","2021/5/1,2021/5/31 23:59:59.997"]'. ##### JavaScript ``` view.Filters.DateB = '["2021/5/1,2021/5/31 23:59:59.997"]' ``` In the example below, records with the "[Check Item](/en/manual/table-management-check)" checked will be extracted and displayed. Assigning false will extract records with the item checked. ##### JavaScript ``` view.Filters.CheckA = true; ``` In the example below, records containing the word "Software" in the "「Content Item」" item will be extracted and displayed. By setting the "[Search Type](/en/manual/table-management-filter-search-types)" in the "[Filter](/en/manual/table-management-filter)" of "[Table Management](/en/manual/table-management)", you can perform not only a "Partial Match Search", but also a "Prefix Match Search" and "Exact Match Search". Similar searches can also be performed in "[Title Item](/en/manual/table-management-title)", "Description Item", and "[Classification Item](/en/manual/table-management-class)" with no options. ##### JavaScript ``` view.Filters.Body = 'software'; ``` In the example below, records where the "[Status Item](/en/manual/table-management-status)" is 900 (Completed) and the date set in the "[Date Item](/en/manual/table-management-date)" is today will be extracted and displayed. If multiple different items are set, they will be "[Filter](/en/manual/table-management-filter)" using the AND condition. ##### JavaScript ``` view.Filters.Status = '["900"]'; view.Filters.DateA = '["Today"]'; ``` In the example below, records with "[Status Item](/en/manual/table-management-status)" set to 900 (Completed) or "[Classification Item](/en/manual/table-management-class)" set to "Design" will be extracted and displayed. You can "[Filter](/en/manual/table-management-filter)" using OR conditions by assigning a filter condition in JSON format to any property that begins with "or_". You must explicitly disable the "filter" operation from the screen. ##### JavaScript ``` // Disable filter operations from the screen view.Filters.ClassA = ''; view.Filters.Status = ''; // Setting an OR condition let data = {}; data.Status = '["900"]'; data.ClassA = '["design"]'; view.Filters.or_MyFilterName = JSON.stringify(data); ``` In the example below, when accessed by a user with department ID 3, records with HR set as a choice for "[Classification Item](/en/manual/table-management-class)" are extracted and displayed. When accessed by a user with department ID 7, records with Development set as a choice for "[Classification Item](/en/manual/table-management-class)" are extracted and displayed. When accessed by a user from any other department, all records are extracted and displayed. ##### JavaScript ``` context.Log(context.DeptId); switch (context.DeptId) { case 3: view.Filters.ClassA = '["personnel"]' break; case 7: view.Filters.ClassA = '["development"]' break; default: break; } ``` In the example below, if a user other than user ID 2 accesses the page, records where ClassA is Design and ClassD is 3, or records where ClassB is Testing and ClassD is 7 will be extracted and displayed. If a user with user ID 2 accesses the page, all records will be extracted and displayed. By assigning a filter condition in JSON format to any property beginning with and_, you can perform a "[Filter](/en/manual/table-management-filter)" that combines OR conditions and AND conditions. ##### JavaScript ``` if (context.UserId !== 2) { let data1 = {}; data1.ClassA = '["design"]'; data1.ClassD = '["3"]'; let data2 = {}; data2.ClassA = '["test"]'; data2.ClassD = '["7"]'; let data = {}; data.and_Filter1 = JSON.stringify(data1); data.and_Filter2 = JSON.stringify(data2); view.Filters.or_Filter = JSON.stringify(data); } ``` In the example below, records with Nakano-ku, Tokyo set in ClassB of the record of site ID 6 linked with ClassA will be extracted and displayed. The following description allows you to filter by the items of the master record. ``` view.Filters['ClassA~6,ClassB'] = 'Nakano Ward, Tokyo'; ``` In the example below, records that have System Development set in ClassB of child records of site ID 7 linked by ClassA are extracted and displayed. The following description allows you to filter by child record items. If multiple child records are found, multiple records with the same parent record will be displayed. ``` view.Filters['ClassA~~7,ClassB'] = '["System Development"]'; ``` In the example below, only records where the value of ClassA matches the value of ClassB will be extracted and displayed. By specifying the item to compare in the format of '{first item}|{second item}' for any property starting with eq_, you can filter out only records where the values ​​of the two items match. *However, you cannot specify items with different data types for the two items. The data type of each item is listed in the list of Correspondence between item names and "[Column Name](/en/manual/dev-column-name)" in the database. ##### JavaScript ``` view.Filters.eq_MyFilterName = 'ClassA|ClassB'; ``` In the example below, only records where the values ​​of ClassA and ClassB do not match will be extracted and displayed. By specifying the items to compare in the format '{first item}|{second item}' for any property starting with notEq_, you can filter out only records where the values ​​of the two items match. *However, you cannot specify items with different data types for the two items. The data type of each item is listed in the list of Correspondence between item names and "[Column Name](/en/manual/dev-column-name)" in the database. ##### JavaScript ``` view.Filters.notEq_MyFilterName = 'NumA|NumB'; ``` Properties beginning with eq_ and notEq_ can be used in combination with properties beginning with or_ and and_. You can also specify the fields of the linked parent record. In the example below, only records where "the title of the record with site ID 10 linked with ClassA matches the value of ClassB" or "the value of NumA of the record with site ID 10 linked with ClassA matches the value of NumA" are extracted and displayed. ##### JavaScript ``` let data = {} data.eq_Filter1 = 'ClassA~10,Title|ClassB'; data.eq_Filter2 = 'ClassA~10,NumA|NumA'; view.Filters.or_MyFilter = JSON.stringify(data); ``` ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-grid">Table Function: Record Screen Index</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-record-access-control">Table Function: Record Access Control</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management">Manage Table</a><span>10.02.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-title">Table Management: Item: Title</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-status">Manage Table: Column: Status</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-owner">Manage Table: Column: Owner</a><span>10.11.2024 up</span></li> <li><a href="/en/manual/table-management-class">Table Management: Item: Classification</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-num">Manage Table: Column: Numerical Value</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-date">Table Management: Item: Date</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-check">Table Management: Item: Check </a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-attachments">Table Management: Item: Attachment</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-comments">Table Management: Item: Comment</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-editor">Table Management: Editor</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-choices-text-users">Table Management: Editor: Item Detail Settings: Option List: User</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-filter">Manage Table: Filter</a><span>10.02.2024 up</span></li> <li><a href="/en/manual/table-management-filter-search-types">Manage Table: Filter: Search Type</a><span>10.02.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-search-type">Table Management: Search: Search Settings: Search Type</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-disable-cross-search">Manage Table: Search: Search Settings: Disable Cross Search</a><span>10.04.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/crosssearch">Common Function: Cross Search</a><span>08.14.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/dev-column-name">Correspondence of Column name and Name in the system in the Database</a><span>10.04.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/server-script-view-filters-cleared">Developer Function: Server Script: view.FiltersCleared</a><span>08.14.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.