ftos.data.getByQuery
Starting with v24.3.0, this is renamed from getByQuery to ftos.data.getByQuery.
Returns a fetch result set.
This is a data service method for business service components.
Syntax
function ftos.data.getByQuery(fetch : IFtosFetch): any[];
| Parameter | Type | Description |
|---|---|---|
fetch
|
IFtosFetch | The code of the fetch query. |
Type Aliases
The code of the fetch query.
{
distinct : boolean,
entity : IFtosFetchEntity,
orderBy : IFtosFetchOrderBy[],
page : IFtosFetchPage,
where : IFtosFetchExpression,
options : {disableAutoLookupJoins : boolean}
}
| Property | Type | Description |
|---|---|---|
distinct
|
boolean | Returns only distinct values, ignoring any duplicates. |
entity
|
IFtosFetchEntity | Details about the entity and attributes to be fetched. |
orderBy
|
IFtosFetchOrderBy[] | Orders the result set ascending or descending based on the specified attributes. |
page
|
IFtosFetchPage | Returns only a specific sequence of results from the result set. |
where
|
IFtosFetchExpression | Criteria used to filter the result set. |
options
|
{disableAutoLookupJoins: boolean} | Disables the auto joins added automatically for lookups and option sets (needed to retrieve the display names):
|
Details about the entity and attributes to be fetched.
{
alias : string;
attributeList : IFtosFetchAttribute[];
join : IFtosFetchJoin[];
name : string;
}
| Property | Type | Description |
|---|---|---|
alias
|
string | Gives the entity a temporary name for the duration of the fetch to be used in the fetch code. |
attributeList
|
IFtosFetchAttribute[] | List of attributes to be fetched. |
join
|
IFtosFetchJoin[] | Combines records from multiple entities based on matching attributes. |
name
|
string | Entity name. |
Orders the result set ascending or descending based on the specified attributes.
{
attribute : string;
type : "asc" | "desc";
}
| Property | Type | Description |
|---|---|---|
attribute
|
string | Attribute name. |
type
|
"asc" | "desc" | Orders results either ascending or descending. |
Returns only a specific sequence of results from the result set.
{
returnCount : boolean;
skip : number;
take : number;
}
| Property | Type | Description |
|---|---|---|
returnCount
|
boolean | Include the number of returned records in the result set. |
skip
|
number | Skips the specified number of records from the beginning of the result set. |
take
|
number | Specifies the number of records to return. |
Criteria used to filter the result set.
{
conditionList : IFtosFetchCondition[];
expressionList : IFtosFetchExpression[];
type : "and" | "or";
}
| Property | Type | Description |
|---|---|---|
conditionList
|
IFtosFetchCondition[] | Filters the returned results based on the specified criterion. |
expressionList
|
IFtosFetchExpression[] | Sub-expression to be used as filtering criterion in the expression. |
type
|
"and" | "or" |
|
Attribute whose values will be returned in the result set.
{
alias : string;
name : string;
}
| Property | Type | Description |
|---|---|---|
alias
|
string | Gives the attribute a temporary name for the duration of the fetch to be used in the fetch code. |
name
|
string | Attribute name. |
Combines records from multiple entities based on matching attributes.
{
entity : IFtosFetchEntity;
fromTo : IFtosFromTo[];
type : "inner" | "left";
}
| Property | Type | Description |
|---|---|---|
entity
|
IFtosFetchEntity | Entity on the right side of the join. |
fromTo
|
IFtosFromTo[] | Pairs attribute values to be matched on the left side and right side of the join. |
type
|
"inner" | "left" |
|
Filters the returned results based on the specified criterion.
{
first : string;
second : string;
type :
"contains" |
"notcontains" |
"equals" |
"notequals" |
"gt" |
"gte" |
"lt" |
"lte" |
"isnotnull" |
"isnull" |
"lastxdays" |
"lastxmonths" |
"lastxyears" |
"nextxdays" |
"nextxmonths" |
"nextxyears" |
"lastxweeks" |
"nextxweeks";
}
| Property | Type | Description |
|---|---|---|
first
|
string | First operator of the condition. |
second
|
string | Second operator of the condition. |
type
|
"contains" | "notcontains" | "equals" | "notequals" | "gt" | "gte" | "lt" | "lte" | "isnotnull" | "isnull" | "lastxdays" | "lastxmonths" | "lastxyears" | "nextxdays" | "nextxmonths" | "nextxyears" | "lastxweeks" | "nextxweeks" | Condition operand.
|
Pairs attribute values to be matched in an entity join.
{
from : string;
to : string;
}
| Property | Type | Description |
|---|---|---|
from
|
string | Attribute on the left side of the join. |
to
|
string | Attribute on the right side of the join. |
Return Value
Returns a JSON object that contains the fetch result set.
Examples
In this example:
- We query the Customers entity for each customer's name and customerid.
- We store the result in an object called resultset.
var resultset = ftos.data.getByQuery({
"entity": {
"alias": "base",
"name": "Customers",
"attributelist": [{
"name": "name",
"alias": "name",
"attributeType": 3
}, {
"name": "customerid",
"alias": "ID",
"attributeType": 1
}]
}
});