Hi!
Version: v2.0.0-beta.17
I have added a Table block, and a Filter block that filters on “Status”. When I click on filter the request is logged as
request GET /api/tenants:list?filter=%7B%22$and%22:[%7B%22status%22:%7B%22$eq%22:%22ACTIVE%22%7D%7D]%7D&page=1&pageSize=20&tree=false
which decodes to
filter={"$and":[{"status":{"$eq":"ACTIVE"}}]}&page=1&pageSize=20&tree=false
How should I map this to the data source filter which expects:
GET /api/tenants?status=ACTIVE&page=1&pageSize=20
Much appreciated,
Kevin
The filter parameter cannot be mapped and requires third-party adaptation.
I don’t understand. Do you mean the data source third-party or a Nocobase third-party plugin or something else?
In order map the internal syntax I would need to know what the rules are. Where can I find such information?
Or is this something that just needs to be fixed in the REST API plugin?
Cheers,
Kevin
Example of filtering in NocoBase using a boolean field named isonduty:
-
With the operator set to “Yes” and the filter content set to “Yes”:
filter:{"$and":[{"isonduty":{"$isTruly":true}}]}
Filter data with a value of true
-
With the operator set to “Yes” and the filter content set to “No”:
filter:{"$and":[{"isonduty":{"$isTruly":false}}]}
Filter data with a value of false
-
With the operator set to “No” and the filter content set to “Yes”:
filter:{"$and":[{"isonduty":{"$isFalsy":true}}]}
Filter data with a value of false
-
With the operator set to “No” and the filter content set to “No”:
filter:{"$and":[{"isonduty":{"$isFalsy":false}}]}
Filter data with a value of true
-
With the operator set to “is empty” and the filter box set to Yes: filter :{"$and":[{"isonduty":{"$empty":true}}]}
Filter data with empty values
-
With the operator set to “is empty” and the filter box set to No: filter:{"$and":[{"isonduty":{"$empty":false}}]}
Filter data where the value is not empty
-
With the operator set to “is not empty” and the filter box set to Yes: filter: {"$and":[{"isonduty":{"$notEmpty":true}}]}
Filter data where the value is not empty
-
With the operator set to “is not empty” and the filter box set to No: filter: {"$and":[{"isonduty":{"$notEmpty":false}}]}
Filter data with empty values
The filter parameter will be passed to the third-party API as a whole. NocoBase does not support converting the filter content into data that conforms to the format of the third-party API. The third-party API needs to receive the filter content from NocoBase and then parse it.