Filter function based on related data
Here, we will introduce how to use the filter function to search for related data as a condition. By creating a filter in the format of :R(%module_name%:q|%filter_query%|)
, you can specify filtering conditions for related information, and you can search flexibly by combining keywords and tags.
How to set up
Preparation
In order to narrow down related information, first set the modules that are allowed to be used with filter_request_allow_list
.
Write filter_request_allow_list
in the following format.
:q|%module_name%:[%column_name1%,%column_name2%]
Example: :q|topics:[topics_group_id,subject]
-> Allow to specify topics_group_id, subject in subquery.
You can also specify a subquery with :ALL
like :q|tag:[:ALL]
.
For subqueries that can be specified, refer to Available items.
Change in filtering conditions
For Topics, Tag, and Inquiry, the default filtering conditions change according to the allow_list settings.
- Topics, Tags
- If the allow_list does not include open_flg, it searches only open content/tags.
- If the allow_list includes open_flg (or :ALL), it searches including private contents/tags.
- Inquiries
- If the allow_list does not include status, it searches only active forms.
- If the allow_list includes status (or :ALL), it searches including inactive forms.
Example of filter specification
Get the tag associated with the contents of topics_group_id=1 using Tag::list API
filter
: :R(topics:q|topics_group_id eq 1|)
filter_request_allow_list
: :q|topics:[topics_group_id]
Get the content associated with the tag with tag_id=50 using the Topics::list API
filter
: :R(tag:q|tag_id in [50]|)
filter_request_allow_list
: :q|tag:[tag_id]
Perform an AND search with a keyword and tag using the Topics::list API
filter
: search_keyword contains "test" AND :R(tag:q|tag_id in [50]|)
filter_request_allow_list
:[search_keyword,:q|tag:[tag_id]]
Perform an OR search within a specific tag using the Topics::list API, and then perform an AND search for each of the results.
filter
: :R(tag:q|tag_id in [7,8,9]|) AND :R(tag:q|tag_id in [5,6]|)
filter_request_allow_list
: :q|tag:[tag_id]
Available items
Currently, only a limited number of standard fields can be specified in subqueries.
The available module_name
and its subqueries (column_name
) are as follows.
Topics
topics_id
topics_group_id
contents_type
subject
open_flg
topics_flg
regular_flg
inst_ymdhi
update_ymdhi
Member
member_id
group_ids
inst_ymdhi
update_ymdhi
Inquiry
inquiry_id
inquiry_name
status
inst_ymdhi
update_ymdhi
Tag
tag_id
tag_nm
open_flg
inst_ymdhi
update_ymdhi
tag_category_id
Support
If you have any other questions, please contact us or check out Our Slack Community.