English
FQL Guide
About 971 wordsAbout 3 min
2026-01-09
1. What is FQL
FQL is a SQL-like query statement that can be used in APL. Developers can use FQL in APL to query business data in an enterprise.
2. FQL Syntax
SELECT
field_name1 [, field_name2 ...]
[FROM object_apiName
[WHERE where_condition]
[ORDER BY {col_name | expr | position}
[ASC | DESC], ...]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]Notes
select *is not supported for querying all fields. You can only query required fields by usingselect field1, field2....- The default
limitis 10, the maximum value is 100, and the defaultoffsetis 0. - OR conditions require separate activation. Please contact sales to order the product: Object list filtering support for OR.
3. Operators Supported in Where Conditions
- AND query: AND
- select name from object_227xW__c where (field_rzv5M__c is null and field_rzv5M__c<= 100) order by _id desc limit 10 offset 0;- OR query: OR. In SQL, AND has higher precedence than OR. To execute OR first, use parentheses.
select name from object_227xW__c where (field_rzv5M__c is null or field_rzv5M__c<= 100) order by _id desc limit 10 offset 0;- Equality and inequality: =, !=
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c = '1398***3405' limit 10 offset 0;
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c != '1398***3405' limit 10 offset 0;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c = 100 limit 10 offset 0;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c != 100 limit 10 offset 0;- Greater than: >, less than: <
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c<100 limit 10 offset 0;- Greater than or equal to: >=, less than or equal to: <=
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>= 100 limit 10 offset 0;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c<= 100 limit 10 offset 0;- Fuzzy query: like, not like. When
like 'xx'does not contain%, it is equivalent to=.
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '%88523%';
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '%88523';
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c like '88523%';
select _id, field_rzv5M__c, name from object_227xW__c where field_oc43W__c not like '%88523%';- Null value checks: is null, is not null
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c is null;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c is not null;- Array contains: @>, applicable to List-type fields such as single-select and multi-select.
select _id, field_D8JyW__c, name from object_227xW__c where field_D8JyW__c @>ARRAY['option1', 'option2'];Array has overlapping elements: &&, applicable to user multi-select and department multi-select. For example,
ARRAY[1,4,3]&&ARRAY[2,1] = truebecause element 1 overlaps, andARRAY[1,4,3]&&ARRAY[2] = falsebecause there is no overlapping element.When a query statement combines && with other operators, && must be enclosed in parentheses. Otherwise, a parsing error occurs.
// Example:
select _id, name from object_C0vxo__c where create_time>0 and field_7cQ6y__c&&ARRAY[1000]
// Change it to:
select _id, name from object_C0vxo__c where create_time>0 and (field_7cQ6y__c&&ARRAY[1000])
select _id from object_C0vxo__c where field_7cQ6y__c&&ARRAY[1000];- IN statements: IN, NOT IN
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c IN (21, 100);
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c not IN (21, 100);- BETWEEN statements: BETWEEN AND, NOT BETWEEN AND
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c BETWEEN 21 and 100;
select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c not BETWEEN 21 and 100;4. Advanced Usage
- Field-to-field comparison is supported. Operators such as in, between, and @> are not supported for field-to-field comparison.
select name from AccountObj where last_modified_time>create_time;
select name from AccountObj where name != firstName;
select name from AccountObj where name = firstName;
select name from AccountObj where name<= firstName;- Aggregate queries support aggregate functions count/sum/min/max/avg and group aggregation by group by. Having is not supported.
- Aggregate functions are aggregated from ES by default.
- select count(1) from object_227xW__c where field_qC2yp__c is not null
select sum(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
select max(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
select min(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
select avg(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c
// Multiple aggregate functions and multiple group by fields
select avg(field_rzv5M__c), sum(field_rzv5M__c) from object_227xW__c where field_qC2yp__c is not null group by field_qC2yp__c, record_type5. Code Examples
Fx.object.select
- When used for standard data queries, the
datatype in the returned value isQueryResult. - When used for aggregate queries, the
datatype isList.
// Standard usage
String sql = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;"
def rst = Fx.object.select(sql).result() as QueryResult
log.info(rst)
// To exclude invalid data and return the total number of records that match the conditions
String sql1 = "select _id, field_rzv5M__c, name from object_227xW__c where field_rzv5M__c>100 limit 10 offset 0;"
SelectAttribute att = SelectAttribute.builder()
.needInvalid(false)
.build()
def rst1 = Fx.object.select(sql1, att).result() as QueryResult
log.info(rst1)Changelog
| Version | Date | Changes | Owner |
|---|---|---|---|
| v1.0 | 2026-05-19 | Initial version |
Background
This document describes the features and usage of FQL, helping developers quickly integrate related capabilities.
Applicable Scenarios
Specific applicable scenarios are determined by actual business requirements. Developers can select the corresponding interfaces for integration as needed.
Prerequisites
- Access to Fxiaoke Open Platform has been completed.
- Application authorization and configuration have been completed.
- Basic knowledge of the relevant business domain is understood.
Steps
For specific steps, see the detailed description of each interface.
Notes
- Ensure that prerequisites are met before calling interfaces.
- Pay attention to interface call frequency limits.
- For exceptions, refer to the error code description for handling.
Compatibility note: The current version has no available deprecation or compatibility notes.
